xmlbeans-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ra...@apache.org
Subject svn commit: r650629 - /xmlbeans/trunk/src/typeimpl/org/apache/xmlbeans/impl/schema/StscState.java
Date Tue, 22 Apr 2008 20:00:27 GMT
Author: radup
Date: Tue Apr 22 13:00:24 2008
New Revision: 650629

URL: http://svn.apache.org/viewvc?rev=650629&view=rev
Log:
Added Schema compilation option to skip errors in case duplicate component declarations are
encountered.

Modified:
    xmlbeans/trunk/src/typeimpl/org/apache/xmlbeans/impl/schema/StscState.java

Modified: xmlbeans/trunk/src/typeimpl/org/apache/xmlbeans/impl/schema/StscState.java
URL: http://svn.apache.org/viewvc/xmlbeans/trunk/src/typeimpl/org/apache/xmlbeans/impl/schema/StscState.java?rev=650629&r1=650628&r2=650629&view=diff
==============================================================================
--- xmlbeans/trunk/src/typeimpl/org/apache/xmlbeans/impl/schema/StscState.java (original)
+++ xmlbeans/trunk/src/typeimpl/org/apache/xmlbeans/impl/schema/StscState.java Tue Apr 22
13:00:24 2008
@@ -92,6 +92,7 @@
     private boolean _noUpa;
     private boolean _noPvr;
     private boolean _noAnn;
+    private boolean _mdefAll;
     private Set _mdefNamespaces     = buildDefaultMdefNamespaces();
     private EntityResolver _entityResolver;
     private File _schemasDir;
@@ -532,12 +533,18 @@
             _mdefNamespaces.addAll((Collection)options.get(XmlOptions.COMPILE_MDEF_NAMESPACES));
             
             String local = "##local";
+            String any = "##any";
             
             if (_mdefNamespaces.contains(local))
             {
                 _mdefNamespaces.remove(local);
                 _mdefNamespaces.add("");
             }
+            if (_mdefNamespaces.contains(any))
+            {
+                _mdefNamespaces.remove(any);
+                _mdefAll = true;
+            }
         }
     }
 
