You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xerces.apache.org by kn...@apache.org on 2009/11/26 15:30:02 UTC

svn commit: r884566 [3/3] - in /xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces: impl/xs/models/ impl/xs/traversers/ impl/xs/util/ parsers/

Modified: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/traversers/XSDKeyrefTraverser.java
URL: http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/traversers/XSDKeyrefTraverser.java?rev=884566&r1=884565&r2=884566&view=diff
==============================================================================
--- xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/traversers/XSDKeyrefTraverser.java (original)
+++ xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/traversers/XSDKeyrefTraverser.java Thu Nov 26 14:30:01 2009
@@ -83,17 +83,37 @@
 
         KeyRef keyRef = new KeyRef(schemaDoc.fTargetNamespace, krName, key);
 
-        // add to element decl
-        traverseIdentityConstraint(keyRef, krElem, schemaDoc, attrValues);
+        // If errors occurred in traversing the identity constraint, then don't
+        // add it to the schema, to avoid errors when processing the instance.
+        if (traverseIdentityConstraint(keyRef, krElem, schemaDoc, attrValues)) {
+            //Schema Component Constraint: Identity-constraint Definition Properties Correct
+            //2 If the {identity-constraint category} is keyref, the cardinality of the {fields} must equal that of the {fields} of the {referenced key}.
+            if(key.getFieldCount() != keyRef.getFieldCount()) {
+                reportSchemaError("c-props-correct.2" , new Object [] {krName,key.getIdentityConstraintName()}, krElem);
+            } else {
+                // add key reference to element decl
+                // and stuff this in the grammar
+                if (grammar.getIDConstraintDecl(keyRef.getIdentityConstraintName()) == null) {
+                    grammar.addIDConstraintDecl(element, keyRef);
+                }
 
-        //Schema Component Constraint: Identity-constraint Definition Properties Correct
-        //2 If the {identity-constraint category} is keyref, the cardinality of the {fields} must equal that of the {fields} of the {referenced key}.
-        if(key.getFieldCount() != keyRef.getFieldCount()) {
-            reportSchemaError("c-props-correct.2" , new Object [] {krName,key.getIdentityConstraintName()}, krElem);
-        } else {
-            // add key reference to element decl
-            // and stuff this in the grammar
-            grammar.addIDConstraintDecl(element, keyRef);
+                // also add it to extended map
+                final String loc = fSchemaHandler.schemaDocument2SystemId(schemaDoc);
+                final IdentityConstraint idc = grammar.getIDConstraintDecl(keyRef.getIdentityConstraintName(), loc); 
+                if (idc  == null) {
+                    grammar.addIDConstraintDecl(element, keyRef, loc);
+                }
+
+                // handle duplicates
+                if (fSchemaHandler.fTolerateDuplicates) {
+                    if (idc  != null) {
+                        if (idc instanceof KeyRef) {
+                            keyRef = (KeyRef) idc;
+                        }
+                    }
+                    fSchemaHandler.addIDConstraintDecl(keyRef);
+                }
+            }
         }
 
         // and put back attributes

Modified: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/traversers/XSDNotationTraverser.java
URL: http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/traversers/XSDNotationTraverser.java?rev=884566&r1=884565&r2=884566&view=diff
==============================================================================
--- xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/traversers/XSDNotationTraverser.java (original)
+++ xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/traversers/XSDNotationTraverser.java Thu Nov 26 14:30:01 2009
@@ -68,8 +68,10 @@
             return null;
         }
         
-        if (systemAttr == null && publicAttr == null)
+        if (systemAttr == null && publicAttr == null) {
             reportSchemaError("PublicSystemOnNotation", null, elmNode);
+            publicAttr = "missing";
+        }
         
         XSNotationDecl notation = new XSNotationDecl();
         notation.fName = nameAttr;
@@ -104,7 +106,24 @@
             reportSchemaError("s4s-elt-must-match.1", args, content);
             
         }
-        grammar.addGlobalNotationDecl(notation);
+        if (grammar.getGlobalNotationDecl(notation.fName) == null) {
+            grammar.addGlobalNotationDecl(notation);
+        }
+
+        // also add it to extended map
+        final String loc = fSchemaHandler.schemaDocument2SystemId(schemaDoc);
+        final XSNotationDecl notation2 = grammar.getGlobalNotationDecl(notation.fName, loc);  
+        if (notation2 == null) {
+            grammar.addGlobalNotationDecl(notation, loc);
+        }
+
+        // handle duplicates
+        if (fSchemaHandler.fTolerateDuplicates) {
+            if (notation2 != null) {
+                notation = notation2;
+            }
+            fSchemaHandler.addGlobalNotationDecl(notation);
+        }
         fAttrChecker.returnAttrArray(attrValues, schemaDoc);
         
         return notation;

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=884566&r1=884565&r2=884566&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 Thu Nov 26 14:30:01 2009
@@ -22,9 +22,7 @@
 
 import org.apache.xerces.impl.Constants;
 import org.apache.xerces.impl.dv.InvalidDatatypeFacetException;
