Author: mukulg
Date: Wed Oct 10 07:00:56 2012
New Revision: 1396487

URL: http://svn.apache.org/viewvc?rev=1396487&view=rev
Log:
committing additional fix for jira issue, XERCESJ-1584 (as reported in the 
latest comment)

Modified:
    
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/traversers/XSDComplexTypeTraverser.java
    
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/traversers/XSDSimpleTypeTraverser.java

Modified: 
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/traversers/XSDComplexTypeTraverser.java
URL: 
http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/traversers/XSDComplexTypeTraverser.java?rev=1396487&r1=1396486&r2=1396487&view=diff
==============================================================================
--- 
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/traversers/XSDComplexTypeTraverser.java
 (original)
+++ 
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/traversers/XSDComplexTypeTraverser.java
 Wed Oct 10 07:00:56 2012
@@ -214,17 +214,15 @@ class  XSDComplexTypeTraverser extends X
         if (complexTypeName == null) {
             reportSchemaError("s4s-att-must-appear", new 
Object[]{SchemaSymbols.ELT_COMPLEXTYPE, SchemaSymbols.ATT_NAME}, 
complexTypeNode);
             type = null;
-        } else {
-
-            // XML Schema 1.1
-            // If parent of complex type is redefine, then we need to set the
-            // context of the redefined complex type
-            if (fSchemaHandler.fSchemaVersion == Constants.SCHEMA_VERSION_1_1) 
{
-                Element parent = DOMUtil.getParent(complexTypeNode);
-                if 
(DOMUtil.getLocalName(parent).equals(SchemaSymbols.ELT_REDEFINE)) {
-                    ((XSComplexTypeDecl)type.getBaseType()).setContext(type);
-                    grammar.addGlobalComplexTypeDecl(type);
+        } else {            
+            if 
(DOMUtil.getLocalName(DOMUtil.getParent(complexTypeNode)).equals(SchemaSymbols.ELT_REDEFINE))
 {
+                if (fSchemaHandler.fSchemaVersion == 
Constants.SCHEMA_VERSION_1_1) {
+                   // XML Schema 1.1
+                   // If parent of complex type is redefine, then we need to 
set the
+                   // context of the redefined complex type
+                   ((XSComplexTypeDecl)type.getBaseType()).setContext(type);
                 }
+                grammar.addGlobalComplexTypeDecl(type);
             }
             
             if (grammar.getGlobalTypeDecl(type.getName()) == null) {

Modified: 
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/traversers/XSDSimpleTypeTraverser.java
URL: 
http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/traversers/XSDSimpleTypeTraverser.java?rev=1396487&r1=1396486&r2=1396487&view=diff
==============================================================================
--- 
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/traversers/XSDSimpleTypeTraverser.java
 (original)
+++ 
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/traversers/XSDSimpleTypeTraverser.java
 Wed Oct 10 07:00:56 2012
@@ -108,22 +108,20 @@ class XSDSimpleTypeTraverser extends XSD
         }
         
         // don't add global components without name to the grammar
-        if (type != null) {
-            
-            // XML Schema 1.1
-            // If parent is redefine, then we need to set the
-            // context of the redefined simple type
-            if (fSchemaHandler.fSchemaVersion == Constants.SCHEMA_VERSION_1_1) 
{
-                Element parent = DOMUtil.getParent(elmNode);
-                if 
(DOMUtil.getLocalName(parent).equals(SchemaSymbols.ELT_REDEFINE)) {
+        if (type != null) {            
+            if 
(DOMUtil.getLocalName(DOMUtil.getParent(elmNode)).equals(SchemaSymbols.ELT_REDEFINE))
 {
+                if (fSchemaHandler.fSchemaVersion == 
Constants.SCHEMA_VERSION_1_1) {
+                    // XML Schema 1.1
+                    // If parent is redefine, then we need to set the
+                    // context of the redefined simple type 
                     final XSTypeDefinition baseType = type.getBaseType();
                     if (baseType instanceof XSSimpleTypeDecl) {
-                        ((XSSimpleTypeDecl)baseType).setContext(type);
-                        grammar.addGlobalSimpleTypeDecl(type);
+                        ((XSSimpleTypeDecl)baseType).setContext(type);         
               
                     }
                 }
+                grammar.addGlobalSimpleTypeDecl(type);
             }
-            
+                        
             if (grammar.getGlobalTypeDecl(type.getName()) == null) {
                 grammar.addGlobalSimpleTypeDecl(type);
             }



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@xerces.apache.org
For additional commands, e-mail: commits-h...@xerces.apache.org

Reply via email to