You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commons-dev@ws.apache.org by aj...@apache.org on 2007/05/22 07:46:53 UTC

svn commit: r540428 - /webservices/commons/trunk/modules/XmlSchema/src/main/java/org/apache/ws/commons/schema/SchemaBuilder.java

Author: ajith
Date: Mon May 21 22:46:51 2007
New Revision: 540428

URL: http://svn.apache.org/viewvc?view=rev&rev=540428
Log:
1. fixed Jira issue 204 (https://issues.apache.org/jira/browse/WSCOMMONS-204)
  * need to add a test case to verify this

Modified:
    webservices/commons/trunk/modules/XmlSchema/src/main/java/org/apache/ws/commons/schema/SchemaBuilder.java

Modified: webservices/commons/trunk/modules/XmlSchema/src/main/java/org/apache/ws/commons/schema/SchemaBuilder.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/XmlSchema/src/main/java/org/apache/ws/commons/schema/SchemaBuilder.java?view=diff&rev=540428&r1=540427&r2=540428
==============================================================================
--- webservices/commons/trunk/modules/XmlSchema/src/main/java/org/apache/ws/commons/schema/SchemaBuilder.java (original)
+++ webservices/commons/trunk/modules/XmlSchema/src/main/java/org/apache/ws/commons/schema/SchemaBuilder.java Mon May 21 22:46:51 2007
@@ -181,11 +181,11 @@
                 XmlSchemaAttributeGroup group = handleAttributeGroup(schema,
                         el, schemaEl);
                 schema.attributeGroups.collection.put(
-                         group.name, group);
+                        group.name, group);
                 schema.items.add(group);
             } else if (el.getLocalName().equals("attribute")) {
                 XmlSchemaAttribute attr = handleAttribute(schema,
-                        el, schemaEl);
+                        el, schemaEl,true); //pass true to indicate that it is a top level child
                 schema.attributes.collection.put(attr.qualifiedName, attr);
                 schema.items.add(attr);
             } else if (el.getLocalName().equals("redefine")) {
@@ -673,8 +673,8 @@
     }
 
     private XmlSchemaSimpleContent
-            handleSimpleContent(XmlSchema schema, Element simpleEl,
-                                Element schemaEl) {
+    handleSimpleContent(XmlSchema schema, Element simpleEl,
+                        Element schemaEl) {
 
         XmlSchemaSimpleContent simpleContent =
                 new XmlSchemaSimpleContent();
@@ -721,8 +721,8 @@
     }
 
     private XmlSchemaSimpleContentRestriction
-            handleSimpleContentRestriction(XmlSchema schema,
-                                           Element restrictionEl, Element schemaEl) {
+    handleSimpleContentRestriction(XmlSchema schema,
+                                   Element restrictionEl, Element schemaEl) {
 
         XmlSchemaSimpleContentRestriction restriction =
                 new XmlSchemaSimpleContentRestriction();
@@ -774,8 +774,8 @@
     }
 
     private XmlSchemaSimpleContentExtension
-            handleSimpleContentExtension(XmlSchema schema, Element extEl,
-                                         Element schemaEl) {
+    handleSimpleContentExtension(XmlSchema schema, Element extEl,
+                                 Element schemaEl) {
 
         XmlSchemaSimpleContentExtension ext =
                 new XmlSchemaSimpleContentExtension();
@@ -810,8 +810,8 @@
     }
 
     private XmlSchemaComplexContentRestriction
-            handleComplexContentRestriction(XmlSchema schema,
-                                            Element restrictionEl, Element schemaEl) {
+    handleComplexContentRestriction(XmlSchema schema,
+                                    Element restrictionEl, Element schemaEl) {
 
         XmlSchemaComplexContentRestriction restriction =
                 new XmlSchemaComplexContentRestriction();
@@ -848,8 +848,8 @@
     }
 
     private XmlSchemaComplexContentExtension
-            handleComplexContentExtension(XmlSchema schema,
-                                          Element extEl, Element schemaEl) {
+    handleComplexContentExtension(XmlSchema schema,
+                                  Element extEl, Element schemaEl) {
 
         XmlSchemaComplexContentExtension ext =
                 new XmlSchemaComplexContentExtension();
@@ -886,7 +886,7 @@
     }
 
     private XmlSchemaAttributeGroupRef
-            handleAttributeGroupRef(Element attrGroupEl
+    handleAttributeGroupRef(Element attrGroupEl
     ) {
 
         XmlSchemaAttributeGroupRef attrGroup =
@@ -1182,8 +1182,28 @@
     }
 
 
+    /**
+     * Process non-toplevel attributes
+     * @param schema
+     * @param attrEl
+     * @param schemaEl
+     * @return
+     */
     private XmlSchemaAttribute handleAttribute(XmlSchema schema,
                                                Element attrEl, Element schemaEl) {
+        return handleAttribute(schema,attrEl,schemaEl,false);
+    }
+
+    /**
+     * Process attributes
+     * @param schema
+     * @param attrEl
+     * @param schemaEl
+     * @param topLevel
+     * @return
+     */
+    private XmlSchemaAttribute handleAttribute(XmlSchema schema,
+                                               Element attrEl, Element schemaEl,boolean topLevel) {
         //todo: need to implement different rule of attribute such as
         //restriction between ref and name.  This can be implemented
         //in the compile function
@@ -1200,7 +1220,11 @@
         boolean isQualified = schema.getAttributeFormDefault().getValue().equals(XmlSchemaForm.QUALIFIED);
         if (attr.name != null) {
             final String name = attr.name;
-            attr.qualifiedName = (isQualified) ? newLocalQName(name) : new QName(name);
+            if (topLevel){
+                attr.qualifiedName = newLocalQName(name);
+            }else{
+                attr.qualifiedName = (isQualified) ? newLocalQName(name) : new QName(name);
+            }
         }
 
         if (attrEl.hasAttribute("type")) {



---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: commons-dev-help@ws.apache.org