-import org.apache.xerces.impl.dv.SchemaDVFactory;
 import org.apache.xerces.impl.dv.XSSimpleType;
-import org.apache.xerces.impl.dv.xs.SchemaDVFactoryImpl;
 import org.apache.xerces.impl.dv.xs.XSSimpleTypeDecl;
 import org.apache.xerces.impl.xs.SchemaGrammar;
 import org.apache.xerces.impl.xs.SchemaSymbols;
@@ -79,12 +77,6 @@
  * @version $Id$
  */
 class XSDSimpleTypeTraverser extends XSDAbstractTraverser {
-
-    private static final String EXTENDED_SCHEMA_FACTORY_CLASS = "org.apache.xerces.impl.dv.xs.ExtendedSchemaDVFactoryImpl";
-    private static final String SCHEMA11_FACTORY_CLASS = "org.apache.xerces.impl.dv.xs.Schema11DVFactoryImpl";
-
-    // the factory used to query/create simple types
-    private final SchemaDVFactory schemaFactory;
     
     // whether the type being parsed is a S4S built-in type.
     private boolean fIsBuiltIn = false;
@@ -92,10 +84,6 @@
     XSDSimpleTypeTraverser (XSDHandler handler,
             XSAttributeChecker gAttrCheck) {
         super(handler, gAttrCheck);
-        schemaFactory = getSchemaDVFactory(handler.fSchemaVersion);
-        if (schemaFactory instanceof SchemaDVFactoryImpl) {
-            ((SchemaDVFactoryImpl)schemaFactory).setDeclPool(handler.fDeclPool);
-        }
     }
 
     //return qualified name of simpleType or empty string if error occured
@@ -106,6 +94,9 @@
         // General Attribute Checking
         Object[] attrValues = fAttrChecker.checkAttributes(elmNode, true, schemaDoc);
         String nameAtt = (String)attrValues[XSAttributeChecker.ATTIDX_NAME];
+        if (nameAtt == null) {
+            attrValues[XSAttributeChecker.ATTIDX_NAME] = NO_NAME;
+        }
         XSSimpleType type = traverseSimpleTypeDecl(elmNode, attrValues, schemaDoc, grammar);
         fAttrChecker.returnAttrArray(attrValues, schemaDoc);
         
@@ -117,9 +108,28 @@
         
         // don't add global components without name to the grammar
         if (type != null) {
-            grammar.addGlobalSimpleTypeDecl(type);
+            if (grammar.getGlobalTypeDecl(type.getName()) == null) {
+                grammar.addGlobalSimpleTypeDecl(type);
+            }
+
+            // also add it to extended map
+            final String loc = fSchemaHandler.schemaDocument2SystemId(schemaDoc);
+            final XSTypeDefinition type2 = grammar.getGlobalTypeDecl(type.getName(), loc);  
+            if (type2 == null) {
+                grammar.addGlobalSimpleTypeDecl(type, loc);
+            }
+
+            // handle duplicates
+            if (fSchemaHandler.fTolerateDuplicates) {
+                if (type2 != null) {
+                    if (type2 instanceof XSSimpleType) {
+                        type = (XSSimpleType) type2;
+                    }
+                }
+                fSchemaHandler.addGlobalTypeDecl(type);
+            }
         }
-        
+
         return type;
     }
     
@@ -149,16 +159,6 @@
         return getSimpleType(name, simpleTypeDecl, attrValues, schemaDoc, grammar);
     }
 
-    private SchemaDVFactory getSchemaDVFactory(short schemaVersion) {
-        if (schemaVersion == Constants.SCHEMA_VERSION_1_0) {
-            return SchemaDVFactory.getInstance();
-        }
-        else if (schemaVersion == Constants.SCHEMA_VERSION_1_1) {
-            return SchemaDVFactory.getInstance(SCHEMA11_FACTORY_CLASS);
-        }
-
-        return SchemaDVFactory.getInstance(EXTENDED_SCHEMA_FACTORY_CLASS);
-    }
     /*
      * Generate a name for an anonymous type
      */
@@ -309,10 +309,7 @@
                 }
             }
         }
