ws-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject svn commit: r1623505 - in /webservices/xmlschema/trunk/xmlschema-core/src: main/java/org/apache/ws/commons/schema/SchemaBuilder.java main/java/org/apache/ws/commons/schema/XmlSchemaAny.java test/java/tests/AnyTest.java
Date Mon, 08 Sep 2014 19:37:38 GMT
Author: dkulp
Date: Mon Sep  8 19:37:38 2014
New Revision: 1623505

URL: http://svn.apache.org/r1623505
Log:
[XMLSCHEMA-34] Attach schema target namespace fo XmlSchemaAny
Patch from Michael Pigott applied

Modified:
    webservices/xmlschema/trunk/xmlschema-core/src/main/java/org/apache/ws/commons/schema/SchemaBuilder.java
    webservices/xmlschema/trunk/xmlschema-core/src/main/java/org/apache/ws/commons/schema/XmlSchemaAny.java
    webservices/xmlschema/trunk/xmlschema-core/src/test/java/tests/AnyTest.java

Modified: webservices/xmlschema/trunk/xmlschema-core/src/main/java/org/apache/ws/commons/schema/SchemaBuilder.java
URL: http://svn.apache.org/viewvc/webservices/xmlschema/trunk/xmlschema-core/src/main/java/org/apache/ws/commons/schema/SchemaBuilder.java?rev=1623505&r1=1623504&r2=1623505&view=diff
==============================================================================
--- webservices/xmlschema/trunk/xmlschema-core/src/main/java/org/apache/ws/commons/schema/SchemaBuilder.java
(original)
+++ webservices/xmlschema/trunk/xmlschema-core/src/main/java/org/apache/ws/commons/schema/SchemaBuilder.java
Mon Sep  8 19:37:38 2014
@@ -858,6 +858,8 @@ public class SchemaBuilder {
 
         XmlSchemaAny any = new XmlSchemaAny();
 
+        any.setTargetNamespace(schema.getLogicalTargetNamespace());
+
         if (anyEl.hasAttribute("namespace")) {
             any.setNamespace(anyEl.getAttribute("namespace"));
         }

Modified: webservices/xmlschema/trunk/xmlschema-core/src/main/java/org/apache/ws/commons/schema/XmlSchemaAny.java
URL: http://svn.apache.org/viewvc/webservices/xmlschema/trunk/xmlschema-core/src/main/java/org/apache/ws/commons/schema/XmlSchemaAny.java?rev=1623505&r1=1623504&r2=1623505&view=diff
==============================================================================
--- webservices/xmlschema/trunk/xmlschema-core/src/main/java/org/apache/ws/commons/schema/XmlSchemaAny.java
(original)
+++ webservices/xmlschema/trunk/xmlschema-core/src/main/java/org/apache/ws/commons/schema/XmlSchemaAny.java
Mon Sep  8 19:37:38 2014
@@ -32,8 +32,8 @@ public class XmlSchemaAny extends XmlSch
      */
     private String namespace;
     private XmlSchemaContentProcessing processContent;
+    private String targetNamespace;
 
-    
     /**
      * Creates new XmlSchemaAny
      */
@@ -58,4 +58,30 @@ public class XmlSchemaAny extends XmlSch
         this.processContent = processContent;
     }
 
+    /**
+     * {@link #getNamespace()} returns the namespace or set of namespaces
+     * that this wildcard element is valid for.  The target namespaces may
+     * include <code>##other</code>, <code>##targetNamespace</code>.
 The
+     * <code>##other</code> directive means any namespace other than the
+     * schema's target namespace, while the <code>##targetNamespace</code>
+     * directive means the element <i>must be</i> in the schema's target
+     * namespace.  Resolving either of these requires knowledge of what
+     * the schema's target namespace is, which is returned by this method.
+     *
+     * @return The wildcard element's target namespace.
+     */
+    public String getTargetNamespace() {
+    	return targetNamespace;
+    }
+
+    /**
+     * Sets the schema's target namespace.
+     *
+     * @param namespace The schema's target namespace.
+     *
+     * @see #getTargetNamespace()
+     */
+    public void setTargetNamespace(String namespace) {
+    	targetNamespace = namespace;
+    }
 }

Modified: webservices/xmlschema/trunk/xmlschema-core/src/test/java/tests/AnyTest.java
URL: http://svn.apache.org/viewvc/webservices/xmlschema/trunk/xmlschema-core/src/test/java/tests/AnyTest.java?rev=1623505&r1=1623504&r2=1623505&view=diff
==============================================================================
--- webservices/xmlschema/trunk/xmlschema-core/src/test/java/tests/AnyTest.java (original)
+++ webservices/xmlschema/trunk/xmlschema-core/src/test/java/tests/AnyTest.java Mon Sep  8
19:37:38 2014
@@ -182,6 +182,7 @@ public class AnyTest extends Assert {
                 assertEquals("none", xscp.toString());
                 assertEquals(minCount, ((XmlSchemaAny)o).getMinOccurs());
                 assertEquals(maxCount, ((XmlSchemaAny)o).getMaxOccurs());
+                assertEquals(elementQName.getNamespaceURI(), ((XmlSchemaAny) o).getTargetNamespace());
             }
         }
 



Mime
View raw message