@@ -747,10 +754,17 @@
             {
                 if (_redefinedGlobalTypes.containsKey(redefined))
                 {
-                    if (!ignoreMdef(name))
-                        error(XmlErrorCodes.SCHEMA_PROPERTIES$DUPLICATE,
-                            new Object[] { "global type", QNameHelper.pretty(name), ((SchemaType)
_redefinedGlobalTypes.get(redefined)).getSourceName() } ,
-                            type.getParseObject());
+                    if (!ignoreMdef(name)) {
+                        if (_mdefAll) {
+                            warning(XmlErrorCodes.SCHEMA_PROPERTIES$DUPLICATE,
+                                    new Object[] { "global type", QNameHelper.pretty(name),
((SchemaType) _redefinedGlobalTypes.get(redefined)).getSourceName() } ,
+                                    type.getParseObject());
+                        } else {
+                            error(XmlErrorCodes.SCHEMA_PROPERTIES$DUPLICATE,
+                                new Object[] { "global type", QNameHelper.pretty(name), ((SchemaType)
_redefinedGlobalTypes.get(redefined)).getSourceName() } ,
+                                type.getParseObject());
+                        }
+                    }
                 }
                 else
                 {
@@ -762,10 +776,17 @@
             {
                 if (_globalTypes.containsKey(name))
                 {
-                    if (!ignoreMdef(name))
-                        error(XmlErrorCodes.SCHEMA_PROPERTIES$DUPLICATE,
-                            new Object[] { "global type", QNameHelper.pretty(name), ((SchemaType)
_globalTypes.get(name)).getSourceName() },
-                            type.getParseObject());
+                    if (!ignoreMdef(name)) {
+                        if (_mdefAll) {
+                            warning(XmlErrorCodes.SCHEMA_PROPERTIES$DUPLICATE,
+                                    new Object[] { "global type", QNameHelper.pretty(name),
((SchemaType) _globalTypes.get(name)).getSourceName() },
+                                    type.getParseObject());
+                        } else {
+                            error(XmlErrorCodes.SCHEMA_PROPERTIES$DUPLICATE,
+                                new Object[] { "global type", QNameHelper.pretty(name), ((SchemaType)
_globalTypes.get(name)).getSourceName() },
+                                type.getParseObject());
+                        }
+                    }
                 }
                 else
                 {
@@ -809,10 +830,17 @@
     {
         if (_documentTypes.containsKey(name))
         {
-            if (!ignoreMdef(name))
-                error(XmlErrorCodes.SCHEMA_PROPERTIES$DUPLICATE,
-                    new Object[] { "global element", QNameHelper.pretty(name), ((SchemaComponent)
_documentTypes.get(name)).getSourceName() },
-                    type.getParseObject());
+            if (!ignoreMdef(name)) {
+                if (_mdefAll) {
+                    warning(XmlErrorCodes.SCHEMA_PROPERTIES$DUPLICATE,
+                            new Object[] { "global element", QNameHelper.pretty(name), ((SchemaComponent)
_documentTypes.get(name)).getSourceName() },
+                            type.getParseObject());
+                } else {                
+                    error(XmlErrorCodes.SCHEMA_PROPERTIES$DUPLICATE,
+                        new Object[] { "global element", QNameHelper.pretty(name), ((SchemaComponent)
_documentTypes.get(name)).getSourceName() },
+                        type.getParseObject());
+                }
+            }
         }
         else
         {
@@ -847,10 +875,17 @@
     {
         if (_attributeTypes.containsKey(name))
         {
-            if (!ignoreMdef(name))
-                error(XmlErrorCodes.SCHEMA_PROPERTIES$DUPLICATE,
-                    new Object[] { "global attribute", QNameHelper.pretty(name), ((SchemaComponent)
_attributeTypes.get(name)).getSourceName() },
-                    type.getParseObject());
+            if (!ignoreMdef(name)) {
+                if (_mdefAll) {
+                    warning(XmlErrorCodes.SCHEMA_PROPERTIES$DUPLICATE,
+                        new Object[] { "global attribute", QNameHelper.pretty(name), ((SchemaComponent)
_attributeTypes.get(name)).getSourceName() },
+                        type.getParseObject());
+                } else {
+                    error(XmlErrorCodes.SCHEMA_PROPERTIES$DUPLICATE,
+                        new Object[] { "global attribute", QNameHelper.pretty(name), ((SchemaComponent)
_attributeTypes.get(name)).getSourceName() },
+                        type.getParseObject());
+                }
+            }
         }
         else
         {
@@ -973,10 +1008,17 @@
             {
                 if (_redefinedAttributeGroups.containsKey(redefined))
                 {
-                    if (!ignoreMdef(name))
-                        error(XmlErrorCodes.SCHEMA_PROPERTIES$DUPLICATE,
-                            new Object[] { "attribute group", QNameHelper.pretty(name), ((SchemaComponent)
_redefinedAttributeGroups.get(redefined)).getSourceName() },
-                            attributeGroup.getParseObject());
+                    if (!ignoreMdef(name)) {
+                        if (_mdefAll) {
+                            warning(XmlErrorCodes.SCHEMA_PROPERTIES$DUPLICATE,
+                                new Object[] { "attribute group", QNameHelper.pretty(name),
((SchemaComponent) _redefinedAttributeGroups.get(redefined)).getSourceName() },
+                                attributeGroup.getParseObject());
+                        } else {
+                            error(XmlErrorCodes.SCHEMA_PROPERTIES$DUPLICATE,
+                                new Object[] { "attribute group", QNameHelper.pretty(name),
((SchemaComponent) _redefinedAttributeGroups.get(redefined)).getSourceName() },
+                                attributeGroup.getParseObject());
+                        }
+                    }
                 }
                 else
                 {
@@ -988,10 +1030,17 @@
             {
                 if (_attributeGroups.containsKey( name ))
                 {
-                    if (!ignoreMdef(name))
-                        error(XmlErrorCodes.SCHEMA_PROPERTIES$DUPLICATE,
-                            new Object[] { "attribute group", QNameHelper.pretty(name), ((SchemaComponent)
_attributeGroups.get(name)).getSourceName() },
-                            attributeGroup.getParseObject());
+                    if (!ignoreMdef(name)) {
+                        if (_mdefAll) {
+                            warning(XmlErrorCodes.SCHEMA_PROPERTIES$DUPLICATE,
+                                new Object[] { "attribute group", QNameHelper.pretty(name),
((SchemaComponent) _attributeGroups.get(name)).getSourceName() },
+                                attributeGroup.getParseObject());
+                        } else {
+                            error(XmlErrorCodes.SCHEMA_PROPERTIES$DUPLICATE,
+                                new Object[] { "attribute group", QNameHelper.pretty(name),
((SchemaComponent) _attributeGroups.get(name)).getSourceName() },
+                                attributeGroup.getParseObject());
+                        }
+                    }
                 }
                 else
                 {
@@ -1052,10 +1101,17 @@
             {
                 if (_redefinedModelGroups.containsKey(redefined))
                 {
-                    if (!ignoreMdef(name))
-                        error(XmlErrorCodes.SCHEMA_PROPERTIES$DUPLICATE,
-                            new Object[] { "model group", QNameHelper.pretty(name), ((SchemaComponent)
_redefinedModelGroups.get(redefined)).getSourceName() },
-                            modelGroup.getParseObject());
+                    if (!ignoreMdef(name)) {
+                        if (_mdefAll) {
+                            warning(XmlErrorCodes.SCHEMA_PROPERTIES$DUPLICATE,
+                                    new Object[] { "model group", QNameHelper.pretty(name),
((SchemaComponent) _redefinedModelGroups.get(redefined)).getSourceName() },
+                                    modelGroup.getParseObject());
+                        } else {
+                            error(XmlErrorCodes.SCHEMA_PROPERTIES$DUPLICATE,
+                                new Object[] { "model group", QNameHelper.pretty(name), ((SchemaComponent)
_redefinedModelGroups.get(redefined)).getSourceName() },
+                                modelGroup.getParseObject());
+                        }
+                    }
                 }
                 else
                 {
@@ -1067,10 +1123,17 @@
             {
                 if (_modelGroups.containsKey(name))
                 {
-                    if (!ignoreMdef(name))
-                        error(XmlErrorCodes.SCHEMA_PROPERTIES$DUPLICATE,
-                            new Object[] { "model group", QNameHelper.pretty(name), ((SchemaComponent)
_modelGroups.get(name)).getSourceName() },
-                            modelGroup.getParseObject());
+                    if (!ignoreMdef(name)) {
+                        if (_mdefAll) {
+                            warning(XmlErrorCodes.SCHEMA_PROPERTIES$DUPLICATE,
+                                    new Object[] { "model group", QNameHelper.pretty(name),
((SchemaComponent) _modelGroups.get(name)).getSourceName() },
+                                    modelGroup.getParseObject());
+                        } else {
+                            error(XmlErrorCodes.SCHEMA_PROPERTIES$DUPLICATE,
+                                new Object[] { "model group", QNameHelper.pretty(name), ((SchemaComponent)
_modelGroups.get(name)).getSourceName() },
+                                modelGroup.getParseObject());
+                        }
+                    }
                 }
                 else
                 {



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@xmlbeans.apache.org
For additional commands, e-mail: commits-help@xmlbeans.apache.org


Mime
View raw message