-        // when there is an error finding the base type of a restriction
-        // we use anySimpleType as the base, then we should skip the facets,
-        // because anySimpleType doesn't recognize any facet.
-        boolean skipFacets = false;
+
         // check if there is a child "simpleType"
         if (content != null && DOMUtil.getLocalName(content).equals(SchemaSymbols.ELT_SIMPLETYPE)) {
             if (restriction || list) {
@@ -320,7 +317,7 @@
                 if (baseTypeName != null) {
                     reportSchemaError(list ? "src-simple-type.3.a" : "src-simple-type.2.a", null, content);
                 }
-                else {
+                if (baseValidator == null) {
                     // traverse this child to get the base type
                     baseValidator = traverseLocal(content, schemaDoc, grammar);
                 }
@@ -353,46 +350,47 @@
             }
         }
         else if ((restriction || list) && baseTypeName == null) {
-            // it's an error if neither "base" nor "simpleType" appears
+            // it's an error if neither "base/itemType" nor "simpleType" appears
             reportSchemaError(list ? "src-simple-type.3.b" : "src-simple-type.2.b", null, child);
-            // base can't be found, skip the facets.
-            skipFacets = true;
-            baseValidator = SchemaGrammar.fAnySimpleType;
         }
         else if (union && (memberTypes == null || memberTypes.size() == 0)) {
             // it's an error if "memberTypes" is empty and no "simpleType" appears
             reportSchemaError("src-union-memberTypes-or-simpleTypes", null, child);
-            dTValidators = new ArrayList(1);
-            dTValidators.add(SchemaGrammar.fAnySimpleType);
         }
         // error finding "base" or error traversing "simpleType".
         // don't need to report an error, since some error has been reported.
         if ((restriction || list) && baseValidator == null) {
-            baseValidator = SchemaGrammar.fAnySimpleType;
+            fAttrChecker.returnAttrArray(contentAttrs, schemaDoc);
+            return errorType(name, schemaDoc.fTargetNamespace,
+                    restriction ? XSConstants.DERIVATION_RESTRICTION : XSConstants.DERIVATION_LIST);
         }
         // error finding "memberTypes" or error traversing "simpleType".
         // don't need to report an error, since some error has been reported.
         if (union && (dTValidators == null || dTValidators.size() == 0)) {
-            dTValidators = new ArrayList(1);
-            dTValidators.add(SchemaGrammar.fAnySimpleType);
+            fAttrChecker.returnAttrArray(contentAttrs, schemaDoc);
+            return errorType(name, schemaDoc.fTargetNamespace,
+                    XSConstants.DERIVATION_UNION);
         }
         // item type of list types can't have list content
         if (list && isListDatatype(baseValidator)) {
             reportSchemaError("cos-st-restricts.2.1", new Object[]{name, baseValidator.getName()}, child);
+            fAttrChecker.returnAttrArray(contentAttrs, schemaDoc);
+            return errorType(name, schemaDoc.fTargetNamespace,
+                    XSConstants.DERIVATION_LIST);
         }
         // create the simple type based on the "base" type
         XSSimpleType newDecl = null;
         if (restriction) {
-            newDecl = schemaFactory.createTypeRestriction(name, schemaDoc.fTargetNamespace, (short)finalProperty, baseValidator, 
+            newDecl = fSchemaHandler.fDVFactory.createTypeRestriction(name, schemaDoc.fTargetNamespace, (short)finalProperty, baseValidator, 
                     annotations == null? null : new XSObjectListImpl(annotations, annotations.length));
         }
         else if (list) {
-            newDecl = schemaFactory.createTypeList(name, schemaDoc.fTargetNamespace, (short)finalProperty, baseValidator,
+            newDecl = fSchemaHandler.fDVFactory.createTypeList(name, schemaDoc.fTargetNamespace, (short)finalProperty, baseValidator,
                     annotations == null? null : new XSObjectListImpl(annotations, annotations.length));
         }
         else if (union) {
             XSSimpleType[] memberDecls = (XSSimpleType[]) dTValidators.toArray(new XSSimpleType[dTValidators.size()]);
-            newDecl = schemaFactory.createTypeUnion(name, schemaDoc.fTargetNamespace, (short)finalProperty, memberDecls,
+            newDecl = fSchemaHandler.fDVFactory.createTypeUnion(name, schemaDoc.fTargetNamespace, (short)finalProperty, memberDecls,
                     annotations == null? null : new XSObjectListImpl(annotations, annotations.length));
         }
         // now traverse facets, if it's derived by restriction
@@ -400,16 +398,17 @@
             FacetInfo fi = traverseFacets(content, newDecl, baseValidator, schemaDoc);
             content = fi.nodeAfterFacets;
             
-            if (!skipFacets) {
-                try {
-                    fValidationState.setNamespaceSupport(schemaDoc.fNamespaceSupport);
-                    newDecl.applyFacets(fi.facetdata, fi.fPresentFacets, fi.fFixedFacets, fValidationState);
-                } catch (InvalidDatatypeFacetException ex) {
-                    reportSchemaError(ex.getKey(), ex.getArgs(), child);
-                }
+            try {
+                fValidationState.setNamespaceSupport(schemaDoc.fNamespaceSupport);
+                newDecl.applyFacets(fi.facetdata, fi.fPresentFacets, fi.fFixedFacets, fValidationState);
+            } catch (InvalidDatatypeFacetException ex) {
+                reportSchemaError(ex.getKey(), ex.getArgs(), child);
+                // Recreate the type, ignoring the facets
+                newDecl = fSchemaHandler.fDVFactory.createTypeRestriction(name, schemaDoc.fTargetNamespace, (short)finalProperty, baseValidator, 
+                        annotations == null? null : new XSObjectListImpl(annotations, annotations.length));
             }
         }
-        // now element should appear after this point
+        // no element should appear after this point
         if (content != null) {
             if (restriction) {
                 reportSchemaError("s4s-elt-must-match.1", new Object[]{SchemaSymbols.ELT_RESTRICTION, "(annotation?, (simpleType?, (minExclusive | minInclusive | maxExclusive | maxInclusive | totalDigits | fractionDigits | length | minLength | maxLength | enumeration | whiteSpace | pattern)*))", DOMUtil.getLocalName(content)}, content);
@@ -439,31 +438,37 @@
             return null;
         
         XSTypeDefinition baseType = (XSTypeDefinition)fSchemaHandler.getGlobalDecl(schemaDoc, XSDHandler.TYPEDECL_TYPE, baseTypeStr, elm);
-        if (baseType != null) {
-            // if it's a complex type, or if its restriction of anySimpleType
-            if (baseType.getTypeCategory() != XSTypeDefinition.SIMPLE_TYPE ||
-                    baseType == SchemaGrammar.fAnySimpleType &&
-                    baseRefContext == XSConstants.DERIVATION_RESTRICTION) {
-                // if the base type is anySimpleType and the current type is
-                // a S4S built-in type, return null. (not an error).
-                if (baseType == SchemaGrammar.fAnySimpleType &&
-                        checkBuiltIn(refName, schemaDoc.fTargetNamespace)) {
-                    return null;
-                }
-                reportSchemaError("cos-st-restricts.1.1", new Object[]{baseTypeStr.rawname, refName}, elm);
-                return SchemaGrammar.fAnySimpleType;
-            }
-            if ((baseType.getFinal() & baseRefContext) != 0) {
-                if (baseRefContext == XSConstants.DERIVATION_RESTRICTION) {
-                    reportSchemaError("st-props-correct.3", new Object[]{refName, baseTypeStr.rawname}, elm);
-                }
-                else if (baseRefContext == XSConstants.DERIVATION_LIST) {
-                    reportSchemaError("cos-st-restricts.2.3.1.1", new Object[]{baseTypeStr.rawname, refName}, elm);
-                }
-                else if (baseRefContext == XSConstants.DERIVATION_UNION) {
-                    reportSchemaError("cos-st-restricts.3.3.1.1", new Object[]{baseTypeStr.rawname, refName}, elm);
-                }
+        if (baseType == null) {
+            return null;
+        }
+        if (baseType.getTypeCategory() != XSTypeDefinition.SIMPLE_TYPE) {
+            reportSchemaError("cos-st-restricts.1.1", new Object[]{baseTypeStr.rawname, refName}, elm);
+            return null;
+        }
+
+        // if it's a complex type, or if its restriction of anySimpleType
+        if (baseType == SchemaGrammar.fAnySimpleType &&
+            baseRefContext == XSConstants.DERIVATION_RESTRICTION) {
+            // if the base type is anySimpleType and the current type is
+            // a S4S built-in type, return null. (not an error).
+            if (checkBuiltIn(refName, schemaDoc.fTargetNamespace)) {
+                return null;
             }
+            reportSchemaError("cos-st-restricts.1.1", new Object[]{baseTypeStr.rawname, refName}, elm);
+            return null;
+        }
+
+        if ((baseType.getFinal() & baseRefContext) != 0) {
+            if (baseRefContext == XSConstants.DERIVATION_RESTRICTION) {
+                reportSchemaError("st-props-correct.3", new Object[]{refName, baseTypeStr.rawname}, elm);
+            }
+            else if (baseRefContext == XSConstants.DERIVATION_LIST) {
+                reportSchemaError("cos-st-restricts.2.3.1.1", new Object[]{baseTypeStr.rawname, refName}, elm);
+            }
+            else if (baseRefContext == XSConstants.DERIVATION_UNION) {
+                reportSchemaError("cos-st-restricts.3.3.1.1", new Object[]{baseTypeStr.rawname, refName}, elm);
+            }
+            return null;
         }
         
         return (XSSimpleType)baseType;
@@ -509,16 +514,17 @@
     }//isListDatatype(XSSimpleTypeDecl):boolean
     
     private XSSimpleType errorType(String name, String namespace, short refType) {
+        XSSimpleType stringType = (XSSimpleType)SchemaGrammar.getS4SGrammar(fSchemaHandler.fSchemaVersion).getTypeDefinition("string");
         switch (refType) {
         case XSConstants.DERIVATION_RESTRICTION:
-            return schemaFactory.createTypeRestriction(name, namespace, (short)0,
-                    SchemaGrammar.fAnySimpleType, null);
+            return fSchemaHandler.fDVFactory.createTypeRestriction(name, namespace, (short)0,
+                    stringType, null);
         case XSConstants.DERIVATION_LIST:
-            return schemaFactory.createTypeList(name, namespace, (short)0,
-                    SchemaGrammar.fAnySimpleType, null);
+            return fSchemaHandler.fDVFactory.createTypeList(name, namespace, (short)0,
+                    stringType, null);
         case XSConstants.DERIVATION_UNION:
-            return schemaFactory.createTypeUnion(name, namespace, (short)0,
-                    new XSSimpleType[]{SchemaGrammar.fAnySimpleType}, null);
+            return fSchemaHandler.fDVFactory.createTypeUnion(name, namespace, (short)0,
+                    new XSSimpleType[]{stringType}, null);
         }
         
         return null;

Modified: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/traversers/XSDUniqueOrKeyTraverser.java
URL: http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/traversers/XSDUniqueOrKeyTraverser.java?rev=884566&r1=884565&r2=884566&view=diff
==============================================================================
--- xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/traversers/XSDUniqueOrKeyTraverser.java (original)
+++ xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/traversers/XSDUniqueOrKeyTraverser.java Thu Nov 26 14:30:01 2009
@@ -68,11 +68,30 @@
         // duplication (or if there is that restriction is involved
         // and there's identity).
 
-        // get selector and fields
-        traverseIdentityConstraint(uniqueOrKey, uElem, schemaDoc, attrValues);
+        // If errors occurred in traversing the identity constraint, then don't
+        // add it to the schema, to avoid errors when processing the instance.
+        if (traverseIdentityConstraint(uniqueOrKey, uElem, schemaDoc, attrValues)) {
+            // and stuff this in the grammar
+            if (grammar.getIDConstraintDecl(uniqueOrKey.getIdentityConstraintName()) == null) {
+                grammar.addIDConstraintDecl(element, uniqueOrKey);
+            }
 
-        // and stuff this in the grammar
-        grammar.addIDConstraintDecl(element, uniqueOrKey);
+            final String loc = fSchemaHandler.schemaDocument2SystemId(schemaDoc);
+            final IdentityConstraint idc = grammar.getIDConstraintDecl(uniqueOrKey.getIdentityConstraintName(), loc);  
+            if (idc == null) {
+                grammar.addIDConstraintDecl(element, uniqueOrKey, loc);
+            }
+
+            // handle duplicates
+            if (fSchemaHandler.fTolerateDuplicates) {
+                if (idc != null) {
+                    if (idc instanceof UniqueOrKey) {
+                        uniqueOrKey = (UniqueOrKey) uniqueOrKey;
+                    }
+                }
+                fSchemaHandler.addIDConstraintDecl(uniqueOrKey);
+            }
+        }
 
         // and fix up attributeChecker
         fAttrChecker.returnAttrArray(attrValues, schemaDoc);

Added: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/util/ObjectListImpl.java
URL: http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/util/ObjectListImpl.java?rev=884566&view=auto
==============================================================================
--- xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/util/ObjectListImpl.java (added)
+++ xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/util/ObjectListImpl.java Thu Nov 26 14:30:01 2009
@@ -0,0 +1,115 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.xerces.impl.xs.util;
+
+import java.lang.reflect.Array;
+import java.util.AbstractList;
+
+import org.apache.xerces.xs.datatypes.ObjectList;
+
+/**
+ * Contains a list of Objects.
+ *
+ * @xerces.internal
+ *
+ * @version $Id$
+ */
+public final class ObjectListImpl extends AbstractList implements ObjectList {
+
+    /**
+     * An immutable empty list.
+     */
+    public static final ObjectListImpl EMPTY_LIST = new ObjectListImpl(new Object[0], 0);
+    
+    // The array to hold all data
+    private final Object[] fArray;
+    
+    // Number of elements in this list
+    private final int fLength;
+
+    public ObjectListImpl(Object[] array, int length) {
+        fArray = array;
+        fLength = length;
+    }
+
+    public int getLength() {
+        return fLength;
+    }
+    
+    public boolean contains(Object item) {
+        if (item == null) {
+            for (int i = 0; i < fLength; i++) {
+                if (fArray[i] == null)
+                    return true;
+            }
+        }
+        else {
+            for (int i = 0; i < fLength; i++) {
+                if (item.equals(fArray[i]))
+                    return true;
+            }
+        }
+        return false;
+    }
+    
+    public Object item(int index) {
+        if (index < 0 || index >= fLength) {
+            return null;
+        }
+        return fArray[index];
+    }
+    
+    /*
+     * List methods
+     */
+    public Object get(int index) {
+        if (index >= 0 && index < fLength) {
+            return fArray[index];
+        }
+        throw new IndexOutOfBoundsException("Index: " + index);
+    }
+
+    public int size() {
+        return getLength();
+    }
+    
+    public Object[] toArray() {
+        Object[] a = new Object[fLength];
+        toArray0(a);
+        return a;
+    }
+    
+    public Object[] toArray(Object[] a) {
+        if (a.length < fLength) {
+            Class arrayClass = a.getClass();
+            Class componentType = arrayClass.getComponentType();
+            a = (Object[]) Array.newInstance(componentType, fLength);
+        }
+        toArray0(a);
+        if (a.length > fLength) {
+            a[fLength] = null;
+        }
+        return a;
+    }
+
+    private void toArray0(Object[] a) {
+        if (fLength > 0) {
+            System.arraycopy(fArray, 0, a, 0, fLength);
+        }
+    }
+}

Propchange: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/util/ObjectListImpl.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/util/ObjectListImpl.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Added: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/util/XSInputSource.java
URL: http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/util/XSInputSource.java?rev=884566&view=auto
==============================================================================
--- xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/util/XSInputSource.java (added)
+++ xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/util/XSInputSource.java Thu Nov 26 14:30:01 2009
@@ -0,0 +1,61 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.xerces.impl.xs.util;
+
+import org.apache.xerces.impl.xs.SchemaGrammar;
+import org.apache.xerces.xni.parser.XMLInputSource;
+import org.apache.xerces.xs.XSObject;
+
+/**
+ * @xerces.internal
+ *
+ * @version $Id$
+ */
+public final class XSInputSource extends XMLInputSource {
+    
+    private SchemaGrammar[] fGrammars;
+    private XSObject[] fComponents;
+    
+    public XSInputSource(SchemaGrammar[] grammars) {
+        super(null, null, null);
+        fGrammars = grammars;
+        fComponents = null;
+    }
+
+    public XSInputSource(XSObject[] component) {
+        super(null, null, null);
+        fGrammars = null;
+        fComponents = component;
+    }
+
+    public SchemaGrammar[] getGrammars() {
+        return fGrammars;
+    }
+
+    public void setGrammars(SchemaGrammar[] grammars) {
+        fGrammars = grammars;
+    }
+
+    public XSObject[] getComponents() {
+        return fComponents;
+    }
+
+    public void setComponents(XSObject[] components) {
+        fComponents = components;
+    }
+}

Propchange: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/util/XSInputSource.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/util/XSInputSource.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Modified: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/parsers/DOMParserImpl.java
URL: http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/parsers/DOMParserImpl.java?rev=884566&r1=884565&r2=884566&view=diff
==============================================================================
--- xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/parsers/DOMParserImpl.java (original)
+++ xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/parsers/DOMParserImpl.java Thu Nov 26 14:30:01 2009
@@ -114,6 +114,14 @@
     protected static final String HONOUR_ALL_SCHEMALOCATIONS = 
         Constants.XERCES_FEATURE_PREFIX + Constants.HONOUR_ALL_SCHEMALOCATIONS_FEATURE;
 
+    /** Feature identifier: namespace growth */
+    protected static final String NAMESPACE_GROWTH = 
+        Constants.XERCES_FEATURE_PREFIX + Constants.NAMESPACE_GROWTH_FEATURE;
+
+    /** Feature identifier: tolerate duplicates */
+    protected static final String TOLERATE_DUPLICATES = 
+        Constants.XERCES_FEATURE_PREFIX + Constants.TOLERATE_DUPLICATES_FEATURE;
+
     // internal properties
     protected static final String SYMBOL_TABLE =
         Constants.XERCES_PROPERTY_PREFIX + Constants.SYMBOL_TABLE_PROPERTY;
@@ -451,6 +459,12 @@
                     if (name.equalsIgnoreCase(HONOUR_ALL_SCHEMALOCATIONS)) {
                         normalizedName = HONOUR_ALL_SCHEMALOCATIONS;
                     }
+                    else if (name.equals(NAMESPACE_GROWTH)) {
+                        normalizedName = NAMESPACE_GROWTH;
+                    }
+                    else if (name.equals(TOLERATE_DUPLICATES)) {
+                        normalizedName = TOLERATE_DUPLICATES;
+                    }
                     else {
                         normalizedName = name.toLowerCase(Locale.ENGLISH);
                     }
@@ -586,6 +600,12 @@
                     if (name.equalsIgnoreCase(HONOUR_ALL_SCHEMALOCATIONS)) {
                         normalizedName = HONOUR_ALL_SCHEMALOCATIONS;
                     }
+                    else if (name.equals(NAMESPACE_GROWTH)) {
+                        normalizedName = NAMESPACE_GROWTH;
+                    }
+                    else if (name.equals(TOLERATE_DUPLICATES)) {
+                        normalizedName = TOLERATE_DUPLICATES;
+                    }
                     fConfiguration.getFeature(normalizedName);
                     throw newTypeMismatchError(name);
                     
@@ -716,6 +736,12 @@
             if (name.equalsIgnoreCase(HONOUR_ALL_SCHEMALOCATIONS)) {
                 normalizedName = HONOUR_ALL_SCHEMALOCATIONS;
             }
+            else if (name.equals(NAMESPACE_GROWTH)) {
+                normalizedName = NAMESPACE_GROWTH;
+            }
+            else if (name.equals(TOLERATE_DUPLICATES)) {
+                normalizedName = TOLERATE_DUPLICATES;
+            }
             else {
                 normalizedName = name.toLowerCase(Locale.ENGLISH);
             }
@@ -778,6 +804,12 @@
                 if (name.equalsIgnoreCase(HONOUR_ALL_SCHEMALOCATIONS)) {
                     normalizedName = HONOUR_ALL_SCHEMALOCATIONS;
                 }
+                else if (name.equalsIgnoreCase(NAMESPACE_GROWTH)) {
+                    normalizedName = NAMESPACE_GROWTH;
+                }
+                else if (name.equalsIgnoreCase(TOLERATE_DUPLICATES)) {
+                    normalizedName = TOLERATE_DUPLICATES;
+                }
                 else {
                     normalizedName = name.toLowerCase(Locale.ENGLISH);
                 }

Modified: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/parsers/StandardParserConfiguration.java
URL: http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/parsers/StandardParserConfiguration.java?rev=884566&r1=884565&r2=884566&view=diff
==============================================================================
--- xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/parsers/StandardParserConfiguration.java (original)
+++ xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/parsers/StandardParserConfiguration.java Thu Nov 26 14:30:01 2009
@@ -104,6 +104,14 @@
     protected static final String HONOUR_ALL_SCHEMALOCATIONS = 
         Constants.XERCES_FEATURE_PREFIX + Constants.HONOUR_ALL_SCHEMALOCATIONS_FEATURE;
 
+    /** Feature identifier: namespace growth */
+    protected static final String NAMESPACE_GROWTH = 
+        Constants.XERCES_FEATURE_PREFIX + Constants.NAMESPACE_GROWTH_FEATURE;
+
+    /** Feature identifier: tolerate duplicates */
+    protected static final String TOLERATE_DUPLICATES = 
+        Constants.XERCES_FEATURE_PREFIX + Constants.TOLERATE_DUPLICATES_FEATURE;
+
     /** Feature identifier: whether to ignore xsi:type attributes until a global element declaration is encountered */
     protected static final String IGNORE_XSI_TYPE =
         Constants.XERCES_FEATURE_PREFIX + Constants.IGNORE_XSI_TYPE_FEATURE;
@@ -146,6 +154,10 @@
     protected static final String ROOT_ELEMENT_DECL =
         Constants.XERCES_PROPERTY_PREFIX + Constants.ROOT_ELEMENT_DECLARATION_PROPERTY;
 
+    /** Property identifier: Schema DV Factory */
+    protected static final String SCHEMA_DV_FACTORY = 
+        Constants.XERCES_PROPERTY_PREFIX + Constants.SCHEMA_DV_FACTORY_PROPERTY;
+    
     //
     // Data
     //
@@ -214,6 +226,8 @@
             GENERATE_SYNTHETIC_ANNOTATIONS,
             VALIDATE_ANNOTATIONS,
             HONOUR_ALL_SCHEMALOCATIONS,
+            NAMESPACE_GROWTH,
+            TOLERATE_DUPLICATES,
             // NOTE: These shouldn't really be here but since the XML Schema
             //       validator is constructed dynamically, its recognized
             //       features might not have been set and it would cause a
@@ -235,7 +249,9 @@
         setFeature(GENERATE_SYNTHETIC_ANNOTATIONS, false);
         setFeature(VALIDATE_ANNOTATIONS, false);
         setFeature(HONOUR_ALL_SCHEMALOCATIONS, false);
-        
+        setFeature(NAMESPACE_GROWTH, false);
+        setFeature(TOLERATE_DUPLICATES, false);
+
         setFeature(IGNORE_XSI_TYPE, false);
         setFeature(ID_IDREF_CHECKING, true);
         setFeature(IDENTITY_CONSTRAINT_CHECKING, true);
@@ -253,6 +269,7 @@
             SCHEMA_NONS_LOCATION,
             ROOT_TYPE_DEF,
             ROOT_ELEMENT_DECL,
+            SCHEMA_DV_FACTORY,
         };
         
         addRecognizedProperties(recognizedProperties);

Modified: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/parsers/XML11Configuration.java
URL: http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/parsers/XML11Configuration.java?rev=884566&r1=884565&r2=884566&view=diff
==============================================================================
--- xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/parsers/XML11Configuration.java (original)
+++ xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/parsers/XML11Configuration.java Thu Nov 26 14:30:01 2009
@@ -145,11 +145,19 @@
     /** Feature identifier: honour all schemaLocations */
     protected static final String HONOUR_ALL_SCHEMALOCATIONS = 
         Constants.XERCES_FEATURE_PREFIX + Constants.HONOUR_ALL_SCHEMALOCATIONS_FEATURE;
+
+    /** Feature identifier: namespace growth */
+    protected static final String NAMESPACE_GROWTH = 
+        Constants.XERCES_FEATURE_PREFIX + Constants.NAMESPACE_GROWTH_FEATURE;
+
+    /** Feature identifier: tolerate duplicates */
+    protected static final String TOLERATE_DUPLICATES = 
+        Constants.XERCES_FEATURE_PREFIX + Constants.TOLERATE_DUPLICATES_FEATURE;
     
     /** Feature identifier: use grammar pool only */
     protected static final String USE_GRAMMAR_POOL_ONLY =
         Constants.XERCES_FEATURE_PREFIX + Constants.USE_GRAMMAR_POOL_ONLY_FEATURE;
-        
+
 	// feature identifiers
 
 	/** Feature identifier: validation. */
@@ -282,6 +290,10 @@
     protected static final String ROOT_ELEMENT_DECL =
         Constants.XERCES_PROPERTY_PREFIX + Constants.ROOT_ELEMENT_DECLARATION_PROPERTY;
 
+    /** Property identifier: Schema DV Factory */
+    protected static final String SCHEMA_DV_FACTORY = 
+        Constants.XERCES_PROPERTY_PREFIX + Constants.SCHEMA_DV_FACTORY_PROPERTY;
+    
     // debugging
 
     /** Set to true and recompile to print exception stack trace. */
@@ -482,7 +494,8 @@
 		        NAMESPACES,
 		        NORMALIZE_DATA, SCHEMA_ELEMENT_DEFAULT, SCHEMA_AUGMENT_PSVI,
 		        GENERATE_SYNTHETIC_ANNOTATIONS, VALIDATE_ANNOTATIONS,
-		        HONOUR_ALL_SCHEMALOCATIONS, IGNORE_XSI_TYPE,
+		        HONOUR_ALL_SCHEMALOCATIONS, NAMESPACE_GROWTH,
+		        TOLERATE_DUPLICATES, IGNORE_XSI_TYPE,
 		        ID_IDREF_CHECKING, IDENTITY_CONSTRAINT_CHECKING,
 		        UNPARSED_ENTITY_CHECKING, USE_GRAMMAR_POOL_ONLY,
 		        TYPE_ALTERNATIVES_CHECKING,
@@ -510,6 +523,8 @@
         fFeatures.put(GENERATE_SYNTHETIC_ANNOTATIONS, Boolean.FALSE);
         fFeatures.put(VALIDATE_ANNOTATIONS, Boolean.FALSE);
         fFeatures.put(HONOUR_ALL_SCHEMALOCATIONS, Boolean.FALSE);
+        fFeatures.put(NAMESPACE_GROWTH, Boolean.FALSE);
+        fFeatures.put(TOLERATE_DUPLICATES, Boolean.FALSE);
         fFeatures.put(IGNORE_XSI_TYPE, Boolean.FALSE);
         fFeatures.put(ID_IDREF_CHECKING, Boolean.TRUE);
         fFeatures.put(IDENTITY_CONSTRAINT_CHECKING, Boolean.TRUE);
@@ -546,6 +561,7 @@
                 LOCALE,
                 ROOT_TYPE_DEF,
                 ROOT_ELEMENT_DECL,
+                SCHEMA_DV_FACTORY,
         };
         addRecognizedProperties(recognizedProperties);
 		



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