<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
<title>commits@xerces.apache.org Archives</title>
<link rel="self" href="http://mail-archives.apache.org/mod_mbox/xerces-commits/?format=atom"/>
<link href="http://mail-archives.apache.org/mod_mbox/xerces-commits/"/>
<id>http://mail-archives.apache.org/mod_mbox/xerces-commits/</id>
<updated>2009-12-10T07:31:57Z</updated>
<entry>
<title>svn commit: r888924 - in /xerces/java/branches/xml-schema-1.1-dev/tools: xml-apis.jar xml-commons-external-src.zip</title>
<author><name>mrglavas@apache.org</name></author>
<link rel="alternate" href="http://mail-archives.apache.org/mod_mbox/xerces-commits/200912.mbox/%3c20091209190130.5EEC62388998@eris.apache.org%3e"/>
<id>urn:uuid:%3c20091209190130-5EEC62388998@eris-apache-org%3e</id>
<updated>2009-12-09T19:01:30Z</updated>
<content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml">
<pre>
Author: mrglavas
Date: Wed Dec  9 19:01:29 2009
New Revision: 888924

URL: http://svn.apache.org/viewvc?rev=888924&amp;view=rev
Log:
Updating to the release candidate level of xml-commons-external-1.4.01.

Modified:
    xerces/java/branches/xml-schema-1.1-dev/tools/xml-apis.jar
    xerces/java/branches/xml-schema-1.1-dev/tools/xml-commons-external-src.zip

Modified: xerces/java/branches/xml-schema-1.1-dev/tools/xml-apis.jar
URL: http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/tools/xml-apis.jar?rev=888924&amp;r1=888923&amp;r2=888924&amp;view=diff
==============================================================================
Binary files - no diff available.

Modified: xerces/java/branches/xml-schema-1.1-dev/tools/xml-commons-external-src.zip
URL: http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/tools/xml-commons-external-src.zip?rev=888924&amp;r1=888923&amp;r2=888924&amp;view=diff
==============================================================================
Binary files - no diff available.



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



</pre>
</div>
</content>
</entry>
<entry>
<title>svn commit: r888921 - in /xerces/java/trunk/tools: xml-apis.jar xml-commons-external-src.zip</title>
<author><name>mrglavas@apache.org</name></author>
<link rel="alternate" href="http://mail-archives.apache.org/mod_mbox/xerces-commits/200912.mbox/%3c20091209185228.8F47023888EC@eris.apache.org%3e"/>
<id>urn:uuid:%3c20091209185228-8F47023888EC@eris-apache-org%3e</id>
<updated>2009-12-09T18:52:28Z</updated>
<content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml">
<pre>
Author: mrglavas
Date: Wed Dec  9 18:52:27 2009
New Revision: 888921

URL: http://svn.apache.org/viewvc?rev=888921&amp;view=rev
Log:
Updating to the release candidate level of xml-commons-external-1.4.01.

Modified:
    xerces/java/trunk/tools/xml-apis.jar
    xerces/java/trunk/tools/xml-commons-external-src.zip

Modified: xerces/java/trunk/tools/xml-apis.jar
URL: http://svn.apache.org/viewvc/xerces/java/trunk/tools/xml-apis.jar?rev=888921&amp;r1=888920&amp;r2=888921&amp;view=diff
==============================================================================
Binary files - no diff available.

Modified: xerces/java/trunk/tools/xml-commons-external-src.zip
URL: http://svn.apache.org/viewvc/xerces/java/trunk/tools/xml-commons-external-src.zip?rev=888921&amp;r1=888920&amp;r2=888921&amp;view=diff
==============================================================================
Binary files - no diff available.



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



</pre>
</div>
</content>
</entry>
<entry>
<title>svn commit: r888552 - in /xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces: impl/dv/xs/ impl/xs/ impl/xs/traversers/ xs/</title>
<author><name>knoaman@apache.org</name></author>
<link rel="alternate" href="http://mail-archives.apache.org/mod_mbox/xerces-commits/200912.mbox/%3c20091208200130.ECD29238889D@eris.apache.org%3e"/>
<id>urn:uuid:%3c20091208200130-ECD29238889D@eris-apache-org%3e</id>
<updated>2009-12-08T20:01:30Z</updated>
<content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml">
<pre>
Author: knoaman
Date: Tue Dec  8 20:01:29 2009
New Revision: 888552

URL: http://svn.apache.org/viewvc?rev=888552&amp;view=rev
Log:
Store {context} property in type definitions

Modified:
    xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/XSSimpleTypeDecl.java
    xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/XSSimpleTypeDelegate.java
    xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/XSComplexTypeDecl.java
    xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/traversers/XSDAttributeTraverser.java
    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/XSDElementTraverser.java
    xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/traversers/XSDSimpleTypeTraverser.java
    xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/traversers/XSDTypeAlternativeTraverser.java
    xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/xs/XSTypeDefinition.java

Modified: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/XSSimpleTypeDecl.java
URL: http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/XSSimpleTypeDecl.java?rev=888552&amp;r1=888551&amp;r2=888552&amp;view=diff
==============================================================================
--- xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/XSSimpleTypeDecl.java
(original)
+++ xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/XSSimpleTypeDecl.java
Tue Dec  8 20:01:29 2009
@@ -44,6 +44,7 @@
 import org.apache.xerces.xs.XSFacet;
 import org.apache.xerces.xs.XSMultiValueFacet;
 import org.apache.xerces.xs.XSNamespaceItem;
+import org.apache.xerces.xs.XSObject;
 import org.apache.xerces.xs.XSObjectList;
 import org.apache.xerces.xs.XSSimpleTypeDefinition;
 import org.apache.xerces.xs.XSTypeDefinition;
@@ -333,6 +334,9 @@
     // The namespace schema information item corresponding to the target namespace 
     // of the simple type definition, if it is globally declared; or null otherwise.
     private XSNamespaceItem fNamespaceItem = null;
+    
+    // context
+    XSObject fContext = null;
 
     // default constructor
     public XSSimpleTypeDecl(){}
@@ -3124,6 +3128,8 @@
         fAnnotations = null;
         fFacets = null;
 
+        fContext = null;
+
         // REVISIT: reset for fundamental facets
     }
     
@@ -3137,6 +3143,17 @@
     public void setNamespaceItem(XSNamespaceItem namespaceItem) {
         fNamespaceItem = namespaceItem;
     }
+    
+    /**
+     * 
+     */
+    public void setContext(XSObject context) {
+        fContext = context;
+    }
+    
+    public XSObject getContext() {
+        return fContext;
+    }
 
     /**
      * @see java.lang.Object#toString()

Modified: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/XSSimpleTypeDelegate.java
URL: http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/XSSimpleTypeDelegate.java?rev=888552&amp;r1=888551&amp;r2=888552&amp;view=diff
==============================================================================
--- xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/XSSimpleTypeDelegate.java
(original)
+++ xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/XSSimpleTypeDelegate.java
Tue Dec  8 20:01:29 2009
@@ -26,6 +26,7 @@
 import org.apache.xerces.impl.dv.XSSimpleType;
 import org.apache.xerces.xs.StringList;
 import org.apache.xerces.xs.XSNamespaceItem;
+import org.apache.xerces.xs.XSObject;
 import org.apache.xerces.xs.XSObjectList;
 import org.apache.xerces.xs.XSSimpleTypeDefinition;
 import org.apache.xerces.xs.XSTypeDefinition;
@@ -205,6 +206,10 @@
         return type.validate(content, context, validatedInfo);
     }
     
+    public XSObject getContext() {
+        return type.getContext();
+    }
+    
     public String toString() {
         return type.toString();
     }

Modified: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/XSComplexTypeDecl.java
URL: http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/XSComplexTypeDecl.java?rev=888552&amp;r1=888551&amp;r2=888552&amp;view=diff
==============================================================================
--- xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/XSComplexTypeDecl.java
(original)
+++ xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/XSComplexTypeDecl.java
Tue Dec  8 20:01:29 2009
@@ -26,6 +26,7 @@
 import org.apache.xerces.xs.XSComplexTypeDefinition;
 import org.apache.xerces.xs.XSConstants;
 import org.apache.xerces.xs.XSNamespaceItem;
+import org.apache.xerces.xs.XSObject;
 import org.apache.xerces.xs.XSObjectList;
 import org.apache.xerces.xs.XSOpenContent;
 import org.apache.xerces.xs.XSParticle;
@@ -98,6 +99,9 @@
     
     // list of assertions affiliated with this type
     XSObjectListImpl fAssertions = null;
+    
+    // context
+    XSObject fContext = null;
 
     // DOM Level 3 TypeInfo Derivation Method constants
     static final int DERIVATION_ANY = 0;
@@ -577,6 +581,7 @@
             fAssertions.clear();
         }
         fAssertions = null;
+        fContext = null;
     }
 
     /**
@@ -760,4 +765,12 @@
         return (fAssertions != null) ? fAssertions : XSObjectListImpl.EMPTY_LIST;
     }
 
+    public void setContext(XSObject context) {
+        fContext = context;
+    }
+
+    public XSObject getContext() {
+        return fContext;
+    }
+
 } // class XSComplexTypeDecl

Modified: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/traversers/XSDAttributeTraverser.java
URL: http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/traversers/XSDAttributeTraverser.java?rev=888552&amp;r1=888551&amp;r2=888552&amp;view=diff
==============================================================================
--- xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/traversers/XSDAttributeTraverser.java
(original)
+++ xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/traversers/XSDAttributeTraverser.java
Tue Dec  8 20:01:29 2009
@@ -331,7 +331,7 @@
             String childName = DOMUtil.getLocalName(child);
             
             if (childName.equals(SchemaSymbols.ELT_SIMPLETYPE)) {
-                attrType = fSchemaHandler.fSimpleTypeTraverser.traverseLocal(child, schemaDoc,
grammar);
+                attrType = fSchemaHandler.fSimpleTypeTraverser.traverseLocal(child, schemaDoc,
grammar, attribute);
                 haveAnonType = true;
                 child = DOMUtil.getNextSiblingElement(child);
             }

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=888552&amp;r1=888551&amp;r2=888552&amp;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
Tue Dec  8 20:01:29 2009
@@ -42,6 +42,7 @@
 import org.apache.xerces.xs.XSAttributeUse;
 import org.apache.xerces.xs.XSComplexTypeDefinition;
 import org.apache.xerces.xs.XSConstants;
+import org.apache.xerces.xs.XSObject;
 import org.apache.xerces.xs.XSObjectList;
 import org.apache.xerces.xs.XSTypeDefinition;
 import org.w3c.dom.Element;
@@ -158,7 +159,8 @@
      */
     XSComplexTypeDecl traverseLocal(Element complexTypeNode,
             XSDocumentInfo schemaDoc,
-            SchemaGrammar grammar) {
+            SchemaGrammar grammar,
+            XSObject context) {
         
         
         Object[] attrValues = fAttrChecker.checkAttributes(complexTypeNode, false,
@@ -166,7 +168,7 @@
         String complexTypeName = genAnonTypeName(complexTypeNode);
         contentBackup();
         XSComplexTypeDecl type = traverseComplexTypeDecl (complexTypeNode,
-                complexTypeName, attrValues, schemaDoc, grammar);
+                complexTypeName, attrValues, schemaDoc, grammar, context);
         contentRestore();
         // need to add the type to the grammar for later constraint checking
         grammar.addComplexTypeDecl(type, fSchemaHandler.element2Locator(complexTypeNode));
@@ -193,7 +195,7 @@
         String complexTypeName = (String)  attrValues[XSAttributeChecker.ATTIDX_NAME];
         contentBackup();
         XSComplexTypeDecl type = traverseComplexTypeDecl (complexTypeNode,
-                complexTypeName, attrValues, schemaDoc, grammar);
+                complexTypeName, attrValues, schemaDoc, grammar, null);
         contentRestore();
         // need to add the type to the grammar for later constraint checking
         grammar.addComplexTypeDecl(type, fSchemaHandler.element2Locator(complexTypeNode));
@@ -202,6 +204,17 @@
             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);
+                }
+            }
+            
             if (grammar.getGlobalTypeDecl(type.getName()) == null) {
                 grammar.addGlobalComplexTypeDecl(type);
             }
@@ -308,7 +321,8 @@
             String complexTypeName,
             Object[] attrValues,
             XSDocumentInfo schemaDoc,
-            SchemaGrammar grammar) {
+            SchemaGrammar grammar,
+            XSObject context) {
         
         fComplexTypeDecl = new XSComplexTypeDecl();
         fAttrGrp = new XSAttributeGroupDecl();
@@ -461,6 +475,13 @@
                 fDerivedBy, fFinal, fBlock, fContentType, fIsAbstract,
                 fAttrGrp, fXSSimpleType, fParticle, new XSObjectListImpl(fAnnotations, 
                         fAnnotations == null? 0 : fAnnotations.length), fOpenContent);
+
+        // XML Schema 1.1
+        // Store context information
+        if (fSchemaHandler.fSchemaVersion == Constants.SCHEMA_VERSION_1_1) {
+            fComplexTypeDecl.setContext(context);
+        }
+
         fComplexTypeDecl.setAssertions(fAssertions != null 
                 ? new XSObjectListImpl(fAssertions, fAssertions.length) : null);
         return fComplexTypeDecl;
@@ -656,11 +677,12 @@
             // There may be a simple type definition in the restriction element
             // The data type validator will be based on it, if specified
             // -----------------------------------------------------------------------
+            boolean needToSetContext = false;
             if (simpleContent !=null &amp;&amp;
                     DOMUtil.getLocalName(simpleContent).equals(SchemaSymbols.ELT_SIMPLETYPE
)) {
                 
                 XSSimpleType dv = fSchemaHandler.fSimpleTypeTraverser.traverseLocal(
-                        simpleContent, schemaDoc, grammar);
+                        simpleContent, schemaDoc, grammar, null);
                 if (dv == null) {
                     fAttrChecker.returnAttrArray(simpleContentAttrValues, schemaDoc);
                     fAttrChecker.returnAttrArray(derivationTypeAttrValues, schemaDoc);
@@ -678,6 +700,12 @@
                             new Object[]{fName, dv.getName(), baseValidator.getName()},
                             simpleContent);
                 }
+                // XML Schema 1.1 - need to set context of dv
+                if (fSchemaHandler.fSchemaVersion == Constants.SCHEMA_VERSION_1_1) {
+                   if (dv instanceof XSSimpleTypeDecl) {
+                       needToSetContext = true;
+                   }
+                }
                 baseValidator = dv;
                 simpleContent = DOMUtil.getNextSiblingElement(simpleContent);
             }
@@ -721,6 +749,11 @@
                 ((XSSimpleTypeDecl)fXSSimpleType).setAnonymous(true);
             }
             
+            // set context of local simple type (baseValidator)
+            if (needToSetContext) {
+                ((XSSimpleTypeDecl)baseValidator).setContext(fXSSimpleType);
+            }
+            
             // -----------------------------------------------------------------------
             // Traverse any attributes/asserts
             // -----------------------------------------------------------------------

Modified: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/traversers/XSDElementTraverser.java
URL: http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/traversers/XSDElementTraverser.java?rev=888552&amp;r1=888551&amp;r2=888552&amp;view=diff
==============================================================================
--- xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/traversers/XSDElementTraverser.java
(original)
+++ xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/traversers/XSDElementTraverser.java
Tue Dec  8 20:01:29 2009
@@ -384,12 +384,12 @@
             String childName = DOMUtil.getLocalName(child);
             
             if (childName.equals(SchemaSymbols.ELT_COMPLEXTYPE)) {
-                elementType = fSchemaHandler.fComplexTypeTraverser.traverseLocal(child, schemaDoc,
grammar);
+                elementType = fSchemaHandler.fComplexTypeTraverser.traverseLocal(child, schemaDoc,
grammar, element);
                 haveAnonType = true;
                 child = DOMUtil.getNextSiblingElement(child);
             }
             else if (childName.equals(SchemaSymbols.ELT_SIMPLETYPE)) {
-                elementType = fSchemaHandler.fSimpleTypeTraverser.traverseLocal(child, schemaDoc,
grammar);
+                elementType = fSchemaHandler.fSimpleTypeTraverser.traverseLocal(child, schemaDoc,
grammar, element);
                 haveAnonType = true;
                 child = DOMUtil.getNextSiblingElement(child);
             }

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=888552&amp;r1=888551&amp;r2=888552&amp;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
Tue Dec  8 20:01:29 2009
@@ -32,6 +32,7 @@
 import org.apache.xerces.util.DOMUtil;
 import org.apache.xerces.xni.QName;
 import org.apache.xerces.xs.XSConstants;
+import org.apache.xerces.xs.XSObject;
 import org.apache.xerces.xs.XSObjectList;
 import org.apache.xerces.xs.XSTypeDefinition;
 import org.w3c.dom.Element;
@@ -108,6 +109,20 @@
         
         // 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)) {
+                    final XSTypeDefinition baseType = type.getBaseType();
+                    if (baseType instanceof XSSimpleTypeDecl) {
+                        ((XSSimpleTypeDecl)baseType).setContext(type);
+                    }
+                }
+            }
+            
             if (grammar.getGlobalTypeDecl(type.getName()) == null) {
                 grammar.addGlobalSimpleTypeDecl(type);
             }
@@ -135,14 +150,18 @@
     
     XSSimpleType traverseLocal(Element elmNode,
             XSDocumentInfo schemaDoc,
-            SchemaGrammar grammar) {
+            SchemaGrammar grammar,
+            XSObject context) {
         
         // General Attribute Checking
         Object[] attrValues = fAttrChecker.checkAttributes(elmNode, false, schemaDoc);
         String name = genAnonTypeName(elmNode);
-        XSSimpleType type = getSimpleType (name, elmNode, attrValues, schemaDoc, grammar);
+        XSSimpleType type = getSimpleType(name, elmNode, attrValues, schemaDoc, grammar);
         if (type instanceof XSSimpleTypeDecl) {
             ((XSSimpleTypeDecl)type).setAnonymous(true);
+            if (context != null &amp;&amp; fSchemaHandler.fSchemaVersion == Constants.SCHEMA_VERSION_1_1)
{
+                ((XSSimpleTypeDecl)type).setContext(context);
+            }
         }
         fAttrChecker.returnAttrArray(attrValues, schemaDoc);
         
@@ -310,6 +329,11 @@
             }
         }
 
+        // XML Schema 1.1
+        //
+        // Store local simple types, so we can set the proper context on them
+        ArrayList localValidators = new ArrayList(2);
+
         // check if there is a child "simpleType"
         if (content != null &amp;&amp; DOMUtil.getLocalName(content).equals(SchemaSymbols.ELT_SIMPLETYPE))
{
             if (restriction || list) {
@@ -319,7 +343,12 @@
                 }
                 if (baseValidator == null) {
                     // traverse this child to get the base type
-                    baseValidator = traverseLocal(content, schemaDoc, grammar);
+                    baseValidator = traverseLocal(content, schemaDoc, grammar, null);
+                    if (fSchemaHandler.fSchemaVersion == Constants.SCHEMA_VERSION_1_1 &amp;&amp;
+                            baseValidator instanceof XSSimpleTypeDecl) {
+                        localValidators.add(baseValidator);
+                    }
+                    
                 }
                 // get the next element
                 content = DOMUtil.getNextSiblingElement(content);
@@ -330,18 +359,25 @@
                 }
                 do {
                     // traverse this child to get the member type
-                    dv = traverseLocal(content, schemaDoc, grammar);
+                    dv = traverseLocal(content, schemaDoc, grammar,null);
                     if (dv != null) {
                         // if it's a union, expand it (only in XML 1.0)
-                        if (dv.getVariety() == XSSimpleType.VARIETY_UNION &amp;&amp;
-                                fSchemaHandler.fSchemaVersion &lt; Constants.SCHEMA_VERSION_1_1)
{
-                            dvs = dv.getMemberTypes();
-                            for (int j = 0; j &lt; dvs.getLength(); j++) {
-                                dTValidators.add(dvs.item(j));
+                        if (fSchemaHandler.fSchemaVersion == Constants.SCHEMA_VERSION_1_1)
{
+                            dTValidators.add(dv);
+                            if (dv instanceof XSSimpleTypeDecl) {
+                                localValidators.add(dv);
                             }
-                        } 
+                        }
                         else {
-                            dTValidators.add(dv);
+                            if (dv.getVariety() == XSSimpleType.VARIETY_UNION) {
+                                dvs = dv.getMemberTypes();
+                                for (int j = 0; j &lt; dvs.getLength(); j++) {
+                                    dTValidators.add(dvs.item(j));
+                                }
+                            }
+                            else {
+                                dTValidators.add(dv);
+                            }
                         }
                     }
                     // get the next element
@@ -408,6 +444,14 @@
                         annotations == null? null : new XSObjectListImpl(annotations, annotations.length));
             }
         }
+        
+        // XML Schema 1.1
+        // Set context information
+        final int localValidatorsSize = localValidators.size();
+        for (int i=0; i&lt;localValidatorsSize; i++) {
+            ((XSSimpleTypeDecl)localValidators.get(i)).setContext(newDecl);
+        }
+        
         // no element should appear after this point
         if (content != null) {
             if (restriction) {

Modified: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/traversers/XSDTypeAlternativeTraverser.java
URL: http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/traversers/XSDTypeAlternativeTraverser.java?rev=888552&amp;r1=888551&amp;r2=888552&amp;view=diff
==============================================================================
--- xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/traversers/XSDTypeAlternativeTraverser.java
(original)
+++ xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/traversers/XSDTypeAlternativeTraverser.java
Tue Dec  8 20:01:29 2009
@@ -116,12 +116,12 @@
             String childName = DOMUtil.getLocalName(childNode);
             XSTypeDefinition typeDef = null;
             if (childName.equals(SchemaSymbols.ELT_COMPLEXTYPE)) {
-                typeDef = fSchemaHandler.fComplexTypeTraverser.traverseLocal(childNode, schemaDoc,
grammar);
+                typeDef = fSchemaHandler.fComplexTypeTraverser.traverseLocal(childNode, schemaDoc,
grammar, element);
                 hasAnonType = true;
                 childNode = DOMUtil.getNextSiblingElement(childNode);
             }
             else if (childName.equals(SchemaSymbols.ELT_SIMPLETYPE)) {
-                typeDef = fSchemaHandler.fSimpleTypeTraverser.traverseLocal(childNode, schemaDoc,
grammar);
+                typeDef = fSchemaHandler.fSimpleTypeTraverser.traverseLocal(childNode, schemaDoc,
grammar, element);
                 hasAnonType = true;
                 childNode = DOMUtil.getNextSiblingElement(childNode);
             }

Modified: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/xs/XSTypeDefinition.java
URL: http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/xs/XSTypeDefinition.java?rev=888552&amp;r1=888551&amp;r2=888552&amp;view=diff
==============================================================================
--- xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/xs/XSTypeDefinition.java
(original)
+++ xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/xs/XSTypeDefinition.java
Tue Dec  8 20:01:29 2009
@@ -98,5 +98,39 @@
     public boolean derivedFrom(String namespace, 
                                String name, 
                                short derivationMethod);
-
+    
+    /**
+     * A property that simplifies testing for the identity of anonymous type
+     * definitions.
+     * 
+     * For complex type definition:
+     * 1. If the name [attribute] is present (with the exception of the type being
+     *    redefined, number 2 below), then absent, otherwise the Element
+     *    Declaration corresponding to that parent information item
+     * 2. In the case of redefine, the context of the redefined complex type is the
+     *    redefining complex type definition
+     * 
+     * For simple type definition,
+     * 1. If the name [attribute] is present (with the exception of the type being
+     *    redefined, number 3 below), then absent
+     * 2. otherwise the appropriate case among the following:
+     *    2.1 If the parent element information item is attribute, then the
+     *        corresponding Attribute Declaration
+     *    2.2 If the parent element information item is element, then the
+     *        corresponding Element Declaration
+     *    2.3 If the parent element information item is list or union, then
+     *        the Simple Type Definition corresponding to the grandparent simpleType
+     *        element information item
+     *    2.4 otherwise (the parent element information item is restriction), the
+     *        appropriate case among the following:
+     *        2.4.1 If the grandparent element information item is simpleType, then
+     *              the Simple Type Definition corresponding to the grandparent
+     *        2.4.2 otherwise (the grandparent element information item is simpleContent),
+     *              the Simple Type Definition which is the {content type} of the Complex
+     *              Type Definition corresponding to the great-grandparent complexType
+     *              element information item.
+     * 3. In the case of redefine, the context of the redefined simple type is the
+     *    redefining simple type definition
+     */
+    public XSObject getContext();
 }



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



</pre>
</div>
</content>
</entry>
<entry>
<title>svn commit: r887671 - in /xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces: impl/xs/XMLAssertPsychopathImpl.java impl/xs/assertion/XSAssertImpl.java impl/xs/traversers/XSDAbstractTraverser.java xs/XSConstants.java</title>
<author><name>mukulg@apache.org</name></author>
<link rel="alternate" href="http://mail-archives.apache.org/mod_mbox/xerces-commits/200912.mbox/%3c20091206115018.C0E6723888DD@eris.apache.org%3e"/>
<id>urn:uuid:%3c20091206115018-C0E6723888DD@eris-apache-org%3e</id>
<updated>2009-12-06T11:50:17Z</updated>
<content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml">
<pre>
Author: mukulg
Date: Sun Dec  6 11:50:17 2009
New Revision: 887671

URL: http://svn.apache.org/viewvc?rev=887671&amp;view=rev
Log:
minor improvements to assertion implementation (xs:assertion can never access the xpath2 context).

Modified:
    xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/XMLAssertPsychopathImpl.java
    xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/assertion/XSAssertImpl.java
    xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/traversers/XSDAbstractTraverser.java
    xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/xs/XSConstants.java

Modified: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/XMLAssertPsychopathImpl.java
URL: http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/XMLAssertPsychopathImpl.java?rev=887671&amp;r1=887670&amp;r2=887671&amp;view=diff
==============================================================================
--- xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/XMLAssertPsychopathImpl.java
(original)
+++ xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/XMLAssertPsychopathImpl.java
Sun Dec  6 11:50:17 2009
@@ -33,6 +33,7 @@
 import org.apache.xerces.xni.XMLString;
 import org.apache.xerces.xni.parser.XMLAssertAdapter;
 import org.apache.xerces.xs.ElementPSVI;
+import org.apache.xerces.xs.XSConstants;
 import org.apache.xerces.xs.XSModel;
 import org.apache.xerces.xs.XSObjectList;
 import org.apache.xerces.xs.XSTypeDefinition;
@@ -220,11 +221,16 @@
             }
             XSObjectList assertList = (XSObjectList) assertions;
             for (int i = 0; i &lt; assertList.size(); i++) {
-               XSAssertImpl assertImpl = (XSAssertImpl) assertList.get(i);
+               XSAssertImpl assertImpl = (XSAssertImpl) assertList.get(i);              

+               boolean xpathContextExists = false;
+               if (assertImpl.getType() == XSConstants.ASSERTION) {
+                  // not an assertion facet
+                  xpathContextExists = true;   
+               }               
                evaluateAssertion(element,
                                  assertImpl,
                                  value,
-                                 xPathContextExistsForComplexType());
+                                 xpathContextExists);
             }
         } else if (assertions instanceof Vector) {
             // assertions from a simple type definition
@@ -238,37 +244,6 @@
     }
 
     /*
-     * Determine, if XPath context should exist, for assertions on
-     * complex types.
-     * an XPath context should exist, if complex type has following
-     * content model:
-     * complexType -&gt; simpleContent -&gt; extension
-     * OR
-     * complexType -&gt; mixed content type
-     *                (i.e, &lt;xs:complexType ... mixed="true")
-     */
-    private boolean xPathContextExistsForComplexType() {
-        boolean contextExistsForComplexType = false;
-        
-        PSVIElementNSImpl psviElemCurrent = (PSVIElementNSImpl)
-                                                 currentAssertDomNode;         
-        if (psviElemCurrent.getTypeDefinition().getTypeCategory() == 
-                                         XSTypeDefinition.COMPLEX_TYPE) {
-             XSComplexTypeDecl compTypeDecl = (XSComplexTypeDecl)
-                                           psviElemCurrent.getTypeDefinition();         
                             
-             if (compTypeDecl.isDerivedFrom(SchemaSymbols.URI_SCHEMAFORSCHEMA,
-                                    SchemaSymbols.ATTVAL_ANYSIMPLETYPE,
-                                    XSComplexTypeDecl.DERIVATION_EXTENSION) ||
-                                    (compTypeDecl.getContentType() ==
-                                           compTypeDecl.CONTENTTYPE_MIXED)) {
-                 contextExistsForComplexType = true;    
-             }
-        }
-         
-        return contextExistsForComplexType;
-    }
-
-    /*
      * (non-Javadoc)
      * @see org.apache.xerces.xni.parser.XMLAssertAdapter#characters(org.apache.xerces.xni.XMLString)
      */
@@ -293,17 +268,12 @@
             boolean result;            
             if ((value == null) ||
                 (xPathContextExists == true)) {
-                // assertion on complex type, with complex content
-                // OR, complex type -&gt; simpleContent -&gt; extension
-                // OR, complex type -&gt; mixed
                 result = abstrPsychopathImpl.evaluatePsychoPathExpr(xp,
                                  assertImpl.getXPathDefaultNamespace(),
                                  currentAssertDomNode);  
-            }
+            } 
             else {
-                // assertion on simple type
-                // OR, complex type -&gt; simpleContent -&gt; restriction.
-                // here, XPath context is "undefined"
+                // XPath context is "undefined"
                 result = abstrPsychopathImpl.evaluatePsychoPathExpr(xp,
                                  assertImpl.getXPathDefaultNamespace(),
                                  null); 

Modified: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/assertion/XSAssertImpl.java
URL: http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/assertion/XSAssertImpl.java?rev=887671&amp;r1=887670&amp;r2=887671&amp;view=diff
==============================================================================
--- xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/assertion/XSAssertImpl.java
(original)
+++ xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/assertion/XSAssertImpl.java
Sun Dec  6 11:50:17 2009
@@ -37,6 +37,8 @@
  */
 public class XSAssertImpl extends AbstractPsychoPathImpl implements XSAssert {
 
+    protected short assertType = XSConstants.ASSERTION;
+    
     /** The type definition associated with the assertion component */
     protected XSTypeDefinition fTypeDefinition;
 
@@ -91,6 +93,13 @@
     public void setXPath2NamespaceContext(NamespaceSupport namespaceContext) {
         fXPath2NamespaceContext = namespaceContext;       
     }
+    
+    /**
+     * Sets the type of the object
+     */
+    public void setType(short assertType) {
+        this.assertType = assertType;
+    }
    
     public XSObjectList getAnnotations() {
         return fAnnotations;
@@ -141,7 +150,7 @@
      * Get the type of the object
      */
     public short getType() {
-        return XSConstants.ASSERTION;
+        return assertType;
     }
        
     /**

Modified: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/traversers/XSDAbstractTraverser.java
URL: http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/traversers/XSDAbstractTraverser.java?rev=887671&amp;r1=887670&amp;r2=887671&amp;view=diff
==============================================================================
--- xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/traversers/XSDAbstractTraverser.java
(original)
+++ xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/traversers/XSDAbstractTraverser.java
Sun Dec  6 11:50:17 2009
@@ -24,7 +24,6 @@
 import org.apache.xerces.impl.dv.InvalidDatatypeValueException;
 import org.apache.xerces.impl.dv.XSFacets;
 import org.apache.xerces.impl.dv.XSSimpleType;
-import org.apache.xerces.impl.dv.xs.TypeValidatorHelper;
 import org.apache.xerces.impl.validation.ValidationState;
 import org.apache.xerces.impl.xpath.XPath20Assert;
 import org.apache.xerces.impl.xs.SchemaGrammar;
@@ -45,6 +44,7 @@
 import org.apache.xerces.util.SymbolTable;
 import org.apache.xerces.xni.QName;
 import org.apache.xerces.xs.XSAttributeUse;
+import org.apache.xerces.xs.XSConstants;
 import org.apache.xerces.xs.XSMultiValueFacet;
 import org.apache.xerces.xs.XSObjectList;
 import org.apache.xerces.xs.XSSimpleTypeDefinition;
@@ -511,6 +511,7 @@
                                                            fSchemaHandler);
                     Test testExpr = new Test(new XPath20Assert(test, fSymbolTable, 
                                            schemaDoc.fNamespaceSupport), assertImpl);   
             
+                    assertImpl.setType(XSConstants.ASSERTION_FACET);
                     assertImpl.setTest(testExpr);
                     assertImpl.setXPathDefaultNamespace(xpathDefaultNamespace);
                     assertImpl.setXPath2NamespaceContext(schemaDoc.fNamespaceSupport);

Modified: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/xs/XSConstants.java
URL: http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/xs/XSConstants.java?rev=887671&amp;r1=887670&amp;r2=887671&amp;view=diff
==============================================================================
--- xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/xs/XSConstants.java (original)
+++ xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/xs/XSConstants.java Sun
Dec  6 11:50:17 2009
@@ -89,11 +89,16 @@
      * The object describes a XML Schema assertion
      */
     public static final short ASSERTION                 = 16;
+    
+    /**
+     * The object describes a XML Schema assertion, facet
+     */
+    public static final short ASSERTION_FACET           = 17;
 
     /**
      * The object describes an openContent
      */
-    public static final short OPEN_CONTENT              = 17;
+    public static final short OPEN_CONTENT              = 18;
 
     // Derivation constants
     /**



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



</pre>
</div>
</content>
</entry>
<entry>
<title>svn commit: r887651 - in /xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl: msg/XMLSchemaMessages.properties xs/AbstractPsychoPathImpl.java xs/XMLAssertPsychopathImpl.java</title>
<author><name>mukulg@apache.org</name></author>
<link rel="alternate" href="http://mail-archives.apache.org/mod_mbox/xerces-commits/200912.mbox/%3c20091206085507.19D2F23889D0@eris.apache.org%3e"/>
<id>urn:uuid:%3c20091206085507-19D2F23889D0@eris-apache-org%3e</id>
<updated>2009-12-06T08:54:52Z</updated>
<content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml">
<pre>
Author: mukulg
Date: Sun Dec  6 08:54:35 2009
New Revision: 887651

URL: http://svn.apache.org/viewvc?rev=887651&amp;view=rev
Log:
fixes to processing of xpath2 context variable, $value with context awareness, as specified
in the XSD 1.1 spec. improvement to error messages.

Modified:
    xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/msg/XMLSchemaMessages.properties
    xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/AbstractPsychoPathImpl.java
    xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/XMLAssertPsychopathImpl.java

Modified: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/msg/XMLSchemaMessages.properties
URL: http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/msg/XMLSchemaMessages.properties?rev=887651&amp;r1=887650&amp;r2=887651&amp;view=diff
==============================================================================
--- xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/msg/XMLSchemaMessages.properties
(original)
+++ xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/msg/XMLSchemaMessages.properties
Sun Dec  6 08:54:35 2009
@@ -106,6 +106,7 @@
         cvc-type.3.1.2 = cvc-type.3.1.2: Element ''{0}'' is a simple type, so it must have
no element information item [children].
         cvc-type.3.1.3 = cvc-type.3.1.3: The value ''{1}'' of element ''{0}'' is not valid.
         cvc-assertion.3.13.4.1 = cvc-assertion.3.13.4.1: Assertion evaluation (''{1}'') for
element ''{0}'' with type ''{2}'' did not succeed.
+        cvc-assertion.4.3.15.3 = cvc-assertion.4.3.15.3: Assertion evaluation (''{1}'') for
element ''{0}'' with type ''{2}'' did not succeed (undefined context).
         cvc-xpath.3.13.4.2 = cvc-xpath.3.13.4.2: Assertion XPath expression, (''{0}'') on
the Schema type (''{1}'') couldn''t compile successfully.
         
 #schema valid (3.X.3)

Modified: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/AbstractPsychoPathImpl.java
URL: http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/AbstractPsychoPathImpl.java?rev=887651&amp;r1=887650&amp;r2=887651&amp;view=diff
==============================================================================
--- xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/AbstractPsychoPathImpl.java
(original)
+++ xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/AbstractPsychoPathImpl.java
Sun Dec  6 08:54:35 2009
@@ -103,9 +103,10 @@
         
         fDynamicContext = new DefaultDynamicContext(schema, document);        
         
-        // populate the PsychoPath XPath 2.0 static context, with namespace bindings
-        // derived from the XSD Schema document
-        NamespaceSupport xpath2NamespaceContext = (NamespaceSupport) psychoPathParams.get("XPATH2_NS_CONTEXT");
+        // populate the PsychoPath XPath 2.0 static context, with namespace
+        // bindings derived from the XSD Schema document
+        NamespaceSupport xpath2NamespaceContext = (NamespaceSupport)
+                                    psychoPathParams.get("XPATH2_NS_CONTEXT");
         Enumeration currPrefixes = xpath2NamespaceContext.getAllPrefixes();
         while (currPrefixes.hasMoreElements()) {
             String prefix = (String)currPrefixes.nextElement();
@@ -127,21 +128,27 @@
                                  String xPathDefaultNamespace,
                                  Element contextNode)
                                  throws StaticError, DynamicError {
-        if (xPathDefaultNamespace != null) {
-           fDynamicContext.add_namespace(null, xPathDefaultNamespace);  
-        }
+        
         StaticChecker sc = new StaticNameResolver(fDynamicContext);
         sc.check(xp);
        
-        Evaluator eval = new DefaultEvaluator(fDynamicContext, domDoc);
-        
-        // change focus to the top most element
-        ResultSequence nodeEvalRS = ResultSequenceFactory.create_new();
-        nodeEvalRS.add(new ElementType(contextNode, 
+        Evaluator eval = null;
+        if (contextNode != null) {
+           eval = new DefaultEvaluator(fDynamicContext, domDoc);           
+           // change focus to the top most element
+           ResultSequence nodeEvalRS = ResultSequenceFactory.create_new();
+           nodeEvalRS.add(new ElementType(contextNode, 
                            fDynamicContext.node_position(contextNode)));
-
-        fDynamicContext.set_focus(new Focus(nodeEvalRS));
-
+           if (xPathDefaultNamespace != null) {
+             fDynamicContext.add_namespace(null, xPathDefaultNamespace);  
+           }
+           
+           fDynamicContext.set_focus(new Focus(nodeEvalRS));
+        }
+        else {
+           eval = new DefaultEvaluator(fDynamicContext, null);   
+        }
+        
         ResultSequence rs = eval.evaluate(xp);
 
         boolean result = false;
@@ -200,7 +207,8 @@
            psychoPathType = new XSAnyURI(value);
         }
         else if ("boolean".equals(xsdTypeName)) {
-           psychoPathType = new XSBoolean(Boolean.valueOf(value).booleanValue());
+           psychoPathType = new XSBoolean(Boolean.valueOf(value).
+                                                  booleanValue());
         }
         else if ("date".equals(xsdTypeName)) {       
            psychoPathType = XSDate.parse_date(value);
@@ -313,7 +321,8 @@
         String typeString = "";
         
         if (typeDef != null) {
-           typeString = (typeDef.getName() != null) ? typeDef.getName() : "#anonymous"; 
 
+           typeString = (typeDef.getName() != null) ? typeDef.getName() :
+                                                            "#anonymous";   
         }
         else {
            typeString = "#anonymous"; 

Modified: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/XMLAssertPsychopathImpl.java
URL: http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/XMLAssertPsychopathImpl.java?rev=887651&amp;r1=887650&amp;r2=887651&amp;view=diff
==============================================================================
--- xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/XMLAssertPsychopathImpl.java
(original)
+++ xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/XMLAssertPsychopathImpl.java
Sun Dec  6 08:54:35 2009
@@ -37,6 +37,8 @@
 import org.apache.xerces.xs.XSObjectList;
 import org.apache.xerces.xs.XSTypeDefinition;
 import org.eclipse.wst.xml.xpath2.processor.DynamicContext;
+import org.eclipse.wst.xml.xpath2.processor.DynamicError;
+import org.eclipse.wst.xml.xpath2.processor.StaticError;
 import org.eclipse.wst.xml.xpath2.processor.ast.XPath;
 import org.eclipse.wst.xml.xpath2.processor.internal.types.AnyAtomicType;
 import org.w3c.dom.Document;
@@ -65,15 +67,15 @@
     // a factory Document object to construct DOM tree nodes
     Document assertDocument = null;
 
-    // an element to track construction of assertion DOM tree. This object changes
-    // as per the XNI document events.
+    // an element to track construction of assertion DOM tree. This object
+    // changes as per the XNI document events.
     Element currentAssertDomNode = null;
 
     // a stack holding the DOM root for assertions evaluation
     Stack assertRootStack = null;
 
-    // a stack parallel to 'assertRootStack' storing all assertions for a single
-    // assert tree
+    // a stack parallel to 'assertRootStack' storing all assertions for a
+    // single assert tree.
     Stack assertListStack = null;
 
     // XMLSchemaValidator reference. set from the XMLSchemaValidator object
@@ -100,15 +102,13 @@
      * Initialize the PsychoPath XPath processor
      */
     private void initXPathProcessor() throws Exception {
-        validator = (XMLSchemaValidator) getProperty("http://apache.org/xml/properties/assert/validator");
       
+        validator = (XMLSchemaValidator) getProperty
+                        ("http://apache.org/xml/properties/assert/validator");        
         abstrPsychopathImpl = new AbstractPsychoPathImpl();
-        fDynamicContext = abstrPsychopathImpl.initDynamicContext(fSchema,
-                                                      assertDocument,
-                                                      assertParams);
-        
-        // create variable, $value in XPath dynamic context
-        fDynamicContext.add_variable(new org.eclipse.wst.xml.xpath2.processor.internal.types.QName(
-                                         "value"));
+        fDynamicContext = abstrPsychopathImpl.initDynamicContext(
+                                                    fSchema,
+                                                    assertDocument,
+                                                    assertParams);
     }
 
     /*
@@ -118,10 +118,12 @@
     public void startElement(QName element, XMLAttributes attributes,
                                               Augmentations augs) {
         if (currentAssertDomNode == null) {
-           currentAssertDomNode = new PSVIElementNSImpl((CoreDocumentImpl) assertDocument,
element.uri, element.rawname);
+           currentAssertDomNode = new PSVIElementNSImpl((CoreDocumentImpl)
+                                assertDocument, element.uri, element.rawname);
            assertDocument.appendChild(currentAssertDomNode);
         } else {
-            Element elem = new PSVIElementNSImpl((CoreDocumentImpl) assertDocument, element.uri,
element.rawname);
+            Element elem = new PSVIElementNSImpl((CoreDocumentImpl)
+                                assertDocument, element.uri, element.rawname);
             currentAssertDomNode.appendChild(elem);
             currentAssertDomNode = elem;
         }
@@ -132,12 +134,14 @@
             String attQName = attributes.getQName(attIndex);
             String attValue = attributes.getValue(attIndex);
             
-            PSVIAttrNSImpl attrNode = new PSVIAttrNSImpl((PSVIDocumentImpl) assertDocument,
attrUri, attQName);
+            PSVIAttrNSImpl attrNode = new PSVIAttrNSImpl((PSVIDocumentImpl)
+                                          assertDocument, attrUri, attQName);
             attrNode.setNodeValue(attValue);
             
             // set PSVI information for the attribute
             Augmentations attrAugs = attributes.getAugmentations(attIndex);
-            AttributePSVImpl attrPSVI = (AttributePSVImpl) attrAugs.getItem(Constants.ATTRIBUTE_PSVI);
+            AttributePSVImpl attrPSVI = (AttributePSVImpl) attrAugs.
+                                         getItem(Constants.ATTRIBUTE_PSVI);
             attrNode.setPSVI(attrPSVI);
             
             currentAssertDomNode.setAttributeNode(attrNode);
@@ -159,12 +163,15 @@
     public void endElement(QName element, Augmentations augs) throws Exception {
         if (currentAssertDomNode != null) {
             // set PSVI information on the element
-            ElementPSVI elemPSVI = (ElementPSVI) augs.getItem(Constants.ELEMENT_PSVI);
+            ElementPSVI elemPSVI = (ElementPSVI) augs.getItem(
+                                                 Constants.ELEMENT_PSVI);
             ((PSVIElementNSImpl)currentAssertDomNode).setPSVI(elemPSVI);
             
-            if (!assertRootStack.empty() &amp;&amp; (currentAssertDomNode == assertRootStack.peek()))
{               
+            if (!assertRootStack.empty() &amp;&amp; (currentAssertDomNode == 
+                                             assertRootStack.peek())) {               
                  // get XSModel                
-                 fSchema =  ((PSVIElementNSImpl) currentAssertDomNode).getSchemaInformation();
+                 fSchema =  ((PSVIElementNSImpl) currentAssertDomNode).
+                                                 getSchemaInformation();
                  
                  // pop the stack, to go one level up
                  assertRootStack.pop();
@@ -175,7 +182,8 @@
             }
 
             if (currentAssertDomNode.getParentNode() instanceof Element) {
-              currentAssertDomNode = (Element)currentAssertDomNode.getParentNode();
+              currentAssertDomNode = (Element)currentAssertDomNode.
+                                                       getParentNode();
             }
         }
     }
@@ -183,8 +191,10 @@
     /*
      * Method to evaluate all assertions for the element tree
      */
-    private void processAllAssertionsOnElement(QName element, Object assertions)
-            throws Exception {
+    private void processAllAssertionsOnElement(
+                                    QName element,
+                                    Object assertions)
+                                    throws Exception {
          // initialize the XPath engine
          initXPathProcessor();
          
@@ -197,7 +207,7 @@
                  value = node.getNodeValue();
              }
          }
-         
+
          // evaluate assertions
          if (assertions instanceof XSObjectList) {
             // assertions from a complex type definition
@@ -211,7 +221,10 @@
             XSObjectList assertList = (XSObjectList) assertions;
             for (int i = 0; i &lt; assertList.size(); i++) {
                XSAssertImpl assertImpl = (XSAssertImpl) assertList.get(i);
-               evaluateAssertion(element, assertImpl);
+               evaluateAssertion(element,
+                                 assertImpl,
+                                 value,
+                                 xPathContextExistsForComplexType());
             }
         } else if (assertions instanceof Vector) {
             // assertions from a simple type definition
@@ -219,12 +232,43 @@
             Vector assertList = (Vector) assertions;                    
             for (int i = 0; i &lt; assertList.size(); i++) {
                 XSAssertImpl assertImpl = (XSAssertImpl) assertList.get(i);
-                evaluateAssertion(element, assertImpl);
+                evaluateAssertion(element, assertImpl, value, false);
             }
         }
     }
 
     /*
+     * Determine, if XPath context should exist, for assertions on
+     * complex types.
+     * an XPath context should exist, if complex type has following
+     * content model:
+     * complexType -&gt; simpleContent -&gt; extension
+     * OR
+     * complexType -&gt; mixed content type
+     *                (i.e, &lt;xs:complexType ... mixed="true")
+     */
+    private boolean xPathContextExistsForComplexType() {
+        boolean contextExistsForComplexType = false;
+        
+        PSVIElementNSImpl psviElemCurrent = (PSVIElementNSImpl)
+                                                 currentAssertDomNode;         
+        if (psviElemCurrent.getTypeDefinition().getTypeCategory() == 
+                                         XSTypeDefinition.COMPLEX_TYPE) {
+             XSComplexTypeDecl compTypeDecl = (XSComplexTypeDecl)
+                                           psviElemCurrent.getTypeDefinition();         
                             
+             if (compTypeDecl.isDerivedFrom(SchemaSymbols.URI_SCHEMAFORSCHEMA,
+                                    SchemaSymbols.ATTVAL_ANYSIMPLETYPE,
+                                    XSComplexTypeDecl.DERIVATION_EXTENSION) ||
+                                    (compTypeDecl.getContentType() ==
+                                           compTypeDecl.CONTENTTYPE_MIXED)) {
+                 contextExistsForComplexType = true;    
+             }
+        }
+         
+        return contextExistsForComplexType;
+    }
+
+    /*
      * (non-Javadoc)
      * @see org.apache.xerces.xni.parser.XMLAssertAdapter#characters(org.apache.xerces.xni.XMLString)
      */
@@ -239,18 +283,47 @@
     /*
      * Method to evaluate an assertion for the element
      */
-    private void evaluateAssertion(QName element, XSAssertImpl assertImpl) {
+    private void evaluateAssertion(QName element,
+                                   XSAssertImpl assertImpl,
+                                   String value,
+                                   boolean xPathContextExists) {
         try {  
-            XPath xp = assertImpl.getCompiledXPath();            
-            boolean result = abstrPsychopathImpl.evaluatePsychoPathExpr(xp,
-                                     assertImpl.getXPathDefaultNamespace(),
-                                     currentAssertDomNode);
+            XPath xp = assertImpl.getCompiledXPath();
+            
+            boolean result;            
+            if ((value == null) ||
+                (xPathContextExists == true)) {
+                // assertion on complex type, with complex content
+                // OR, complex type -&gt; simpleContent -&gt; extension
+                // OR, complex type -&gt; mixed
+                result = abstrPsychopathImpl.evaluatePsychoPathExpr(xp,
+                                 assertImpl.getXPathDefaultNamespace(),
+                                 currentAssertDomNode);  
+            }
+            else {
+                // assertion on simple type
+                // OR, complex type -&gt; simpleContent -&gt; restriction.
+                // here, XPath context is "undefined"
+                result = abstrPsychopathImpl.evaluatePsychoPathExpr(xp,
+                                 assertImpl.getXPathDefaultNamespace(),
+                                 null); 
+            }
             
             if (!result) {
                // assertion evaluation is false
                reportError("cvc-assertion.3.13.4.1", element, assertImpl);
             }
-        } catch (Exception ex) {
+        }
+        catch (DynamicError ex) {
+            if (ex.code().equals("XPDY0002")) {
+               // ref: http://www.w3.org/TR/xpath20/#eval_context
+               reportError("cvc-assertion.4.3.15.3", element, assertImpl);
+            }
+            else {
+               reportError("cvc-assertion.3.13.4.1", element, assertImpl);  
+            }
+        }
+        catch (StaticError ex) {
             reportError("cvc-assertion.3.13.4.1", element, assertImpl);
         }
     }
@@ -258,12 +331,14 @@
     /*
      * Method to report error messages
      */
-    private void reportError(String key, QName element, XSAssertImpl assertImpl) {
+    private void reportError(String key, QName element,
+                             XSAssertImpl assertImpl) {
         XSTypeDefinition typeDef = assertImpl.getTypeDefinition();
         String typeString = "";
         
         if (typeDef != null) {
-           typeString = (typeDef.getName() != null) ? typeDef.getName() : "#anonymous"; 
 
+           typeString = (typeDef.getName() != null) ? typeDef.getName() :
+                                                      "#anonymous";   
         }
         else {
            typeString = "#anonymous"; 
@@ -276,9 +351,11 @@
     
     // assign value to the XPath2 "dynamic context" variable, $value
     private void setValueOf$value(String value) {
-       PSVIElementNSImpl currentAssertPSVINode = (PSVIElementNSImpl) currentAssertDomNode;
+       PSVIElementNSImpl currentAssertPSVINode = (PSVIElementNSImpl)
+                                                 currentAssertDomNode;
        
-       String xsdTypeName = getXSDtypeOf$Value(currentAssertPSVINode.getTypeDefinition());
      
+       String xsdTypeName = getXSDtypeOf$Value(currentAssertPSVINode.
+                                               getTypeDefinition());       
        Object psychoPathType = abstrPsychopathImpl.getPsychoPathTypeForXSDType
                                                          (xsdTypeName, value);       
        fDynamicContext.set_variable(



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



</pre>
</div>
</content>
</entry>
<entry>
<title>svn commit: r887547 - in /xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs: AbstractPsychoPathImpl.java XMLAssertPsychopathImpl.java</title>
<author><name>mukulg@apache.org</name></author>
<link rel="alternate" href="http://mail-archives.apache.org/mod_mbox/xerces-commits/200912.mbox/%3c20091205144152.06DB82388978@eris.apache.org%3e"/>
<id>urn:uuid:%3c20091205144152-06DB82388978@eris-apache-org%3e</id>
<updated>2009-12-05T14:41:51Z</updated>
<content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml">
<pre>
Author: mukulg
Date: Sat Dec  5 14:41:49 2009
New Revision: 887547

URL: http://svn.apache.org/viewvc?rev=887547&amp;view=rev
Log:
improvements to assertion variable, $value implementation

Modified:
    xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/AbstractPsychoPathImpl.java
    xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/XMLAssertPsychopathImpl.java

Modified: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/AbstractPsychoPathImpl.java
URL: http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/AbstractPsychoPathImpl.java?rev=887547&amp;r1=887546&amp;r2=887547&amp;view=diff
==============================================================================
--- xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/AbstractPsychoPathImpl.java
(original)
+++ xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/AbstractPsychoPathImpl.java
Sat Dec  5 14:41:49 2009
@@ -46,23 +46,43 @@
 import org.eclipse.wst.xml.xpath2.processor.internal.Focus;
 import org.eclipse.wst.xml.xpath2.processor.internal.types.AnyType;
 import org.eclipse.wst.xml.xpath2.processor.internal.types.ElementType;
+import org.eclipse.wst.xml.xpath2.processor.internal.types.QName;
+import org.eclipse.wst.xml.xpath2.processor.internal.types.XSAnyURI;
 import org.eclipse.wst.xml.xpath2.processor.internal.types.XSBoolean;
+import org.eclipse.wst.xml.xpath2.processor.internal.types.XSByte;
 import org.eclipse.wst.xml.xpath2.processor.internal.types.XSDate;
 import org.eclipse.wst.xml.xpath2.processor.internal.types.XSDateTime;
+import org.eclipse.wst.xml.xpath2.processor.internal.types.XSDayTimeDuration;
 import org.eclipse.wst.xml.xpath2.processor.internal.types.XSDecimal;
 import org.eclipse.wst.xml.xpath2.processor.internal.types.XSDouble;
+import org.eclipse.wst.xml.xpath2.processor.internal.types.XSDuration;
 import org.eclipse.wst.xml.xpath2.processor.internal.types.XSFloat;
+import org.eclipse.wst.xml.xpath2.processor.internal.types.XSGDay;
+import org.eclipse.wst.xml.xpath2.processor.internal.types.XSGMonth;
+import org.eclipse.wst.xml.xpath2.processor.internal.types.XSGMonthDay;
+import org.eclipse.wst.xml.xpath2.processor.internal.types.XSGYear;
+import org.eclipse.wst.xml.xpath2.processor.internal.types.XSGYearMonth;
 import org.eclipse.wst.xml.xpath2.processor.internal.types.XSInt;
 import org.eclipse.wst.xml.xpath2.processor.internal.types.XSInteger;
 import org.eclipse.wst.xml.xpath2.processor.internal.types.XSLong;
+import org.eclipse.wst.xml.xpath2.processor.internal.types.XSNegativeInteger;
+import org.eclipse.wst.xml.xpath2.processor.internal.types.XSNonNegativeInteger;
+import org.eclipse.wst.xml.xpath2.processor.internal.types.XSNonPositiveInteger;
+import org.eclipse.wst.xml.xpath2.processor.internal.types.XSPositiveInteger;
+import org.eclipse.wst.xml.xpath2.processor.internal.types.XSShort;
 import org.eclipse.wst.xml.xpath2.processor.internal.types.XSString;
 import org.eclipse.wst.xml.xpath2.processor.internal.types.XSTime;
+import org.eclipse.wst.xml.xpath2.processor.internal.types.XSUnsignedByte;
+import org.eclipse.wst.xml.xpath2.processor.internal.types.XSUnsignedInt;
+import org.eclipse.wst.xml.xpath2.processor.internal.types.XSUnsignedLong;
+import org.eclipse.wst.xml.xpath2.processor.internal.types.XSUnsignedShort;
+import org.eclipse.wst.xml.xpath2.processor.internal.types.XSYearMonthDuration;
 import org.w3c.dom.Document;
 import org.w3c.dom.Element;
 
 /**
- * A base class, providing common services for XPath 2 evaluation,
- * with PsychoPath XPath 2.0 engine.
+ * A base class, providing common services for XPath 2 evaluation, with
+ * PsychoPath XPath 2.0 engine.
  * 
  * @xerces.internal
  * 
@@ -176,42 +196,106 @@
                                                  String value) {
         Object psychoPathType = null;
         
-        if ("string".equals(xsdTypeName)) {
-            psychoPathType = new XSString(value);   
+        if ("anyURI".equals(xsdTypeName)) {
+           psychoPathType = new XSAnyURI(value);
+        }
+        else if ("boolean".equals(xsdTypeName)) {
+           psychoPathType = new XSBoolean(Boolean.valueOf(value).booleanValue());
         }
         else if ("date".equals(xsdTypeName)) {       
-            psychoPathType = XSDate.parse_date(value);
+           psychoPathType = XSDate.parse_date(value);
         }
-        else if ("int".equals(xsdTypeName)) {      
-            psychoPathType = new XSInt(new BigInteger(value));
+        else if ("dateTime".equals(xsdTypeName)) {
+           psychoPathType = XSDateTime.parseDateTime(value);
         }
-        else if ("long".equals(xsdTypeName)) {     
-           psychoPathType = new XSLong(new BigInteger(value));
+        // decimal and it's subtypes
+        else if ("decimal".equals(xsdTypeName)) {      
+           psychoPathType = new XSDecimal(new BigDecimal(value));
         }
         else if ("integer".equals(xsdTypeName)) {      
            psychoPathType = new XSInteger(new BigInteger(value));
         }
+        else if ("long".equals(xsdTypeName)) {     
+           psychoPathType = new XSLong(new BigInteger(value));
+        }
+        else if ("int".equals(xsdTypeName)) {      
+           psychoPathType = new XSInt(new BigInteger(value));
+        }
+        else if ("short".equals(xsdTypeName)) {      
+           psychoPathType = new XSShort(new BigInteger(value));
+        }
+        else if ("byte".equals(xsdTypeName)) {      
+           psychoPathType = new XSByte(new BigInteger(value));
+        }
+        else if ("nonNegativeInteger".equals(xsdTypeName)) {      
+           psychoPathType = new XSNonNegativeInteger(new BigInteger(value));
+        }
+        else if ("positiveInteger".equals(xsdTypeName)) {      
+           psychoPathType = new XSPositiveInteger(new BigInteger(value));
+        }
+        else if ("unsignedLong".equals(xsdTypeName)) {      
+           psychoPathType = new XSUnsignedLong(new BigInteger(value));
+        }
+        else if ("unsignedInt".equals(xsdTypeName)) {      
+           psychoPathType = new XSUnsignedInt(new BigInteger(value));
+        }
+        else if ("unsignedShort".equals(xsdTypeName)) {      
+           psychoPathType = new XSUnsignedShort(new BigInteger(value));
+        }
+        else if ("unsignedByte".equals(xsdTypeName)) {      
+           psychoPathType = new XSUnsignedByte(new BigInteger(value));
+        }
+        else if ("nonPositiveInteger".equals(xsdTypeName)) {      
+           psychoPathType = new XSNonPositiveInteger(new BigInteger(value));
+        }
+        else if ("negativeInteger".equals(xsdTypeName)) {      
+           psychoPathType = new XSNegativeInteger(new BigInteger(value));
+        }
+        // end of, decimal types
         else if ("double".equals(xsdTypeName)) {       
            psychoPathType = new XSDouble(Double.parseDouble(value));
         }
+        // duration and it's subtypes
+        else if ("duration".equals(xsdTypeName)) {       
+           psychoPathType = XSDuration.parseDTDuration(value);
+        }
+        else if ("dayTimeDuration".equals(xsdTypeName)) {       
+           psychoPathType = XSDayTimeDuration.parseDTDuration(value);
+        }
+        else if ("yearMonthDuration".equals(xsdTypeName)) {       
+           psychoPathType = XSYearMonthDuration.parseYMDuration(value);
+        }
+        // end of, duration types
         else if ("float".equals(xsdTypeName)) {        
            psychoPathType = new XSFloat(Float.parseFloat(value));
         }
-        else if ("decimal".equals(xsdTypeName)) {      
-           psychoPathType = new XSDecimal(new BigDecimal(value));
+        else if ("gDay".equals(xsdTypeName)) {        
+           psychoPathType = XSGDay.parse_gDay(value);
         }
-        else if ("dateTime".equals(xsdTypeName)) {
-           psychoPathType = XSDateTime.parseDateTime(value);
+        else if ("gMonth".equals(xsdTypeName)) {        
+           psychoPathType = XSGMonth.parse_gMonth(value);
         }
-        else if ("time".equals(xsdTypeName)) {
-           psychoPathType = XSTime.parse_time(value);
+        else if ("gMonthDay".equals(xsdTypeName)) {        
+           psychoPathType = XSGMonthDay.parse_gMonthDay(value);
         }
-        else if ("boolean".equals(xsdTypeName)) {
-           psychoPathType = new XSBoolean(Boolean.valueOf(value).booleanValue());
+        else if ("gYear".equals(xsdTypeName)) {        
+           psychoPathType = XSGYear.parse_gYear(value);
+        }
+        else if ("gYearMonth".equals(xsdTypeName)) {        
+           psychoPathType = XSGYearMonth.parse_gYearMonth(value);
         }
         else if ("NOTATION".equals(xsdTypeName)) {
            psychoPathType = new XSString(value);
         }
+        else if ("QName".equals(xsdTypeName)) {
+           psychoPathType = QName.parse_QName(value);
+        }
+        else if ("string".equals(xsdTypeName)) {
+           psychoPathType = new XSString(value);   
+        }                        
+        else if ("time".equals(xsdTypeName)) {
+           psychoPathType = XSTime.parse_time(value);
+        }               
         else {
            // create a XSString value, as fallback option 
            psychoPathType = new XSString(value);

Modified: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/XMLAssertPsychopathImpl.java
URL: http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/XMLAssertPsychopathImpl.java?rev=887547&amp;r1=887546&amp;r2=887547&amp;view=diff
==============================================================================
--- xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/XMLAssertPsychopathImpl.java
(original)
+++ xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/XMLAssertPsychopathImpl.java
Sat Dec  5 14:41:49 2009
@@ -38,7 +38,7 @@
 import org.apache.xerces.xs.XSTypeDefinition;
 import org.eclipse.wst.xml.xpath2.processor.DynamicContext;
 import org.eclipse.wst.xml.xpath2.processor.ast.XPath;
-import org.eclipse.wst.xml.xpath2.processor.internal.types.AnyType;
+import org.eclipse.wst.xml.xpath2.processor.internal.types.AnyAtomicType;
 import org.w3c.dom.Document;
 import org.w3c.dom.Element;
 import org.w3c.dom.Node;
@@ -283,7 +283,7 @@
                                                          (xsdTypeName, value);       
        fDynamicContext.set_variable(
                new org.eclipse.wst.xml.xpath2.processor.internal.types.QName(
-                       "value"), (AnyType) psychoPathType);
+                       "value"), (AnyAtomicType) psychoPathType);
     }
     
     /*



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



</pre>
</div>
</content>
</entry>
<entry>
<title>svn commit: r886274 - /xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/AbstractDateTimeDV.java</title>
<author><name>knoaman@apache.org</name></author>
<link rel="alternate" href="http://mail-archives.apache.org/mod_mbox/xerces-commits/200912.mbox/%3c20091202191931.958B42388893@eris.apache.org%3e"/>
<id>urn:uuid:%3c20091202191931-958B42388893@eris-apache-org%3e</id>
<updated>2009-12-02T19:19:31Z</updated>
<content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml">
<pre>
Author: knoaman
Date: Wed Dec  2 19:19:31 2009
New Revision: 886274

URL: http://svn.apache.org/viewvc?rev=886274&amp;view=rev
Log:
Add support for dateTimeStamp simple type and explicitTimezone facet. Patch by Ken Cai with
minor modifications by Khaled Noaman.

Modified:
    xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/AbstractDateTimeDV.java

Modified: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/AbstractDateTimeDV.java
URL: http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/AbstractDateTimeDV.java?rev=886274&amp;r1=886273&amp;r2=886274&amp;view=diff
==============================================================================
--- xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/AbstractDateTimeDV.java
(original)
+++ xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/AbstractDateTimeDV.java
Wed Dec  2 19:19:31 2009
@@ -89,6 +89,10 @@
 				((DateTimeData)value2), true);
 	}//compare()
 	
+	public boolean hasTimeZone(Object value){
+	    return ((DateTimeData)value).hasTimeZone();
+	}
+	
 	/**
 	 * Compare algorithm described in dateDime (3.2.7).
 	 * Duration datatype overwrites this method



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



</pre>
</div>
</content>
</entry>
<entry>
<title>svn commit: r886273 - in /xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl: dv/ dv/xs/ msg/ xs/ xs/traversers/</title>
<author><name>knoaman@apache.org</name></author>
<link rel="alternate" href="http://mail-archives.apache.org/mod_mbox/xerces-commits/200912.mbox/%3c20091202191855.B3824238888E@eris.apache.org%3e"/>
<id>urn:uuid:%3c20091202191855-B3824238888E@eris-apache-org%3e</id>
<updated>2009-12-02T19:18:55Z</updated>
<content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml">
<pre>
Author: knoaman
Date: Wed Dec  2 19:18:54 2009
New Revision: 886273

URL: http://svn.apache.org/viewvc?rev=886273&amp;view=rev
Log:
Add support for dateTimeStamp simple type and explicitTimezone facet. Patch by Ken Cai with
minor modifications by Khaled Noaman.

Added:
    xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/DateTimeStampDV.java
  (with props)
Modified:
    xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/XSFacets.java
    xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/XSSimpleType.java
    xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/Schema11DVFactoryImpl.java
    xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/TypeValidator.java
    xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/XSSimpleTypeDecl.java
    xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/msg/XMLSchemaMessages.properties
    xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/SchemaSymbols.java
    xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/traversers/XSAttributeChecker.java
    xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/traversers/XSDAbstractTraverser.java

Modified: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/XSFacets.java
URL: http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/XSFacets.java?rev=886273&amp;r1=886272&amp;r2=886273&amp;view=diff
==============================================================================
--- xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/XSFacets.java (original)
+++ xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/XSFacets.java Wed
Dec  2 19:18:54 2009
@@ -53,6 +53,11 @@
      * value of whiteSpace facet.
      */
     public short whiteSpace;
+    
+    /**
+     * value of explicitTimezone facet.
+     */
+    public short explicitTimezone;
 
     /**
      * value of totalDigits facet.
@@ -119,6 +124,7 @@
     public XSAnnotation maxExclusiveAnnotation;
     public XSAnnotation minInclusiveAnnotation;
     public XSAnnotation minExclusiveAnnotation;
+    public XSAnnotation explicitTimezoneAnnotation; //XML schema 1.1
     
     // the annotations of the assertions are stored in XSAssertImpl objects
     // stored in the 'assertFacets' Vector. 
@@ -137,5 +143,6 @@
         minInclusiveAnnotation = null;
         minExclusiveAnnotation = null;
         assertFacets = null;
+        explicitTimezoneAnnotation = null; //XML Schema 1.1
     }
 }

Modified: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/XSSimpleType.java
URL: http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/XSSimpleType.java?rev=886273&amp;r1=886272&amp;r2=886273&amp;view=diff
==============================================================================
--- xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/XSSimpleType.java
(original)
+++ xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/XSSimpleType.java
Wed Dec  2 19:18:54 2009
@@ -45,7 +45,20 @@
     public static final short WS_REPLACE  = 1;
     /** collapse the white spaces */
     public static final short WS_COLLAPSE = 2;
-
+    
+    /**
+     * constants defined for the value of 'explicitTimezone' facet.
+     * see &lt;a href='http://www.w3.org/TR/xmlschema11-2/#rf-explicitTimezone'&gt; XML Schema
+     * Part 2: Datatypes &lt;/a&gt;
+     */
+    
+    // optional the explicit timezone
+    public static final short ET_OPTIONAL = 0;
+    // required the explicit timezone
+    public static final short ET_REQUIRED = 1;
+    // prohibited the explicit timezone
+    public static final short ET_PROHIBITED = 2;  
+    
     /**
      * Constant defined for the primitive built-in simple tpyes.
      * see &lt;a href='http://www.w3.org/TR/xmlschema-2/#built-in-primitive-datatypes'&gt;

Added: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/DateTimeStampDV.java
URL: http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/DateTimeStampDV.java?rev=886273&amp;view=auto
==============================================================================
--- xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/DateTimeStampDV.java
(added)
+++ xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/DateTimeStampDV.java
Wed Dec  2 19:18:54 2009
@@ -0,0 +1,46 @@
+/*
+ * 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.dv.xs;
+
+import org.apache.xerces.impl.dv.InvalidDatatypeValueException;
+import org.apache.xerces.impl.dv.ValidationContext;
+
+/**
+ * Validator for &amp;lt;dateTimeStamp&amp;gt; datatype (W3C Schema Datatypes)
+ *
+ * @xerces.internal  
+ * 
+ * @version $Id$
+ */
+public class DateTimeStampDV extends DateTimeDV {
+
+    public Object getActualValue(String content, ValidationContext context) throws InvalidDatatypeValueException
{
+        try{
+            return parse(content);
+        } catch(Exception ex){
+            throw new InvalidDatatypeValueException("cvc-datatype-valid.1.2.1", new Object[]{content,
"dateTimeStamp"});
+        }
+    }
+      
+    protected void validateDateTime (DateTimeData data){
+        super.validateDateTime(data);
+        if (data.utc == 0)
+            throw new RuntimeException("dateTimeStamp must have timezone");
+    }
+    
+}

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

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

Modified: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/Schema11DVFactoryImpl.java
URL: http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/Schema11DVFactoryImpl.java?rev=886273&amp;r1=886272&amp;r2=886273&amp;view=diff
==============================================================================
--- xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/Schema11DVFactoryImpl.java
(original)
+++ xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/Schema11DVFactoryImpl.java
Wed Dec  2 19:18:54 2009
@@ -45,7 +45,9 @@
         final String DAYTIMEDURATION   = "dayTimeDuration";
         final String PRECISIONDECIMAL  = "precisionDecimal";
         final String ERROR             = "error";
-
+        final String DATETIMESTAMP     = "dateTimeStamp"; 
+        final String DATETIME          = "dateTime";
+        
     	createBuiltInTypes(fBuiltInTypes, XSSimpleTypeDecl.fAnyAtomicType);
 
         // add anyAtomicType
@@ -58,7 +60,11 @@
         XSSimpleTypeDecl durationDV = (XSSimpleTypeDecl)fBuiltInTypes.get(DURATION);
         fBuiltInTypes.put(YEARMONTHDURATION, new XSSimpleTypeDecl(durationDV, YEARMONTHDURATION,
XSSimpleTypeDecl.DV_YEARMONTHDURATION, XSSimpleType.ORDERED_PARTIAL, false, false, false,
true, XSSimpleTypeDecl.YEARMONTHDURATION_DT));
         fBuiltInTypes.put(DAYTIMEDURATION, new XSSimpleTypeDecl(durationDV, DAYTIMEDURATION,
XSSimpleTypeDecl.DV_DAYTIMEDURATION, XSSimpleType.ORDERED_PARTIAL, false, false, false, true,
XSSimpleTypeDecl.DAYTIMEDURATION_DT));
-
+        
+        //add dateTimeStamp
+        XSSimpleTypeDecl dateTimeDV = (XSSimpleTypeDecl)fBuiltInTypes.get(DATETIME);
+        fBuiltInTypes.put(DATETIMESTAMP, new XSSimpleTypeDecl(dateTimeDV, DATETIMESTAMP,
XSSimpleTypeDecl.DV_DATETIMESTAMP, XSSimpleTypeDecl.ORDERED_PARTIAL, false, false, false,
true, XSSimpleTypeDecl.DATETIMESTAMP_DT));
+                
         // add precision decimal
         fBuiltInTypes.put(PRECISIONDECIMAL, new XSSimpleTypeDecl(XSSimpleTypeDecl.fAnyAtomicType,
PRECISIONDECIMAL, XSSimpleTypeDecl.DV_PRECISIONDECIMAL, XSSimpleType.ORDERED_PARTIAL, false,
false, true, true, XSSimpleTypeDecl.PRECISIONDECIMAL_DT));
     } //createBuiltInTypes()

Modified: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/TypeValidator.java
URL: http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/TypeValidator.java?rev=886273&amp;r1=886272&amp;r2=886273&amp;view=diff
==============================================================================
--- xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/TypeValidator.java
(original)
+++ xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/TypeValidator.java
Wed Dec  2 19:18:54 2009
@@ -102,4 +102,8 @@
         return isDigit(ch) ? ch - '0' : -1;
     }
     
+    public boolean hasTimeZone(Object value){
+        return false;
+    }
+    
 } // interface TypeValidator

Modified: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/XSSimpleTypeDecl.java
URL: http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/XSSimpleTypeDecl.java?rev=886273&amp;r1=886272&amp;r2=886273&amp;view=diff
==============================================================================
--- xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/XSSimpleTypeDecl.java
(original)
+++ xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/XSSimpleTypeDecl.java
Wed Dec  2 19:18:54 2009
@@ -92,6 +92,7 @@
     protected static final short DV_DAYTIMEDURATION	  = DV_NOTATION + 8;
     protected static final short DV_ANYATOMICTYPE     = DV_NOTATION + 9;
     protected static final short DV_ERROR             = DV_NOTATION + 10;
+    protected static final short DV_DATETIMESTAMP     = DV_NOTATION + 11;
 
     private static final TypeValidator[] gDVs = {
         new AnySimpleDV(),
@@ -124,7 +125,8 @@
         new YearMonthDurationDV(), // XML Schema 1.1 type
         new DayTimeDurationDV(), // XML Schema 1.1 type
         new AnyAtomicDV(), // XML Schema 1.1 type
-        new ErrorDV() // XML Schema 1.1 type
+        new ErrorDV(), // XML Schema 1.1 type
+        new DateTimeStampDV() //XML Schema 1.1 type
     };
 
     static final short NORMALIZE_NONE = 0;
@@ -162,6 +164,7 @@
         NORMALIZE_TRIM, //DayTimeDurationDV() (Schema 1.1)
         NORMALIZE_NONE, //AnyAtomicDV() (Schema 1.1)
         NORMALIZE_NONE, //ErrorDV() (Schema 1.1)
+        NORMALIZE_TRIM, //DateTimeStampDV(), (Schema 1.1)
     };
 
     static final short SPECIAL_PATTERN_NONE     = 0;
@@ -177,6 +180,10 @@
         "preserve", "replace", "collapse"
     };
 
+    static final String[] ET_FACET_STRING = {
+        "optional", "required", "prohibited"
+    };
+    
     static final String URI_SCHEMAFORSCHEMA = "http://www.w3.org/2001/XMLSchema";
     static final String ANY_TYPE = "anyType";
 
@@ -186,6 +193,7 @@
     public static final short PRECISIONDECIMAL_DT       = 48;
     public static final short ANYATOMICTYPE_DT          = 49;
     public static final short ERROR_DT                  = 50;
+    public static final short DATETIMESTAMP_DT          = 51;
 
     // DOM Level 3 TypeInfo Derivation Method constants
     static final int DERIVATION_ANY = 0;
@@ -268,6 +276,7 @@
 
     //for constraining facets
     private short fWhiteSpace = 0;
+    private short fExplicitTimezone = ET_OPTIONAL; //for XML Schema 1.1
     private int fLength = -1;
     private int fMinLength = -1;
     private int fMaxLength = -1;
@@ -302,6 +311,7 @@
     public XSAnnotation maxExclusiveAnnotation;
     public XSAnnotation minInclusiveAnnotation;
     public XSAnnotation minExclusiveAnnotation;
+    public XSAnnotation explicitTimezoneAnnotation;
 
     // facets as objects
     private XSObjectListImpl fFacets;
@@ -406,6 +416,7 @@
         fPatternType = fBase.fPatternType;
         fFixedFacet = fBase.fFixedFacet;
         fFacetsDefined = fBase.fFacetsDefined;
+        fExplicitTimezone = fBase.fExplicitTimezone;
 
         // always inherit facet annotations in case applyFacets is not called.
         lengthAnnotation = fBase.lengthAnnotation;
@@ -420,6 +431,7 @@
         minInclusiveAnnotation = fBase.minInclusiveAnnotation;
         totalDigitsAnnotation = fBase.totalDigitsAnnotation;
         fractionDigitsAnnotation = fBase.fractionDigitsAnnotation;
+        explicitTimezoneAnnotation = fBase.explicitTimezoneAnnotation;
 
         //we also set fundamental facets information in case applyFacets is not called.
         calcFundamentalFacets();
@@ -527,6 +539,7 @@
         fPatternType = fBase.fPatternType;
         fFixedFacet = fBase.fFixedFacet;
         fFacetsDefined = fBase.fFacetsDefined;
+        fExplicitTimezone = fBase.fExplicitTimezone;
 
         //we also set fundamental facets information in case applyFacets is not called.
         calcFundamentalFacets();
@@ -928,6 +941,19 @@
                 fFixedFacet |= FACET_ASSERT;
         }
 
+        //explicitTimezone
+        if ((presentFacet &amp; FACET_EXPLICITTIMEZONE) != 0) {
+            if ((allowedFacet &amp; FACET_EXPLICITTIMEZONE) == 0) {
+                reportError("cos-applicable-facets", new Object[]{"explicitTimezone", fTypeName});
+            } else {
+                fExplicitTimezone = facets.explicitTimezone;
+                explicitTimezoneAnnotation = facets.explicitTimezoneAnnotation;
+                fFacetsDefined |= FACET_EXPLICITTIMEZONE;
+                if ((fixedFacet &amp; FACET_EXPLICITTIMEZONE) != 0)
+                    fFixedFacet |= FACET_EXPLICITTIMEZONE;
+            }
+        }
+        
         // maxInclusive
         if ((presentFacet &amp; FACET_MAXINCLUSIVE) != 0) {
             if ((allowedFacet &amp; FACET_MAXINCLUSIVE) == 0) {
@@ -1450,6 +1476,26 @@
                     reportError( "whiteSpace-valid-restriction.2", new Object[]{fTypeName});
                 }
             }
+
+            if ((fFacetsDefined &amp; FACET_EXPLICITTIMEZONE) != 0) {
+                if ((fBase.fFacetsDefined &amp; FACET_EXPLICITTIMEZONE ) != 0 &amp;&amp;
fExplicitTimezone != fBase.fExplicitTimezone){
+                    final String explicitTZStr = explicitTimezoneValue(fExplicitTimezone);
+                    final String baseExplicitTZStr = explicitTimezoneValue(fBase.fExplicitTimezone);
+                    if ((fBase.fFixedFacet &amp; FACET_EXPLICITTIMEZONE) != 0) {
+                        reportError( "FixedFacetValue", new Object[]{"explicitTimezone",
explicitTZStr, baseExplicitTZStr, fTypeName});
+                    }
+                    //check 4.3.16.4 error:
+                    //(explicitTimezone != prohibited &amp;&amp; fBase.explicitTimezone =
prohibited)
+                    //or (explicitTimezone != required &amp;&amp; fBase.explicitTimezone
= required)
+                    if (fBase.fExplicitTimezone != ET_OPTIONAL) {
+                        reportError("timezone-valid-restriction", new Object[]{fTypeName,
explicitTZStr, baseExplicitTZStr});
+                    }                
+                }
+                if ( (fValidationDV == DV_DATETIMESTAMP) &amp;&amp; fExplicitTimezone !=
XSSimpleType.ET_REQUIRED){
+                    reportError( "FixedFacetValue", new Object[]{"explicitTimezone", explicitTimezoneValue(fExplicitTimezone),
explicitTimezoneValue(ET_REQUIRED), fTypeName});
+                }
+            }
+            
         }//fFacetsDefined != null
 
         // step 4: inherit other facets from base (including fTokeyType)
@@ -1503,6 +1549,14 @@
             fWhiteSpace = fBase.fWhiteSpace;
             whiteSpaceAnnotation = fBase.whiteSpaceAnnotation;
         }
+        
+        //inherit explicitTimezone
+        if ( (fFacetsDefined &amp; FACET_EXPLICITTIMEZONE) == 0 &amp;&amp;  (fBase.fFacetsDefined
&amp; FACET_EXPLICITTIMEZONE) != 0 ) {
+            fFacetsDefined |= FACET_EXPLICITTIMEZONE;
+            fExplicitTimezone = fBase.fExplicitTimezone;
+            explicitTimezoneAnnotation = fBase.explicitTimezoneAnnotation;
+        }
+        
         // inherit enumeration
         if ((fFacetsDefined &amp; FACET_ENUMERATION) == 0 &amp;&amp; (fBase.fFacetsDefined
&amp; FACET_ENUMERATION) != 0) {
             fFacetsDefined |= FACET_ENUMERATION;
@@ -1763,6 +1817,22 @@
             }
         }
 
+        
+        //explicitTimezone
+        if ( ( fFacetsDefined &amp; FACET_EXPLICITTIMEZONE) !=0 ) {
+            boolean hasTimezone = fDVs[fValidationDV].hasTimeZone(ob);
+            if (hasTimezone) {
+                if (fExplicitTimezone == ET_PROHIBITED ) {
+                    throw new InvalidDatatypeValueException("cvc-explicitTimezone-valid",
+                        new Object[] {content, "prohibited", fTypeName});
+                }
+            }
+            else if (fExplicitTimezone == ET_REQUIRED) {
+                throw new InvalidDatatypeValueException("cvc-explicitTimezone-valid",
+                        new Object[] {content, "required", fTypeName});
+            }
+        }
+        
         int compare;
 
         //maxinclusive
@@ -2127,6 +2197,10 @@
         return WS_FACET_STRING[ws];
     }
 
+    private String explicitTimezoneValue(short et){
+        return ET_FACET_STRING[et];
+    }
+    
     /**
      *  Fundamental Facet: ordered.
      */
@@ -2238,6 +2312,8 @@
                 return (fMinInclusive == null)?null:fMinInclusive.toString();
             case FACET_TOTALDIGITS:
                 return (fTotalDigits == -1)?null:Integer.toString(fTotalDigits);
+            case FACET_EXPLICITTIMEZONE:
+                return ET_FACET_STRING[fExplicitTimezone];
             case FACET_FRACTIONDIGITS:
                 if (fValidationDV == DV_INTEGER) {
                     return "0";
@@ -3013,6 +3089,7 @@
 
         //for constraining facets
         fWhiteSpace = 0;
+        fExplicitTimezone = ET_OPTIONAL;
         fLength = -1;
         fMinLength = -1;
         fMaxLength = -1;
@@ -3041,6 +3118,7 @@
         maxExclusiveAnnotation = null;
         minInclusiveAnnotation = null;
         minExclusiveAnnotation = null;
+        explicitTimezoneAnnotation = null;
 
         fPatternType = SPECIAL_PATTERN_NONE;
         fAnnotations = null;
@@ -3077,7 +3155,7 @@
         if (fFacets == null &amp;&amp;
                 (fFacetsDefined != 0 || fValidationDV == DV_INTEGER)) {
 
-            XSFacetImpl[] facets = new XSFacetImpl[10];
+            XSFacetImpl[] facets = new XSFacetImpl[11];
             int count = 0;
             if ((fFacetsDefined &amp; FACET_WHITESPACE) != 0) {
                 facets[count] =
@@ -3178,6 +3256,15 @@
                             minInclusiveAnnotation);
                 count++;
             }
+            if ((fFacetsDefined &amp; FACET_EXPLICITTIMEZONE) != 0) {
+                facets[count] = 
+                    new XSFacetImpl (
+                            FACET_EXPLICITTIMEZONE,
+                            ET_FACET_STRING[fExplicitTimezone],
+                            (fFixedFacet &amp; FACET_EXPLICITTIMEZONE) != 0,
+                            explicitTimezoneAnnotation);
+                count++;
+            }
             fFacets = new XSObjectListImpl(facets, count);
         }
         return (fFacets != null) ? fFacets : XSObjectListImpl.EMPTY_LIST;

Modified: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/msg/XMLSchemaMessages.properties
URL: http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/msg/XMLSchemaMessages.properties?rev=886273&amp;r1=886272&amp;r2=886273&amp;view=diff
==============================================================================
--- xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/msg/XMLSchemaMessages.properties
(original)
+++ xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/msg/XMLSchemaMessages.properties
Wed Dec  2 19:18:54 2009
@@ -300,6 +300,9 @@
         whiteSpace-valid-restriction.1 = whiteSpace-valid-restriction.1: In the definition
of {0}, the value ''{1}'' for the facet ''whitespace'' is invalid, because the value for ''whitespace''
has been set to ''collapse'' in one of the ancestor types.
         whiteSpace-valid-restriction.2 = whiteSpace-valid-restriction.2: In the definition
of {0}, the value ''preserve'' for the facet ''whitespace'' is invalid, because the value
for ''whitespace'' has been set to ''replace'' in one of the ancestor types.
 
+		cvc-explicitTimezone-valid = cvc-explicitTimezone-valid: Value ''{0}'' is not facet-valid
with respect to explicitTimezone ''{1}'' for type ''{2}''.  
+		timezone-valid-restriction = timezone-valid-restriction: In the definition of {0}, the
value ''{1}'' for the facet ''explicitTimezone'' is invalid, because the value for ''explicitTimezone''
has been set to ''{2}'' in one of the ancestor types.
+	
 #schema for Schemas
 
         s4s-att-invalid-value = s4s-att-invalid-value: Invalid attribute value for ''{1}''
in element ''{0}''. Recorded reason: {2}

Modified: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/SchemaSymbols.java
URL: http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/SchemaSymbols.java?rev=886273&amp;r1=886272&amp;r2=886273&amp;view=diff
==============================================================================
--- xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/SchemaSymbols.java
(original)
+++ xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/SchemaSymbols.java
Wed Dec  2 19:18:54 2009
@@ -66,6 +66,7 @@
     public static final String ELT_DOCUMENTATION          = "documentation".intern();
     public static final String ELT_ELEMENT                = "element".intern();
     public static final String ELT_ENUMERATION            = "enumeration".intern();
+    public static final String ELT_EXPLICITTIMEZONE       = "explicitTimezone".intern();
     public static final String ELT_EXTENSION              = "extension".intern();
     public static final String ELT_FIELD                  = "field".intern();
     public static final String ELT_FRACTIONDIGITS         = "fractionDigits".intern();

Modified: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/traversers/XSAttributeChecker.java
URL: http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/traversers/XSAttributeChecker.java?rev=886273&amp;r1=886272&amp;r2=886273&amp;view=diff
==============================================================================
--- xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/traversers/XSAttributeChecker.java
(original)
+++ xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/traversers/XSAttributeChecker.java
Wed Dec  2 19:18:54 2009
@@ -153,6 +153,9 @@
     private static final XInt INT_WS_PRESERVE     = fXIntPool.getXInt(XSSimpleType.WS_PRESERVE);
     private static final XInt INT_WS_REPLACE      = fXIntPool.getXInt(XSSimpleType.WS_REPLACE);
     private static final XInt INT_WS_COLLAPSE     = fXIntPool.getXInt(XSSimpleType.WS_COLLAPSE);
+    private static final XInt INT_ET_OPTION       = fXIntPool.getXInt(XSSimpleType.ET_OPTIONAL);
+    private static final XInt INT_ET_REQUIRED     = fXIntPool.getXInt(XSSimpleType.ET_REQUIRED);
+    private static final XInt INT_ET_PROHIBITED   = fXIntPool.getXInt(XSSimpleType.ET_PROHIBITED);
     private static final XInt INT_UNBOUNDED       = fXIntPool.getXInt(SchemaSymbols.OCCURRENCE_UNBOUNDED);
     private static final XInt INT_MODE_NONE       = fXIntPool.getXInt(XSOpenContentDecl.MODE_NONE);
     private static final XInt INT_MODE_INTERLEAVE = fXIntPool.getXInt(XSOpenContentDecl.MODE_INTERLEAVE);
@@ -170,7 +173,7 @@
     // for 15 global elements
     private static final Hashtable fEleAttrs11MapG = new Hashtable(31);
     // for 47 local elements
-    private static final Hashtable fEleAttrs11MapL = new Hashtable(97);
+    private static final Hashtable fEleAttrs11MapL = new Hashtable(102);
 
     // used to initialize fEleAttrsMap
     // step 1: all possible data types
@@ -237,6 +240,7 @@
     protected static final int DT_MODE1            = -20;
     protected static final int DT_NOTNAMESPACE     = -21;
     protected static final int DT_NOTQNAME         = -22;
+    protected static final int DT_EXPLICITTIMEZONE = -24;
 
     static {
         // step 2: all possible attributes for all elements
@@ -302,6 +306,7 @@
         int ATT_NOTQNAME_N           = attCount++;
         int ATT_TEST_XPATH_R         = attCount++;
         int ATT_INHERITABLE_N        = attCount++;
+        int ATT_VALUE_ET_N           = attCount++;
 
         // step 3: store all these attributes in an array
         OneAttr[] allAttrs = new OneAttr[attCount];
@@ -543,6 +548,10 @@
                                                         DT_BOOLEAN,
                                                         ATTIDX_INHERITABLE,
                                                         Boolean.FALSE);
+        allAttrs[ATT_VALUE_ET_N]           = new OneAttr(SchemaSymbols.ATT_VALUE,
+                                                        DT_EXPLICITTIMEZONE,
+                                                        ATTIDX_VALUE,
+                                                        null);
 
         // step 4: for each element, make a list of possible attributes
         Container attrList;
@@ -1125,6 +1134,16 @@
         fEleAttrs11MapL.put(SchemaSymbols.ELT_MINEXCLUSIVE, attrList);
 
 
+        // for element "explicitTimezone" - local
+        attrList = Container.getContainer(3);
+        // id = ID
+        attrList.put(SchemaSymbols.ATT_ID, allAttrs[ATT_ID_N]);
+        // value = optional | required | prohibited
+        attrList.put(SchemaSymbols.ATT_VALUE, allAttrs[ATT_VALUE_ET_N]);
+        // fixed = boolean : false
+        attrList.put(SchemaSymbols.ATT_FIXED, allAttrs[ATT_FIXED_D]);        
+        // XML Schema 1.1 - same list
+        fEleAttrs11MapL.put(SchemaSymbols.ELT_EXPLICITTIMEZONE, attrList);
         // XML Schema 1.1
         // same components - modified representation
 
@@ -1541,7 +1560,7 @@
                                 attrValues[ATTIDX_SUBSGROUP] = new Vector();
                             }
                             if (fSchemaHandler.fSchemaVersion == Constants.SCHEMA_VERSION_1_1)
{
-                                StringTokenizer st = new StringTokenizer(attrVal, " ");
+                                StringTokenizer st = new StringTokenizer(attrVal, " \n\t\r");
                                 while (st.hasMoreTokens()) {
                                     Object avalue = dv.validate(st.nextToken(), schemaDoc.fValidationContext,
null);
                                     ((Vector)attrValues[ATTIDX_SUBSGROUP]).addElement(avalue);
@@ -2015,8 +2034,19 @@
                 }
             }
             break;
+        case DT_EXPLICITTIMEZONE:
+            // value = optional | required | prohibited
+            if (value.equals (SchemaSymbols.ATTVAL_OPTIONAL))
+                retValue = INT_ET_OPTION;
+            else if (value.equals (SchemaSymbols.ATTVAL_REQUIRED))
+                retValue = INT_ET_REQUIRED;
+            else if (value.equals (SchemaSymbols.ATTVAL_PROHIBITED))
+                retValue = INT_ET_PROHIBITED;
+            else
+                throw new InvalidDatatypeValueException("cvc-enumeration-valid",
+                                                        new Object[]{value, "(optional |
required | prohibited)"});
+            break;
         }
-
         return retValue;
     }
 

Modified: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/traversers/XSDAbstractTraverser.java
URL: http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/traversers/XSDAbstractTraverser.java?rev=886273&amp;r1=886272&amp;r2=886273&amp;view=diff
==============================================================================
--- xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/traversers/XSDAbstractTraverser.java
(original)
+++ xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/traversers/XSDAbstractTraverser.java
Wed Dec  2 19:18:54 2009
@@ -557,6 +557,9 @@
                 else if (facet.equals(SchemaSymbols.ELT_LENGTH)) {
                     currentFacet = XSSimpleType.FACET_LENGTH;
                 }
+                else if (facet.equals(SchemaSymbols.ELT_EXPLICITTIMEZONE)){
+                    currentFacet = XSSimpleType.FACET_EXPLICITTIMEZONE;
+                }
                 else {
                     break;   // a non-facet
                 }
@@ -623,6 +626,9 @@
                 case XSSimpleType.FACET_LENGTH:
                     xsFacets.length = ((XInt)attrs[XSAttributeChecker.ATTIDX_VALUE]).intValue();
                     break;
+                case XSSimpleType.FACET_EXPLICITTIMEZONE:
+                    xsFacets.explicitTimezone = ((XInt)attrs[XSAttributeChecker.ATTIDX_VALUE]).shortValue();
+                    break;
                 }
                 
                 Element child = DOMUtil.getFirstChildElement( content );
@@ -670,6 +676,9 @@
                 case XSSimpleType.FACET_LENGTH:
                     xsFacets.lengthAnnotation = annotation;
                 break;
+                case XSSimpleType.FACET_EXPLICITTIMEZONE:    //XML Schema 1.1
+                    xsFacets.explicitTimezoneAnnotation = annotation;
+                break;
                 }
                 if (child != null) {
                     reportSchemaError("s4s-elt-must-match.1", new Object[]{facet, "(annotation?)",
DOMUtil.getLocalName(child)}, child);



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



</pre>
</div>
</content>
</entry>
<entry>
<title>svn commit: r885928 - /xerces/java/branches/xml-schema-1.1-dev/src/org/apache/html/dom/HTMLDocumentImpl.java</title>
<author><name>mrglavas@apache.org</name></author>
<link rel="alternate" href="http://mail-archives.apache.org/mod_mbox/xerces-commits/200912.mbox/%3c20091201205615.C243923889DF@eris.apache.org%3e"/>
<id>urn:uuid:%3c20091201205615-C243923889DF@eris-apache-org%3e</id>
<updated>2009-12-01T20:56:15Z</updated>
<content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml">
<pre>
Author: mrglavas
Date: Tue Dec  1 20:56:15 2009
New Revision: 885928

URL: http://svn.apache.org/viewvc?rev=885928&amp;view=rev
Log:
Fixing JIRA Issue #1403: http://issues.apache.org/jira/browse/XERCESJ-1403. Should be throwing
the RuntimeException we create if there's some failure in class loading. Thanks to Ludger
Bünger for discovering this issue.

Modified:
    xerces/java/branches/xml-schema-1.1-dev/src/org/apache/html/dom/HTMLDocumentImpl.java

Modified: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/html/dom/HTMLDocumentImpl.java
URL: http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/html/dom/HTMLDocumentImpl.java?rev=885928&amp;r1=885927&amp;r2=885928&amp;view=diff
==============================================================================
--- xerces/java/branches/xml-schema-1.1-dev/src/org/apache/html/dom/HTMLDocumentImpl.java
(original)
+++ xerces/java/branches/xml-schema-1.1-dev/src/org/apache/html/dom/HTMLDocumentImpl.java
Tue Dec  1 20:56:15 2009
@@ -760,7 +760,7 @@
                 ObjectFactory.findProviderClass("org.apache.html.dom." + className,
                     HTMLDocumentImpl.class.getClassLoader(), true) );
         } catch ( Exception except ) {
-            new RuntimeException( "HTM019 OpenXML Error: Could not find or execute class
" + className + " implementing HTML element " + tagName
+            throw new RuntimeException( "HTM019 OpenXML Error: Could not find or execute
class " + className + " implementing HTML element " + tagName
                                   + "\n" + className + "\t" + tagName);
         }
     }



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



</pre>
</div>
</content>
</entry>
<entry>
<title>svn commit: r885927 - /xerces/java/trunk/src/org/apache/html/dom/HTMLDocumentImpl.java</title>
<author><name>mrglavas@apache.org</name></author>
<link rel="alternate" href="http://mail-archives.apache.org/mod_mbox/xerces-commits/200912.mbox/%3c20091201205558.122C623889B6@eris.apache.org%3e"/>
<id>urn:uuid:%3c20091201205558-122C623889B6@eris-apache-org%3e</id>
<updated>2009-12-01T20:55:57Z</updated>
<content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml">
<pre>
Author: mrglavas
Date: Tue Dec  1 20:55:57 2009
New Revision: 885927

URL: http://svn.apache.org/viewvc?rev=885927&amp;view=rev
Log:
Fixing JIRA Issue #1403: http://issues.apache.org/jira/browse/XERCESJ-1403. Should be throwing
the RuntimeException we create if there's some failure in class loading. Thanks to Ludger
Bünger for discovering this issue.

Modified:
    xerces/java/trunk/src/org/apache/html/dom/HTMLDocumentImpl.java

Modified: xerces/java/trunk/src/org/apache/html/dom/HTMLDocumentImpl.java
URL: http://svn.apache.org/viewvc/xerces/java/trunk/src/org/apache/html/dom/HTMLDocumentImpl.java?rev=885927&amp;r1=885926&amp;r2=885927&amp;view=diff
==============================================================================
--- xerces/java/trunk/src/org/apache/html/dom/HTMLDocumentImpl.java (original)
+++ xerces/java/trunk/src/org/apache/html/dom/HTMLDocumentImpl.java Tue Dec  1 20:55:57 2009
@@ -760,7 +760,7 @@
                 ObjectFactory.findProviderClass("org.apache.html.dom." + className,
                     HTMLDocumentImpl.class.getClassLoader(), true) );
         } catch ( Exception except ) {
-            new RuntimeException( "HTM019 OpenXML Error: Could not find or execute class
" + className + " implementing HTML element " + tagName
+            throw new RuntimeException( "HTM019 OpenXML Error: Could not find or execute
class " + className + " implementing HTML element " + tagName
                                   + "\n" + className + "\t" + tagName);
         }
     }



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



</pre>
</div>
</content>
</entry>
<entry>
<title>svn commit: r885821 - in /xerces/java/branches/xml-schema-1.1-dev: samples/simpletype/ samples/xni/ src/org/apache/xerces/impl/dv/xs/ src/org/apache/xerces/xs/</title>
<author><name>knoaman@apache.org</name></author>
<link rel="alternate" href="http://mail-archives.apache.org/mod_mbox/xerces-commits/200912.mbox/%3c20091201162411.2BEFD23888C2@eris.apache.org%3e"/>
<id>urn:uuid:%3c20091201162411-2BEFD23888C2@eris-apache-org%3e</id>
<updated>2009-12-01T16:24:10Z</updated>
<content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml">
<pre>
Author: knoaman
Date: Tue Dec  1 16:24:10 2009
New Revision: 885821

URL: http://svn.apache.org/viewvc?rev=885821&amp;view=rev
Log:
Revert back to using short for facets to maintain backward compatibility

Modified:
    xerces/java/branches/xml-schema-1.1-dev/samples/simpletype/SimpleTypeUsage.java
    xerces/java/branches/xml-schema-1.1-dev/samples/xni/PSVIWriter.java
    xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/XSSimpleTypeDecl.java
    xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/XSSimpleTypeDelegate.java
    xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/xs/XSFacet.java
    xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/xs/XSMultiValueFacet.java
    xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/xs/XSSimpleTypeDefinition.java

Modified: xerces/java/branches/xml-schema-1.1-dev/samples/simpletype/SimpleTypeUsage.java
URL: http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/samples/simpletype/SimpleTypeUsage.java?rev=885821&amp;r1=885820&amp;r2=885821&amp;view=diff
==============================================================================
--- xerces/java/branches/xml-schema-1.1-dev/samples/simpletype/SimpleTypeUsage.java (original)
+++ xerces/java/branches/xml-schema-1.1-dev/samples/simpletype/SimpleTypeUsage.java Tue Dec
 1 16:24:10 2009
@@ -191,7 +191,7 @@
 
     // 'facets' property
     // gives bit combination of the constants defined in XSSimpleType interface.
-    int facets = simpleType.getDefinedFacets() ;
+    short facets = simpleType.getDefinedFacets() ;
     printFacets(facets);
 
     //'final' property
@@ -270,7 +270,7 @@
 
 }//printCardinality()
 
-void printFacets(int facets){
+void printFacets(short facets){
 
     System.err.println("'facets' present \t\t: " );
 

Modified: xerces/java/branches/xml-schema-1.1-dev/samples/xni/PSVIWriter.java
URL: http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/samples/xni/PSVIWriter.java?rev=885821&amp;r1=885820&amp;r2=885821&amp;view=diff
==============================================================================
--- xerces/java/branches/xml-schema-1.1-dev/samples/xni/PSVIWriter.java (original)
+++ xerces/java/branches/xml-schema-1.1-dev/samples/xni/PSVIWriter.java Tue Dec  1 16:24:10
2009
@@ -2118,7 +2118,7 @@
         }
     }
 
-    private String translateFacetKind(int kind) {
+    private String translateFacetKind(short kind) {
         switch (kind) {
             case XSSimpleTypeDefinition.FACET_WHITESPACE :
                 return SchemaSymbols.ELT_WHITESPACE;

Modified: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/XSSimpleTypeDecl.java
URL: http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/XSSimpleTypeDecl.java?rev=885821&amp;r1=885820&amp;r2=885821&amp;view=diff
==============================================================================
--- xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/XSSimpleTypeDecl.java
(original)
+++ xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/XSSimpleTypeDecl.java
Tue Dec  1 16:24:10 2009
@@ -263,8 +263,8 @@
     private short fVariety = -1;
     private short fValidationDV = -1;
 
-    private int fFacetsDefined = 0;
-    private int fFixedFacet = 0;
+    private short fFacetsDefined = 0;
+    private short fFixedFacet = 0;
 
     //for constraining facets
     private short fWhiteSpace = 0;
@@ -2161,7 +2161,7 @@
      * @param facetName  The name of the facet.
      * @return  True if the facet is defined, false otherwise.
      */
-    public boolean isDefinedFacet(int facetName) {
+    public boolean isDefinedFacet(short facetName) {
         if ((fFacetsDefined &amp; facetName) != 0)
             return true;
         if (fPatternType != SPECIAL_PATTERN_NONE)
@@ -2175,11 +2175,11 @@
      * [facets]: all facets defined on this type. The value is a bit
      * combination of FACET_XXX constants of all defined facets.
      */
-    public int getDefinedFacets() {
+    public short getDefinedFacets() {
         if (fPatternType != SPECIAL_PATTERN_NONE)
-            return fFacetsDefined | FACET_PATTERN;
+            return (short)(fFacetsDefined | FACET_PATTERN);
         if (fValidationDV == DV_INTEGER)
-            return fFacetsDefined | FACET_PATTERN | FACET_FRACTIONDIGITS;
+            return (short)(fFacetsDefined | FACET_PATTERN | FACET_FRACTIONDIGITS);
         return fFacetsDefined;
     }
 
@@ -2189,7 +2189,7 @@
      * @param facetName  The name of the facet.
      * @return  True if the facet is fixed, false otherwise.
      */
-    public boolean isFixedFacet(int facetName) {
+    public boolean isFixedFacet(short facetName) {
         if ((fFixedFacet &amp; facetName) != 0)
             return true;
         if (fValidationDV == DV_INTEGER)
@@ -2200,9 +2200,9 @@
     /**
      * [facets]: all defined facets for this type which are fixed.
      */
-    public int getFixedFacets() {
+    public short getFixedFacets() {
         if (fValidationDV == DV_INTEGER)
-            return fFixedFacet | FACET_FRACTIONDIGITS;
+            return (short)(fFixedFacet | FACET_FRACTIONDIGITS);
         return fFixedFacet;
     }
 
@@ -2218,7 +2218,7 @@
      * @return A value of the facet specified in &lt;code&gt;facetName&lt;/code&gt; for
      *   this simple type definition or &lt;code&gt;null&lt;/code&gt;.
      */
-    public String getLexicalFacetValue(int facetName) {
+    public String getLexicalFacetValue(short facetName) {
         switch (facetName) {
             case FACET_LENGTH:
                 return (fLength == -1)?null:Integer.toString(fLength);
@@ -3246,12 +3246,12 @@
     }
 
     private static final class XSFacetImpl implements XSFacet {
-        final int kind;
+        final short kind;
         final String value;
         final boolean fixed;
         final XSObjectList annotations;  
 
-        public XSFacetImpl(int kind, String value, boolean fixed, XSAnnotation annotation)
{
+        public XSFacetImpl(short kind, String value, boolean fixed, XSAnnotation annotation)
{
             this.kind = kind;
             this.value = value;
             this.fixed = fixed;
@@ -3292,7 +3292,7 @@
         /* (non-Javadoc)
          * @see org.apache.xerces.xs.XSFacet#getFacetKind()
          */
-        public int getFacetKind() {
+        public short getFacetKind() {
             return kind;
         }
 
@@ -3342,12 +3342,12 @@
     }
 
     private static final class XSMVFacetImpl implements XSMultiValueFacet {
-        final int kind;
+        final short kind;
         final XSObjectList annotations;
         final StringList values;
         final Vector asserts;
 
-        public XSMVFacetImpl(int kind, StringList values, XSObjectList annotations) {
+        public XSMVFacetImpl(short kind, StringList values, XSObjectList annotations) {
             this.kind = kind;
             this.values = values;
             this.annotations = (annotations != null) ? annotations : XSObjectListImpl.EMPTY_LIST;
@@ -3356,7 +3356,7 @@
         /*
          * overloaded constructor. added to support assertions.
          */
-        public XSMVFacetImpl(int kind, Vector asserts) {
+        public XSMVFacetImpl(short kind, Vector asserts) {
             this.kind = kind;
             this.asserts = asserts;
             this.values = null;
@@ -3366,7 +3366,7 @@
         /* (non-Javadoc)
          * @see org.apache.xerces.xs.XSFacet#getFacetKind()
          */
-        public int getFacetKind() {
+        public short getFacetKind() {
             return kind;
         }	
 

Modified: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/XSSimpleTypeDelegate.java
URL: http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/XSSimpleTypeDelegate.java?rev=885821&amp;r1=885820&amp;r2=885821&amp;view=diff
==============================================================================
--- xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/XSSimpleTypeDelegate.java
(original)
+++ xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/XSSimpleTypeDelegate.java
Tue Dec  1 16:24:10 2009
@@ -61,7 +61,7 @@
         return type.getBuiltInKind();
     }
 
-    public int getDefinedFacets() {
+    public short getDefinedFacets() {
         return type.getDefinedFacets();
     }
 
@@ -73,7 +73,7 @@
         return type.getFinite();
     }
 
-    public int getFixedFacets() {
+    public short getFixedFacets() {
         return type.getFixedFacets();
     }
 
@@ -85,7 +85,7 @@
         return type.getLexicalEnumeration();
     }
 
-    public String getLexicalFacetValue(int facetName) {
+    public String getLexicalFacetValue(short facetName) {
         return type.getLexicalFacetValue(facetName);
     }
 
@@ -117,11 +117,11 @@
         return type.getVariety();
     }
 
-    public boolean isDefinedFacet(int facetName) {
+    public boolean isDefinedFacet(short facetName) {
         return type.isDefinedFacet(facetName);
     }
 
-    public boolean isFixedFacet(int facetName) {
+    public boolean isFixedFacet(short facetName) {
         return type.isFixedFacet(facetName);
     }
 

Modified: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/xs/XSFacet.java
URL: http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/xs/XSFacet.java?rev=885821&amp;r1=885820&amp;r2=885821&amp;view=diff
==============================================================================
--- xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/xs/XSFacet.java (original)
+++ xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/xs/XSFacet.java Tue Dec
 1 16:24:10 2009
@@ -26,7 +26,7 @@
      * The name of the facet, e.g. &lt;code&gt;FACET_LENGTH, FACET_TOTALDIGITS&lt;/code&gt;
      *  (see &lt;code&gt;XSSimpleTypeDefinition&lt;/code&gt;). 
      */
-    public int getFacetKind();
+    public short getFacetKind();
 
     /**
      * A value of this facet. 

Modified: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/xs/XSMultiValueFacet.java
URL: http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/xs/XSMultiValueFacet.java?rev=885821&amp;r1=885820&amp;r2=885821&amp;view=diff
==============================================================================
--- xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/xs/XSMultiValueFacet.java
(original)
+++ xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/xs/XSMultiValueFacet.java
Tue Dec  1 16:24:10 2009
@@ -27,7 +27,7 @@
      * The name of the facet, i.e. &lt;code&gt;FACET_ENUMERATION&lt;/code&gt; and 
      * &lt;code&gt;FACET_PATTERN&lt;/code&gt; (see &lt;code&gt;XSSimpleTypeDefinition&lt;/code&gt;).

      */
-    public int getFacetKind();
+    public short getFacetKind();
 
     /**
      * Values of this facet. 

Modified: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/xs/XSSimpleTypeDefinition.java
URL: http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/xs/XSSimpleTypeDefinition.java?rev=885821&amp;r1=885820&amp;r2=885821&amp;view=diff
==============================================================================
--- xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/xs/XSSimpleTypeDefinition.java
(original)
+++ xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/xs/XSSimpleTypeDefinition.java
Tue Dec  1 16:24:10 2009
@@ -48,75 +48,75 @@
     /**
      * No facets defined.
      */
-    public static final int FACET_NONE                  = 0;
+    public static final short FACET_NONE                = 0;
     /**
      * 4.3.1 Length
      */
-    public static final int FACET_LENGTH                = 1;
+    public static final short FACET_LENGTH              = 1;
     /**
      * 4.3.2 minLength. 
      */
-    public static final int FACET_MINLENGTH             = 2;
+    public static final short FACET_MINLENGTH           = 2;
     /**
      * 4.3.3 maxLength.
      */
-    public static final int FACET_MAXLENGTH             = 4;
+    public static final short FACET_MAXLENGTH           = 4;
     /**
      * 4.3.4 pattern.
      */
-    public static final int FACET_PATTERN               = 8;
+    public static final short FACET_PATTERN             = 8;
     /**
      * 4.3.6 whitespace.
      */
-    public static final int FACET_WHITESPACE            = 16;
+    public static final short FACET_WHITESPACE          = 16;
     /**
      * 4.3.7 maxInclusive.
      */
-    public static final int FACET_MAXINCLUSIVE          = 32;
+    public static final short FACET_MAXINCLUSIVE        = 32;
     /**
      * 4.3.9 maxExclusive.
      */
-    public static final int FACET_MAXEXCLUSIVE          = 64;
+    public static final short FACET_MAXEXCLUSIVE        = 64;
     /**
      * 4.3.9 minExclusive.
      */
-    public static final int FACET_MINEXCLUSIVE          = 128;
+    public static final short FACET_MINEXCLUSIVE        = 128;
     /**
      * 4.3.10 minInclusive.
      */
-    public static final int FACET_MININCLUSIVE          = 256;
+    public static final short FACET_MININCLUSIVE        = 256;
     /**
      * 4.3.11 totalDigits .
      */
-    public static final int FACET_TOTALDIGITS           = 512;
+    public static final short FACET_TOTALDIGITS         = 512;
     /**
      * 4.3.12 fractionDigits.
      */
-    public static final int FACET_FRACTIONDIGITS        = 1024;
+    public static final short FACET_FRACTIONDIGITS      = 1024;
     /**
      * 4.3.5 enumeration.
      */
-    public static final int FACET_ENUMERATION           = 2048;
+    public static final short FACET_ENUMERATION         = 2048;
     
     /**
      * 4.3.13 maxScale (XML Schema 1.1)
      */
-    public static final int FACET_MAXSCALE              = 4096;         
+    public static final short FACET_MAXSCALE            = 4096;         
 
     /**
      * 4.3.14 minScale (XML Schema 1.1)
      */
-    public static final int FACET_MINSCALE              = 8192;
+    public static final short FACET_MINSCALE            = 8192;
 
     /**
      * 4.3.15 assert (XML Schema 1.1)
      */
-    public static final int FACET_ASSERT                = 16384;
+    public static final short FACET_ASSERT              = 16384;
 
     /**
      * 4.3.16 explicitTimeZone (XML Schema 1.1)
      */
-    public static final int FACET_EXPLICITTIMEZONE      = 32768;
+    public static final short FACET_EXPLICITTIMEZONE    = -32768;
 
     /**
      * A constant defined for the 'ordered' fundamental facet: not ordered.
@@ -168,7 +168,7 @@
      * [facets]: all facets defined on this type. The value is a bit 
      * combination of FACET_XXX constants of all defined facets. 
      */
-    public int getDefinedFacets();
+    public short getDefinedFacets();
 
     /**
      * Convenience method. [Facets]: check whether a facet is defined on this 
@@ -176,12 +176,12 @@
      * @param facetName  The name of the facet. 
      * @return  True if the facet is defined, false otherwise.
      */
-    public boolean isDefinedFacet(int facetName);
+    public boolean isDefinedFacet(short facetName);
 
     /**
      * [facets]: all defined facets for this type which are fixed.
      */
-    public int getFixedFacets();
+    public short getFixedFacets();
 
     /**
      * Convenience method. [Facets]: check whether a facet is defined and 
@@ -189,7 +189,7 @@
      * @param facetName  The name of the facet. 
      * @return  True if the facet is fixed, false otherwise.
      */
-    public boolean isFixedFacet(int facetName);
+    public boolean isFixedFacet(short facetName);
 
     /**
      * Convenience method. Returns a value of a single constraining facet for 
@@ -203,7 +203,7 @@
      * @return A value of the facet specified in &lt;code&gt;facetName&lt;/code&gt; for 
      *   this simple type definition or &lt;code&gt;null&lt;/code&gt;. 
      */
-    public String getLexicalFacetValue(int facetName);
+    public String getLexicalFacetValue(short facetName);
 
     /**
      * A list of enumeration values if it exists, otherwise an empty 



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



</pre>
</div>
</content>
</entry>
<entry>
<title>svn commit: r885800 - in /xerces/java/branches/xml-schema-1.1-dev: samples/simpletype/ samples/xni/ src/org/apache/xerces/impl/dv/ src/org/apache/xerces/impl/dv/xs/ src/org/apache/xerces/impl/validation/ src/org/apache/xerces/impl/xs/ src/org/apache/xe...</title>
<author><name>knoaman@apache.org</name></author>
<link rel="alternate" href="http://mail-archives.apache.org/mod_mbox/xerces-commits/200912.mbox/%3c20091201153732.8174F23888FE@eris.apache.org%3e"/>
<id>urn:uuid:%3c20091201153732-8174F23888FE@eris-apache-org%3e</id>
<updated>2009-12-01T15:37:30Z</updated>
<content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml">
<pre>
Author: knoaman
Date: Tue Dec  1 15:37:29 2009
New Revision: 885800

URL: http://svn.apache.org/viewvc?rev=885800&amp;view=rev
Log:
Define additional 1.1 facets and move inquiry of allowed facets to a type validator helper to differentiate between 1.0 types vs. 1.1 types.

Added:
    xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/TypeValidatorHelper.java   (with props)
Modified:
    xerces/java/branches/xml-schema-1.1-dev/samples/simpletype/SimpleTypeUsage.java
    xerces/java/branches/xml-schema-1.1-dev/samples/xni/PSVIWriter.java
    xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/ValidationContext.java
    xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/XSSimpleType.java
    xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/AbstractDateTimeDV.java
    xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/AnyAtomicDV.java
    xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/AnySimpleDV.java
    xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/AnyURIDV.java
    xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/Base64BinaryDV.java
    xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/BooleanDV.java
    xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/DecimalDV.java
    xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/DoubleDV.java
    xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/EntityDV.java
    xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/ErrorDV.java
    xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/FloatDV.java
    xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/HexBinaryDV.java
    xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/IDDV.java
    xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/IDREFDV.java
    xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/ListDV.java
    xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/PrecisionDecimalDV.java
    xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/QNameDV.java
    xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/StringDV.java
    xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/TypeValidator.java
    xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/UnionDV.java
    xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/XSSimpleTypeDecl.java
    xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/XSSimpleTypeDelegate.java
    xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/validation/ValidationState.java
    xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/XMLSchemaValidator.java
    xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/traversers/XSDAbstractTraverser.java
    xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/traversers/XSDHandler.java
    xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/traversers/XSDocumentInfo.java
    xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/xs/XSFacet.java
    xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/xs/XSMultiValueFacet.java
    xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/xs/XSSimpleTypeDefinition.java

Modified: xerces/java/branches/xml-schema-1.1-dev/samples/simpletype/SimpleTypeUsage.java
URL: http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/samples/simpletype/SimpleTypeUsage.java?rev=885800&amp;r1=885799&amp;r2=885800&amp;view=diff
==============================================================================
--- xerces/java/branches/xml-schema-1.1-dev/samples/simpletype/SimpleTypeUsage.java (original)
+++ xerces/java/branches/xml-schema-1.1-dev/samples/simpletype/SimpleTypeUsage.java Tue Dec  1 15:37:29 2009
@@ -191,7 +191,7 @@
 
     // 'facets' property
     // gives bit combination of the constants defined in XSSimpleType interface.
-    short facets = simpleType.getDefinedFacets() ;
+    int facets = simpleType.getDefinedFacets() ;
     printFacets(facets);
 
     //'final' property
@@ -270,7 +270,7 @@
 
 }//printCardinality()
 
-void printFacets(short facets){
+void printFacets(int facets){
 
     System.err.println("'facets' present \t\t: " );
 

Modified: xerces/java/branches/xml-schema-1.1-dev/samples/xni/PSVIWriter.java
URL: http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/samples/xni/PSVIWriter.java?rev=885800&amp;r1=885799&amp;r2=885800&amp;view=diff
==============================================================================
--- xerces/java/branches/xml-schema-1.1-dev/samples/xni/PSVIWriter.java (original)
+++ xerces/java/branches/xml-schema-1.1-dev/samples/xni/PSVIWriter.java Tue Dec  1 15:37:29 2009
@@ -2118,7 +2118,7 @@
         }
     }
 
-    private String translateFacetKind(short kind) {
+    private String translateFacetKind(int kind) {
         switch (kind) {
             case XSSimpleTypeDefinition.FACET_WHITESPACE :
                 return SchemaSymbols.ELT_WHITESPACE;

Modified: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/ValidationContext.java
URL: http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/ValidationContext.java?rev=885800&amp;r1=885799&amp;r2=885800&amp;view=diff
==============================================================================
--- xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/ValidationContext.java (original)
+++ xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/ValidationContext.java Tue Dec  1 15:37:29 2009
@@ -19,6 +19,8 @@
 
 import java.util.Locale;
 
+import org.apache.xerces.impl.dv.xs.TypeValidatorHelper;
+
 /**
  * ValidationContext has all the information required for the
  * validation of: id, idref, entity, notation, qname
@@ -60,4 +62,7 @@
     
     // Locale
     public Locale getLocale();
+    
+    // TypeValidatorHelper
+    public TypeValidatorHelper getTypeValidatorHelper();
 }

Modified: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/XSSimpleType.java
URL: http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/XSSimpleType.java?rev=885800&amp;r1=885799&amp;r2=885800&amp;view=diff
==============================================================================
--- xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/XSSimpleType.java (original)
+++ xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/XSSimpleType.java Tue Dec  1 15:37:29 2009
@@ -151,7 +151,7 @@
      * @param context       the validation context
      * @exception InvalidDatatypeFacetException  exception for invalid facet values.
      */
-    public void applyFacets(XSFacets facets, short presentFacet, short fixedFacet, ValidationContext context)
+    public void applyFacets(XSFacets facets, int presentFacet, int fixedFacet, ValidationContext context)
         throws InvalidDatatypeFacetException;
 
     /**

Modified: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/AbstractDateTimeDV.java
URL: http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/AbstractDateTimeDV.java?rev=885800&amp;r1=885799&amp;r2=885800&amp;view=diff
==============================================================================
--- xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/AbstractDateTimeDV.java (original)
+++ xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/AbstractDateTimeDV.java Tue Dec  1 15:37:29 2009
@@ -62,10 +62,6 @@
     
     protected final DatatypeFactory factory = new DatatypeFactoryImpl();
 	
-	public short getAllowedFacets(){
-		return ( XSSimpleTypeDecl.FACET_PATTERN | XSSimpleTypeDecl.FACET_WHITESPACE | XSSimpleTypeDecl.FACET_ENUMERATION |XSSimpleTypeDecl.FACET_MAXINCLUSIVE |XSSimpleTypeDecl.FACET_MININCLUSIVE | XSSimpleTypeDecl.FACET_MAXEXCLUSIVE  | XSSimpleTypeDecl.FACET_MINEXCLUSIVE  );
-	}//getAllowedFacets()
-	
 	
 	// distinguishes between identity and equality for date/time values
 	// ie: two values representing the same "moment in time" but with different 

Modified: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/AnyAtomicDV.java
URL: http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/AnyAtomicDV.java?rev=885800&amp;r1=885799&amp;r2=885800&amp;view=diff
==============================================================================
--- xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/AnyAtomicDV.java (original)
+++ xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/AnyAtomicDV.java Tue Dec  1 15:37:29 2009
@@ -30,11 +30,7 @@
  * @version $Id$
  */
 class AnyAtomicDV extends TypeValidator {
-    
-    public short getAllowedFacets() {
-        return 0;
-    }
-    
+
     public Object getActualValue(String content, ValidationContext context) throws InvalidDatatypeValueException {
         return content;
     }

Modified: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/AnySimpleDV.java
URL: http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/AnySimpleDV.java?rev=885800&amp;r1=885799&amp;r2=885800&amp;view=diff
==============================================================================
--- xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/AnySimpleDV.java (original)
+++ xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/AnySimpleDV.java Tue Dec  1 15:37:29 2009
@@ -32,11 +32,6 @@
  */
 public class AnySimpleDV extends TypeValidator {
 
-    public short getAllowedFacets() {
-        // anySimpleType doesn't allow any facet, not even whiteSpace
-        return 0;
-    }
-
     public Object getActualValue(String content, ValidationContext context) throws InvalidDatatypeValueException {
         return content;
     }

Modified: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/AnyURIDV.java
URL: http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/AnyURIDV.java?rev=885800&amp;r1=885799&amp;r2=885800&amp;view=diff
==============================================================================
--- xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/AnyURIDV.java (original)
+++ xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/AnyURIDV.java Tue Dec  1 15:37:29 2009
@@ -43,10 +43,6 @@
         BASE_URI = uri;
     }
 
-    public short getAllowedFacets(){
-        return (XSSimpleTypeDecl.FACET_LENGTH | XSSimpleTypeDecl.FACET_MINLENGTH | XSSimpleTypeDecl.FACET_MAXLENGTH | XSSimpleTypeDecl.FACET_PATTERN | XSSimpleTypeDecl.FACET_ENUMERATION | XSSimpleTypeDecl.FACET_WHITESPACE );
-    }
-
     // before we return string we have to make sure it is correct URI as per spec.
     // for some types (string and derived), they just return the string itself
     public Object getActualValue(String content, ValidationContext context) throws InvalidDatatypeValueException {

Modified: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/Base64BinaryDV.java
URL: http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/Base64BinaryDV.java?rev=885800&amp;r1=885799&amp;r2=885800&amp;view=diff
==============================================================================
--- xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/Base64BinaryDV.java (original)
+++ xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/Base64BinaryDV.java Tue Dec  1 15:37:29 2009
@@ -34,10 +34,6 @@
  */
 public class Base64BinaryDV extends TypeValidator {
 
-    public short getAllowedFacets(){
-        return (XSSimpleTypeDecl.FACET_LENGTH | XSSimpleTypeDecl.FACET_MINLENGTH | XSSimpleTypeDecl.FACET_MAXLENGTH | XSSimpleTypeDecl.FACET_PATTERN | XSSimpleTypeDecl.FACET_ENUMERATION | XSSimpleTypeDecl.FACET_WHITESPACE );
-    }
-
     public Object getActualValue(String content, ValidationContext context) throws InvalidDatatypeValueException {
         byte[] decoded = Base64.decode(content);
         if (decoded == null)

Modified: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/BooleanDV.java
URL: http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/BooleanDV.java?rev=885800&amp;r1=885799&amp;r2=885800&amp;view=diff
==============================================================================
--- xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/BooleanDV.java (original)
+++ xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/BooleanDV.java Tue Dec  1 15:37:29 2009
@@ -32,10 +32,6 @@
  */
 public class BooleanDV extends TypeValidator {
 
-    public short getAllowedFacets() {
-        return (XSSimpleTypeDecl.FACET_PATTERN | XSSimpleTypeDecl.FACET_WHITESPACE);
-    }
-
     public Object getActualValue(String content, ValidationContext context) throws InvalidDatatypeValueException {
         if ("false".equals(content) || "0".equals(content)) {
             return Boolean.FALSE;

Modified: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/DecimalDV.java
URL: http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/DecimalDV.java?rev=885800&amp;r1=885799&amp;r2=885800&amp;view=diff
==============================================================================
--- xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/DecimalDV.java (original)
+++ xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/DecimalDV.java Tue Dec  1 15:37:29 2009
@@ -36,10 +36,6 @@
  */
 public class DecimalDV extends TypeValidator {
 
-    public final short getAllowedFacets(){
-        return ( XSSimpleTypeDecl.FACET_PATTERN | XSSimpleTypeDecl.FACET_WHITESPACE | XSSimpleTypeDecl.FACET_ENUMERATION |XSSimpleTypeDecl.FACET_MAXINCLUSIVE |XSSimpleTypeDecl.FACET_MININCLUSIVE | XSSimpleTypeDecl.FACET_MAXEXCLUSIVE  | XSSimpleTypeDecl.FACET_MINEXCLUSIVE | XSSimpleTypeDecl.FACET_TOTALDIGITS | XSSimpleTypeDecl.FACET_FRACTIONDIGITS);
-    }
-
     public Object getActualValue(String content, ValidationContext context) throws InvalidDatatypeValueException {
         try {
             return new XDecimal(content);

Modified: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/DoubleDV.java
URL: http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/DoubleDV.java?rev=885800&amp;r1=885799&amp;r2=885800&amp;view=diff
==============================================================================
--- xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/DoubleDV.java (original)
+++ xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/DoubleDV.java Tue Dec  1 15:37:29 2009
@@ -33,10 +33,6 @@
  */
 public class DoubleDV extends TypeValidator {
 
-    public short getAllowedFacets(){
-        return ( XSSimpleTypeDecl.FACET_PATTERN | XSSimpleTypeDecl.FACET_WHITESPACE | XSSimpleTypeDecl.FACET_ENUMERATION |XSSimpleTypeDecl.FACET_MAXINCLUSIVE |XSSimpleTypeDecl.FACET_MININCLUSIVE | XSSimpleTypeDecl.FACET_MAXEXCLUSIVE  | XSSimpleTypeDecl.FACET_MINEXCLUSIVE  );
-    }//getAllowedFacets()
-
     //convert a String to Double form, we have to take care of cases specified in spec like INF, -INF and NaN
     public Object getActualValue(String content, ValidationContext context) throws InvalidDatatypeValueException {
         try{

Modified: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/EntityDV.java
URL: http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/EntityDV.java?rev=885800&amp;r1=885799&amp;r2=885800&amp;view=diff
==============================================================================
--- xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/EntityDV.java (original)
+++ xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/EntityDV.java Tue Dec  1 15:37:29 2009
@@ -33,10 +33,6 @@
  */
 public class EntityDV extends TypeValidator {
 
-    public short getAllowedFacets(){
-        return (XSSimpleTypeDecl.FACET_LENGTH | XSSimpleTypeDecl.FACET_MINLENGTH | XSSimpleTypeDecl.FACET_MAXLENGTH | XSSimpleTypeDecl.FACET_PATTERN | XSSimpleTypeDecl.FACET_ENUMERATION | XSSimpleTypeDecl.FACET_WHITESPACE );
-    }
-
     public Object getActualValue(String content, ValidationContext context) throws InvalidDatatypeValueException {
         if (!XMLChar.isValidNCName(content)) {
             throw new InvalidDatatypeValueException("cvc-datatype-valid.1.2.1", new Object[]{content, "NCName"});

Modified: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/ErrorDV.java
URL: http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/ErrorDV.java?rev=885800&amp;r1=885799&amp;r2=885800&amp;view=diff
==============================================================================
--- xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/ErrorDV.java (original)
+++ xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/ErrorDV.java Tue Dec  1 15:37:29 2009
@@ -31,10 +31,6 @@
  */
 public class ErrorDV extends TypeValidator {
 
-    public short getAllowedFacets() {
-        return XSSimpleTypeDecl.FACET_NONE;
-    }
-
     public Object getActualValue(String content, ValidationContext context) throws InvalidDatatypeValueException {
         throw new InvalidDatatypeValueException("cvc-datatype-valid.1.2.1", new Object[]{content, "error"});
     }

Modified: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/FloatDV.java
URL: http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/FloatDV.java?rev=885800&amp;r1=885799&amp;r2=885800&amp;view=diff
==============================================================================
--- xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/FloatDV.java (original)
+++ xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/FloatDV.java Tue Dec  1 15:37:29 2009
@@ -33,10 +33,6 @@
  */
 public class FloatDV extends TypeValidator {
 
-    public short getAllowedFacets(){
-        return ( XSSimpleTypeDecl.FACET_PATTERN | XSSimpleTypeDecl.FACET_WHITESPACE | XSSimpleTypeDecl.FACET_ENUMERATION |XSSimpleTypeDecl.FACET_MAXINCLUSIVE |XSSimpleTypeDecl.FACET_MININCLUSIVE | XSSimpleTypeDecl.FACET_MAXEXCLUSIVE  | XSSimpleTypeDecl.FACET_MINEXCLUSIVE  );
-    }//getAllowedFacets()
-
     //convert a String to Float form, we have to take care of cases specified in spec like INF, -INF and NaN
     public Object getActualValue(String content, ValidationContext context) throws InvalidDatatypeValueException {
         try{

Modified: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/HexBinaryDV.java
URL: http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/HexBinaryDV.java?rev=885800&amp;r1=885799&amp;r2=885800&amp;view=diff
==============================================================================
--- xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/HexBinaryDV.java (original)
+++ xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/HexBinaryDV.java Tue Dec  1 15:37:29 2009
@@ -34,10 +34,6 @@
  */
 public class HexBinaryDV extends TypeValidator {
 
-    public short getAllowedFacets(){
-        return (XSSimpleTypeDecl.FACET_LENGTH | XSSimpleTypeDecl.FACET_MINLENGTH | XSSimpleTypeDecl.FACET_MAXLENGTH | XSSimpleTypeDecl.FACET_PATTERN | XSSimpleTypeDecl.FACET_ENUMERATION | XSSimpleTypeDecl.FACET_WHITESPACE );
-    }
-
     public Object getActualValue(String content, ValidationContext context) throws InvalidDatatypeValueException {
         byte[] decoded = HexBin.decode(content);
         if (decoded == null)

Modified: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/IDDV.java
URL: http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/IDDV.java?rev=885800&amp;r1=885799&amp;r2=885800&amp;view=diff
==============================================================================
--- xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/IDDV.java (original)
+++ xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/IDDV.java Tue Dec  1 15:37:29 2009
@@ -33,10 +33,6 @@
  */
 public class IDDV extends TypeValidator{
 
-    public short getAllowedFacets(){
-        return (XSSimpleTypeDecl.FACET_LENGTH | XSSimpleTypeDecl.FACET_MINLENGTH | XSSimpleTypeDecl.FACET_MAXLENGTH | XSSimpleTypeDecl.FACET_PATTERN | XSSimpleTypeDecl.FACET_ENUMERATION | XSSimpleTypeDecl.FACET_WHITESPACE );
-    }
-
     public Object getActualValue(String content, ValidationContext context) throws InvalidDatatypeValueException {
         if (!XMLChar.isValidNCName(content)) {
             throw new InvalidDatatypeValueException("cvc-datatype-valid.1.2.1", new Object[]{content, "NCName"});

Modified: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/IDREFDV.java
URL: http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/IDREFDV.java?rev=885800&amp;r1=885799&amp;r2=885800&amp;view=diff
==============================================================================
--- xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/IDREFDV.java (original)
+++ xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/IDREFDV.java Tue Dec  1 15:37:29 2009
@@ -33,10 +33,6 @@
  */
 public class IDREFDV extends TypeValidator{
 
-    public short getAllowedFacets(){
-        return (XSSimpleTypeDecl.FACET_LENGTH | XSSimpleTypeDecl.FACET_MINLENGTH | XSSimpleTypeDecl.FACET_MAXLENGTH | XSSimpleTypeDecl.FACET_PATTERN | XSSimpleTypeDecl.FACET_ENUMERATION | XSSimpleTypeDecl.FACET_WHITESPACE );
-    }
-
     public Object getActualValue(String content, ValidationContext context) throws InvalidDatatypeValueException {
         if (!XMLChar.isValidNCName(content)) {
             throw new InvalidDatatypeValueException("cvc-datatype-valid.1.2.1", new Object[]{content, "NCName"});

Modified: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/ListDV.java
URL: http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/ListDV.java?rev=885800&amp;r1=885799&amp;r2=885800&amp;view=diff
==============================================================================
--- xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/ListDV.java (original)
+++ xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/ListDV.java Tue Dec  1 15:37:29 2009
@@ -35,10 +35,6 @@
  */
 public class ListDV extends TypeValidator{
 
-    public short getAllowedFacets(){
-          return (XSSimpleTypeDecl.FACET_LENGTH | XSSimpleTypeDecl.FACET_MINLENGTH | XSSimpleTypeDecl.FACET_MAXLENGTH | XSSimpleTypeDecl.FACET_PATTERN | XSSimpleTypeDecl.FACET_ENUMERATION | XSSimpleTypeDecl.FACET_WHITESPACE );
-    }
-
     // this method should never be called: XSSimpleTypeDecl is responsible for
     // calling the item type for the convertion
     public Object getActualValue(String content, ValidationContext context) throws InvalidDatatypeValueException{

Modified: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/PrecisionDecimalDV.java
URL: http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/PrecisionDecimalDV.java?rev=885800&amp;r1=885799&amp;r2=885800&amp;view=diff
==============================================================================
--- xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/PrecisionDecimalDV.java (original)
+++ xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/PrecisionDecimalDV.java Tue Dec  1 15:37:29 2009
@@ -322,13 +322,6 @@
         
     }
     /* (non-Javadoc)
-     * @see org.apache.xerces.impl.dv.xs.TypeValidator#getAllowedFacets()
-     */
-    public short getAllowedFacets() {
-        return ( XSSimpleTypeDecl.FACET_PATTERN | XSSimpleTypeDecl.FACET_WHITESPACE | XSSimpleTypeDecl.FACET_ENUMERATION |XSSimpleTypeDecl.FACET_MAXINCLUSIVE |XSSimpleTypeDecl.FACET_MININCLUSIVE | XSSimpleTypeDecl.FACET_MAXEXCLUSIVE  | XSSimpleTypeDecl.FACET_MINEXCLUSIVE | XSSimpleTypeDecl.FACET_TOTALDIGITS | XSSimpleTypeDecl.FACET_FRACTIONDIGITS);
-    }
-    
-    /* (non-Javadoc)
      * @see org.apache.xerces.impl.dv.xs.TypeValidator#getActualValue(java.lang.String, org.apache.xerces.impl.dv.ValidationContext)
      */
     public Object getActualValue(String content, ValidationContext context)

Modified: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/QNameDV.java
URL: http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/QNameDV.java?rev=885800&amp;r1=885799&amp;r2=885800&amp;view=diff
==============================================================================
--- xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/QNameDV.java (original)
+++ xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/QNameDV.java Tue Dec  1 15:37:29 2009
@@ -37,10 +37,6 @@
 
     private static final String EMPTY_STRING = "".intern();
 
-    public short getAllowedFacets() {
-        return (XSSimpleTypeDecl.FACET_LENGTH | XSSimpleTypeDecl.FACET_MINLENGTH | XSSimpleTypeDecl.FACET_MAXLENGTH | XSSimpleTypeDecl.FACET_PATTERN | XSSimpleTypeDecl.FACET_ENUMERATION | XSSimpleTypeDecl.FACET_WHITESPACE);
-    }
-
     public Object getActualValue(String content, ValidationContext context)
         throws InvalidDatatypeValueException {
 

Modified: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/StringDV.java
URL: http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/StringDV.java?rev=885800&amp;r1=885799&amp;r2=885800&amp;view=diff
==============================================================================
--- xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/StringDV.java (original)
+++ xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/StringDV.java Tue Dec  1 15:37:29 2009
@@ -32,10 +32,6 @@
  */
 public class StringDV extends TypeValidator {
 
-    public short getAllowedFacets(){
-        return (XSSimpleTypeDecl.FACET_LENGTH | XSSimpleTypeDecl.FACET_MINLENGTH | XSSimpleTypeDecl.FACET_MAXLENGTH | XSSimpleTypeDecl.FACET_PATTERN | XSSimpleTypeDecl.FACET_ENUMERATION | XSSimpleTypeDecl.FACET_WHITESPACE );
-    }
-
     public Object getActualValue(String content, ValidationContext context)
         throws InvalidDatatypeValueException {
         return content;

Modified: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/TypeValidator.java
URL: http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/TypeValidator.java?rev=885800&amp;r1=885799&amp;r2=885800&amp;view=diff
==============================================================================
--- xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/TypeValidator.java (original)
+++ xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/TypeValidator.java Tue Dec  1 15:37:29 2009
@@ -35,9 +35,6 @@
  */
 public abstract class TypeValidator {
 
-    // which facets are allowed for this type
-    public abstract short getAllowedFacets();
-
     // convert a string to an actual value. for example,
     // for number types (decimal, double, float, and types derived from them),
     // get the BigDecimal, Double, Flout object.

Added: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/TypeValidatorHelper.java
URL: http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/TypeValidatorHelper.java?rev=885800&amp;view=auto
==============================================================================
--- xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/TypeValidatorHelper.java (added)
+++ xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/TypeValidatorHelper.java Tue Dec  1 15:37:29 2009
@@ -0,0 +1,187 @@
+/*
+ * 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.dv.xs;
+
+import org.apache.xerces.impl.Constants;
+
+/**
+ * @version $Id$
+ */
+public abstract class TypeValidatorHelper {
+
+    // Constants
+    private static int FACETS_GROUP1 = XSSimpleTypeDecl.FACET_NONE;
+    
+    private static int FACETS_GROUP2 = XSSimpleTypeDecl.FACET_PATTERN | XSSimpleTypeDecl.FACET_WHITESPACE;
+    
+    private static int FACETS_GROUP3 = FACETS_GROUP2 | XSSimpleTypeDecl.FACET_LENGTH |
+        XSSimpleTypeDecl.FACET_MINLENGTH | XSSimpleTypeDecl.FACET_MAXLENGTH |
+        XSSimpleTypeDecl.FACET_ENUMERATION;
+
+    private static int FACETS_GROUP4 = FACETS_GROUP2 | XSSimpleTypeDecl.FACET_ENUMERATION |
+        XSSimpleTypeDecl.FACET_MAXINCLUSIVE | XSSimpleTypeDecl.FACET_MININCLUSIVE |
+        XSSimpleTypeDecl.FACET_MAXEXCLUSIVE | XSSimpleTypeDecl.FACET_MINEXCLUSIVE;
+
+    private static int FACETS_GROUP5 = FACETS_GROUP4 | XSSimpleTypeDecl.FACET_TOTALDIGITS |
+        XSSimpleTypeDecl.FACET_FRACTIONDIGITS;
+    
+    private static int FACETS_GROUP6 = XSSimpleTypeDecl.FACET_PATTERN | XSSimpleTypeDecl.FACET_ENUMERATION;
+
+    private static int FACETS_GROUP7 = FACETS_GROUP2 | XSSimpleTypeDecl.FACET_ASSERT;
+
+    private static int FACETS_GROUP8 = FACETS_GROUP3 | XSSimpleTypeDecl.FACET_ASSERT;
+
+    private static int FACETS_GROUP9 = FACETS_GROUP4 | XSSimpleTypeDecl.FACET_ASSERT;
+    
+    private static int FACETS_GROUP10 = FACETS_GROUP9 | XSSimpleTypeDecl.FACET_EXPLICITTIMEZONE;
+
+    private static int FACETS_GROUP11 = FACETS_GROUP5 | XSSimpleTypeDecl.FACET_ASSERT;
+
+    private static int FACETS_GROUP12 = FACETS_GROUP6 | XSSimpleTypeDecl.FACET_ASSERT;
+    
+    private static int FACETS_GROUP13 = FACETS_GROUP11 | XSSimpleTypeDecl.FACET_MAXSCALE |
+        XSSimpleTypeDecl.FACET_MINSCALE;
+
+    // Static data
+    private static final TypeValidatorHelper fHelper1_0 = new TypeValidatorHelper1_0();
+    private static final TypeValidatorHelper fHelper1_1 = new TypeValidatorHelper1_1();
+
+    // Methods
+    public static TypeValidatorHelper getInstance(short schemaVersion) {
+        if (schemaVersion &lt; Constants.SCHEMA_VERSION_1_1) {
+            return fHelper1_0;
+        }
+        return fHelper1_1;
+    }
+
+    public abstract int getAllowedFacets(short validationDV);
+
+    // Constructor
+    protected TypeValidatorHelper() {}
+
+    // Inner classes
+
+    // XML Schema 1.0 
+    protected static class TypeValidatorHelper1_0 extends TypeValidatorHelper {
+
+        // Data
+        protected static int[] fAllowedFacets;
+
+        static {
+            createAllowedFacets();
+        }
+
+        // create allowed facets
+        static void createAllowedFacets() {
+            fAllowedFacets = new int[] {
+                FACETS_GROUP1, // anySimpleType
+                FACETS_GROUP3, // string
+                FACETS_GROUP2, // boolean
+                FACETS_GROUP5, // decimal
+                FACETS_GROUP4, // float
+                FACETS_GROUP4, // double
+                FACETS_GROUP4, // duration
+                FACETS_GROUP4, // dateTime
+                FACETS_GROUP4, // time
+                FACETS_GROUP4, // date
+                FACETS_GROUP4, // gYearMonth
+                FACETS_GROUP4, // gYear
+                FACETS_GROUP4, // gMonthDay
+                FACETS_GROUP4, // gDay
+                FACETS_GROUP4, // gMonth
+                FACETS_GROUP3, // hexBinary
+                FACETS_GROUP3, // base64Binary
+                FACETS_GROUP3, // anyURI
+                FACETS_GROUP3, // QName
+                FACETS_GROUP1, // precisionDecimal
+                FACETS_GROUP3, // NOTATION
+                FACETS_GROUP3, // ID
+                FACETS_GROUP3, // IDREF
+                FACETS_GROUP3, // ENTITY
+                FACETS_GROUP5, // integer
+                FACETS_GROUP3, // list
+                FACETS_GROUP6, // union
+                FACETS_GROUP1, // gYearMonthDuration
+                FACETS_GROUP1, // gDayTimeDuration
+                FACETS_GROUP1, // anyAtomic
+                FACETS_GROUP1, // error
+                FACETS_GROUP1  // dateTimeStamp
+            };
+        }
+
+        // TypeValidator abstract methods
+        public int getAllowedFacets(short validationDV) {
+            return (validationDV &lt; fAllowedFacets.length) ? fAllowedFacets[validationDV] : FACETS_GROUP1;
+        }
+    }
+
+    // XML Schema 1.1 
+    protected static class TypeValidatorHelper1_1 extends TypeValidatorHelper {
+
+        // Data
+        protected static int[] fAllowedFacets;
+
+        static {
+            createAllowedFacets();
+        }
+
+        // create allowed facets
+        static void createAllowedFacets() {
+            fAllowedFacets = new int[] {
+                FACETS_GROUP1,  //anySimpleType
+                FACETS_GROUP8,  // string
+                FACETS_GROUP7,  // boolean
+                FACETS_GROUP11, // decimal
+                FACETS_GROUP9,  // float
+                FACETS_GROUP9,  // double
+                FACETS_GROUP9,  // duration
+                FACETS_GROUP10, // dateTime
+                FACETS_GROUP10, // time
+                FACETS_GROUP10, // date
+                FACETS_GROUP10, // gYearMonth
+                FACETS_GROUP10, // gYear
+                FACETS_GROUP10, // gMonthDay
+                FACETS_GROUP10, // gDay
+                FACETS_GROUP10, // gMonth
+                FACETS_GROUP8,  // hexBinary
+                FACETS_GROUP8,  // base64Binary
+                FACETS_GROUP8,  // anyURI
+                FACETS_GROUP8,  // QName
+                FACETS_GROUP13, // precisionDecimal
+                FACETS_GROUP8,  // NOTATION
+                FACETS_GROUP8,  // ID
+                FACETS_GROUP8,  // IDREF
+                FACETS_GROUP8,  // ENTITY
+                FACETS_GROUP11, // integer
+                FACETS_GROUP8,  // list
+                FACETS_GROUP12, // union
+                FACETS_GROUP9,  // gYearMonthDuration
+                FACETS_GROUP9,  // gDayTimeDuration
+                FACETS_GROUP1,  // anyAtomic
+                FACETS_GROUP1,  // error
+                FACETS_GROUP10  // dateTimeStamp
+            };
+        }
+
+        // TypeValidator abstract methods
+
+        public int getAllowedFacets(short validationDV) {
+            return (validationDV &lt; fAllowedFacets.length) ? fAllowedFacets[validationDV] : FACETS_GROUP1;
+        }
+    }
+}

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

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

Modified: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/UnionDV.java
URL: http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/UnionDV.java?rev=885800&amp;r1=885799&amp;r2=885800&amp;view=diff
==============================================================================
--- xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/UnionDV.java (original)
+++ xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/UnionDV.java Tue Dec  1 15:37:29 2009
@@ -32,10 +32,6 @@
  */
 public class UnionDV extends TypeValidator{
 
-    public short getAllowedFacets(){
-          return (XSSimpleTypeDecl.FACET_PATTERN | XSSimpleTypeDecl.FACET_ENUMERATION );
-    }
-
     // this method should never be called: XSSimpleTypeDecl is responsible for
     // calling the member types for the convertion
     public Object getActualValue(String content, ValidationContext context) throws InvalidDatatypeValueException{

Modified: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/XSSimpleTypeDecl.java
URL: http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/XSSimpleTypeDecl.java?rev=885800&amp;r1=885799&amp;r2=885800&amp;view=diff
==============================================================================
--- xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/XSSimpleTypeDecl.java (original)
+++ xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/XSSimpleTypeDecl.java Tue Dec  1 15:37:29 2009
@@ -229,6 +229,9 @@
         public Locale getLocale() {
             return Locale.getDefault();
         }
+        public TypeValidatorHelper getTypeValidatorHelper() {
+            return TypeValidatorHelper.getInstance(Constants.SCHEMA_VERSION_1_0);
+        }
     };
 
     protected static TypeValidator[] getGDVs() {
@@ -239,6 +242,10 @@
         fDVs = dvs;
     }
     
+
+    // Default TypeValidatorHelper
+    private static TypeValidatorHelper fDefaultTypeValidatorHelper = TypeValidatorHelper.getInstance(Constants.SCHEMA_VERSION_1_0);
+
     // this will be true if this is a static XSSimpleTypeDecl
     // and hence must remain immutable (i.e., applyFacets
     // may not be permitted to have any effect).
@@ -256,8 +263,8 @@
     private short fVariety = -1;
     private short fValidationDV = -1;
 
-    private short fFacetsDefined = 0;
-    private short fFixedFacet = 0;
+    private int fFacetsDefined = 0;
+    private int fFixedFacet = 0;
 
     //for constraining facets
     private short fWhiteSpace = 0;
@@ -657,7 +664,7 @@
     }
 
     public short getPrimitiveKind() {
-        if (fVariety == VARIETY_ATOMIC &amp;&amp; fValidationDV != DV_ANYSIMPLETYPE) {
+        if (fVariety == VARIETY_ATOMIC &amp;&amp; fValidationDV != DV_ANYSIMPLETYPE &amp;&amp; fValidationDV != DV_ANYATOMICTYPE) {
             if (fValidationDV == DV_ID || fValidationDV == DV_IDREF || fValidationDV == DV_ENTITY) {
                 return DV_STRING;
             }
@@ -692,11 +699,12 @@
      * definition) is available, otherwise &lt;code&gt;null&lt;/code&gt;.
      */
     public XSSimpleTypeDefinition getPrimitiveType() {
-        if (fVariety == VARIETY_ATOMIC &amp;&amp; fValidationDV != DV_ANYSIMPLETYPE) {
+        if (fVariety == VARIETY_ATOMIC &amp;&amp; fValidationDV != DV_ANYSIMPLETYPE &amp;&amp; fValidationDV != DV_ANYATOMICTYPE) {
             XSSimpleTypeDecl pri = this;
             // recursively get base, until we reach anySimpleType
-            while (pri.fBase != fAnySimpleType)
+            while (pri.fBase != fAnySimpleType &amp;&amp; pri.fBase != fAnyAtomicType) {
                 pri = pri.fBase;
+            }
             return pri;
         }
         else {
@@ -737,7 +745,7 @@
     /**
      * If &lt;restriction&gt; is chosen
      */
-    public void applyFacets(XSFacets facets, short presentFacet, short fixedFacet, ValidationContext context)
+    public void applyFacets(XSFacets facets, int presentFacet, int fixedFacet, ValidationContext context)
     throws InvalidDatatypeFacetException {
         if (context == null) {
             context = fEmptyContext;
@@ -748,7 +756,7 @@
     /**
      * built-in derived types by restriction
      */
-    void applyFacets1(XSFacets facets, short presentFacet, short fixedFacet) {
+    void applyFacets1(XSFacets facets, int presentFacet, int fixedFacet) {
 
         try {
             applyFacets(facets, presentFacet, fixedFacet, SPECIAL_PATTERN_NONE, fDummyContext);
@@ -763,7 +771,7 @@
     /**
      * built-in derived types by restriction
      */
-    void applyFacets1(XSFacets facets, short presentFacet, short fixedFacet, short patternType) {
+    void applyFacets1(XSFacets facets, int presentFacet, int fixedFacet, short patternType) {
 
         try {
             applyFacets(facets, presentFacet, fixedFacet, patternType, fDummyContext);
@@ -778,7 +786,7 @@
     /**
      * If &lt;restriction&gt; is chosen, or built-in derived types by restriction
      */
-    void applyFacets(XSFacets facets, short presentFacet, short fixedFacet, short patternType, ValidationContext context)
+    void applyFacets(XSFacets facets, int presentFacet, int fixedFacet, short patternType, ValidationContext context)
     throws InvalidDatatypeFacetException {
 
         // if the object is immutable, should not apply facets...
@@ -798,7 +806,12 @@
         int result = 0 ;
 
         // step 1: parse present facets
-        short allowedFacet = fDVs[fValidationDV].getAllowedFacets();
+        TypeValidatorHelper typeValidatorHelper = context.getTypeValidatorHelper();
+        if (typeValidatorHelper == null) {
+            // fall back to 1.0 simple types
+            typeValidatorHelper = fDefaultTypeValidatorHelper;
+        }
+        int allowedFacet = typeValidatorHelper.getAllowedFacets(fValidationDV);
 
         // length
         if ((presentFacet &amp; FACET_LENGTH) != 0) {
@@ -2148,7 +2161,7 @@
      * @param facetName  The name of the facet.
      * @return  True if the facet is defined, false otherwise.
      */
-    public boolean isDefinedFacet(short facetName) {
+    public boolean isDefinedFacet(int facetName) {
         if ((fFacetsDefined &amp; facetName) != 0)
             return true;
         if (fPatternType != SPECIAL_PATTERN_NONE)
@@ -2162,11 +2175,11 @@
      * [facets]: all facets defined on this type. The value is a bit
      * combination of FACET_XXX constants of all defined facets.
      */
-    public short getDefinedFacets() {
+    public int getDefinedFacets() {
         if (fPatternType != SPECIAL_PATTERN_NONE)
-            return (short)(fFacetsDefined | FACET_PATTERN);
+            return fFacetsDefined | FACET_PATTERN;
         if (fValidationDV == DV_INTEGER)
-            return (short)(fFacetsDefined | FACET_PATTERN | FACET_FRACTIONDIGITS);
+            return fFacetsDefined | FACET_PATTERN | FACET_FRACTIONDIGITS;
         return fFacetsDefined;
     }
 
@@ -2176,7 +2189,7 @@
      * @param facetName  The name of the facet.
      * @return  True if the facet is fixed, false otherwise.
      */
-    public boolean isFixedFacet(short facetName) {
+    public boolean isFixedFacet(int facetName) {
         if ((fFixedFacet &amp; facetName) != 0)
             return true;
         if (fValidationDV == DV_INTEGER)
@@ -2187,9 +2200,9 @@
     /**
      * [facets]: all defined facets for this type which are fixed.
      */
-    public short getFixedFacets() {
+    public int getFixedFacets() {
         if (fValidationDV == DV_INTEGER)
-            return (short)(fFixedFacet | FACET_FRACTIONDIGITS);
+            return fFixedFacet | FACET_FRACTIONDIGITS;
         return fFixedFacet;
     }
 
@@ -2205,7 +2218,7 @@
      * @return A value of the facet specified in &lt;code&gt;facetName&lt;/code&gt; for
      *   this simple type definition or &lt;code&gt;null&lt;/code&gt;.
      */
-    public String getLexicalFacetValue(short facetName) {
+    public String getLexicalFacetValue(int facetName) {
         switch (facetName) {
             case FACET_LENGTH:
                 return (fLength == -1)?null:Integer.toString(fLength);
@@ -2899,6 +2912,10 @@
         public Locale getLocale() {
             return Locale.getDefault();
         }
+        
+        public TypeValidatorHelper getTypeValidatorHelper() {
+            return TypeValidatorHelper.getInstance(Constants.SCHEMA_VERSION_1_0);
+        }
     };
 
     private boolean fAnonymous = false;
@@ -2971,6 +2988,10 @@
         public Locale getLocale() {
             return fExternal.getLocale();
         }
+        
+        public TypeValidatorHelper getTypeValidatorHelper() {
+            return fExternal.getTypeValidatorHelper();
+        }
     }
 
     public void reset(){
@@ -3225,12 +3246,12 @@
     }
 
     private static final class XSFacetImpl implements XSFacet {
-        final short kind;
+        final int kind;
         final String value;
         final boolean fixed;
         final XSObjectList annotations;  
 
-        public XSFacetImpl(short kind, String value, boolean fixed, XSAnnotation annotation) {
+        public XSFacetImpl(int kind, String value, boolean fixed, XSAnnotation annotation) {
             this.kind = kind;
             this.value = value;
             this.fixed = fixed;
@@ -3271,7 +3292,7 @@
         /* (non-Javadoc)
          * @see org.apache.xerces.xs.XSFacet#getFacetKind()
          */
-        public short getFacetKind() {
+        public int getFacetKind() {
             return kind;
         }
 
@@ -3321,12 +3342,12 @@
     }
 
     private static final class XSMVFacetImpl implements XSMultiValueFacet {
-        final short kind;
+        final int kind;
         final XSObjectList annotations;
         final StringList values;
         final Vector asserts;
 
-        public XSMVFacetImpl(short kind, StringList values, XSObjectList annotations) {
+        public XSMVFacetImpl(int kind, StringList values, XSObjectList annotations) {
             this.kind = kind;
             this.values = values;
             this.annotations = (annotations != null) ? annotations : XSObjectListImpl.EMPTY_LIST;
@@ -3335,7 +3356,7 @@
         /*
          * overloaded constructor. added to support assertions.
          */
-        public XSMVFacetImpl(short kind, Vector asserts) {
+        public XSMVFacetImpl(int kind, Vector asserts) {
             this.kind = kind;
             this.asserts = asserts;
             this.values = null;
@@ -3345,7 +3366,7 @@
         /* (non-Javadoc)
          * @see org.apache.xerces.xs.XSFacet#getFacetKind()
          */
-        public short getFacetKind() {
+        public int getFacetKind() {
             return kind;
         }	
 

Modified: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/XSSimpleTypeDelegate.java
URL: http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/XSSimpleTypeDelegate.java?rev=885800&amp;r1=885799&amp;r2=885800&amp;view=diff
==============================================================================
--- xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/XSSimpleTypeDelegate.java (original)
+++ xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/XSSimpleTypeDelegate.java Tue Dec  1 15:37:29 2009
@@ -61,7 +61,7 @@
         return type.getBuiltInKind();
     }
 
-    public short getDefinedFacets() {
+    public int getDefinedFacets() {
         return type.getDefinedFacets();
     }
 
@@ -73,7 +73,7 @@
         return type.getFinite();
     }
 
-    public short getFixedFacets() {
+    public int getFixedFacets() {
         return type.getFixedFacets();
     }
 
@@ -85,7 +85,7 @@
         return type.getLexicalEnumeration();
     }
 
-    public String getLexicalFacetValue(short facetName) {
+    public String getLexicalFacetValue(int facetName) {
         return type.getLexicalFacetValue(facetName);
     }
 
@@ -117,11 +117,11 @@
         return type.getVariety();
     }
 
-    public boolean isDefinedFacet(short facetName) {
+    public boolean isDefinedFacet(int facetName) {
         return type.isDefinedFacet(facetName);
     }
 
-    public boolean isFixedFacet(short facetName) {
+    public boolean isFixedFacet(int facetName) {
         return type.isFixedFacet(facetName);
     }
 
@@ -169,7 +169,7 @@
         return type.getType();
     }
 
-    public void applyFacets(XSFacets facets, short presentFacet, short fixedFacet, ValidationContext context) 
+    public void applyFacets(XSFacets facets, int presentFacet, int fixedFacet, ValidationContext context) 
         throws InvalidDatatypeFacetException {
         type.applyFacets(facets, presentFacet, fixedFacet, context);
     }

Modified: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/validation/ValidationState.java
URL: http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/validation/ValidationState.java?rev=885800&amp;r1=885799&amp;r2=885800&amp;view=diff
==============================================================================
--- xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/validation/ValidationState.java (original)
+++ xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/validation/ValidationState.java Tue Dec  1 15:37:29 2009
@@ -22,6 +22,7 @@
 import java.util.Locale;
 
 import org.apache.xerces.impl.dv.ValidationContext;
+import org.apache.xerces.impl.dv.xs.TypeValidatorHelper;
 import org.apache.xerces.util.SymbolTable;
 import org.apache.xerces.xni.NamespaceContext;
 
@@ -53,6 +54,8 @@
     private final HashMap fIdTable    = new HashMap();
     private final HashMap fIdRefTable = new HashMap();
     private final static Object fNullValue = new Object();
+    
+    private TypeValidatorHelper fTypeValidatorHelper = null;
 
     //
     // public methods
@@ -199,4 +202,14 @@
     public Locale getLocale() {
         return fLocale;
     }
+    
+    // TypeValidatorHelper
+    
+    public void setTypeValidatorHelper(TypeValidatorHelper typeValidatorHelper) {
+        fTypeValidatorHelper = typeValidatorHelper;
+    }
+
+    public TypeValidatorHelper getTypeValidatorHelper() {
+        return fTypeValidatorHelper;
+    }
 }

Modified: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/XMLSchemaValidator.java
URL: http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/XMLSchemaValidator.java?rev=885800&amp;r1=885799&amp;r2=885800&amp;view=diff
==============================================================================
--- xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/XMLSchemaValidator.java (original)
+++ xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/XMLSchemaValidator.java Tue Dec  1 15:37:29 2009
@@ -36,6 +36,7 @@
 import org.apache.xerces.impl.dv.InvalidDatatypeValueException;
 import org.apache.xerces.impl.dv.ValidatedInfo;
 import org.apache.xerces.impl.dv.XSSimpleType;
+import org.apache.xerces.impl.dv.xs.TypeValidatorHelper;
 import org.apache.xerces.impl.dv.xs.XSSimpleTypeDecl;
 import org.apache.xerces.impl.validation.ConfigurableValidationState;
 import org.apache.xerces.impl.validation.ValidationManager;
@@ -1553,9 +1554,12 @@
 
         fEntityResolver = (XMLEntityResolver) componentManager.getProperty(ENTITY_MANAGER);
 
+        final TypeValidatorHelper typeValidatorHelper = TypeValidatorHelper.getInstance(fSchemaVersion);
+        
         fValidationManager = (ValidationManager) componentManager.getProperty(VALIDATION_MANAGER);
         fValidationManager.addValidationState(fValidationState);
         fValidationState.setSymbolTable(fSymbolTable);
+        fValidationState.setTypeValidatorHelper(typeValidatorHelper);
         
         try {
             final Object rootType = componentManager.getProperty(ROOT_TYPE_DEF);
@@ -1673,6 +1677,9 @@
 
         fState4XsiType.setSymbolTable(symbolTable);
         fState4ApplyDefault.setSymbolTable(symbolTable);
+        
+        fState4XsiType.setTypeValidatorHelper(typeValidatorHelper);
+        fState4ApplyDefault.setTypeValidatorHelper(typeValidatorHelper);
 
     } // reset(XMLComponentManager)
 

Modified: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/traversers/XSDAbstractTraverser.java
URL: http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/traversers/XSDAbstractTraverser.java?rev=885800&amp;r1=885799&amp;r2=885800&amp;view=diff
==============================================================================
--- xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/traversers/XSDAbstractTraverser.java (original)
+++ xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/traversers/XSDAbstractTraverser.java Tue Dec  1 15:37:29 2009
@@ -24,6 +24,7 @@
 import org.apache.xerces.impl.dv.InvalidDatatypeValueException;
 import org.apache.xerces.impl.dv.XSFacets;
 import org.apache.xerces.impl.dv.XSSimpleType;
+import org.apache.xerces.impl.dv.xs.TypeValidatorHelper;
 import org.apache.xerces.impl.validation.ValidationState;
 import org.apache.xerces.impl.xpath.XPath20Assert;
 import org.apache.xerces.impl.xs.SchemaGrammar;
@@ -105,6 +106,7 @@
         fValidationState.setExtraChecking(false);
         fValidationState.setSymbolTable(symbolTable);
         fValidationState.setLocale(locale);
+        fValidationState.setTypeValidatorHelper(fSchemaHandler.fTypeValidatorHelper);
     }
     
     // traverse the annotation declaration

Modified: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/traversers/XSDHandler.java
URL: http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/traversers/XSDHandler.java?rev=885800&amp;r1=885799&amp;r2=885800&amp;view=diff
==============================================================================
--- xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/traversers/XSDHandler.java (original)
+++ xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/traversers/XSDHandler.java Tue Dec  1 15:37:29 2009
@@ -37,6 +37,7 @@
 import org.apache.xerces.impl.dv.SchemaDVFactory;
 import org.apache.xerces.impl.dv.xs.DecimalDV;
 import org.apache.xerces.impl.dv.xs.TypeValidator;
+import org.apache.xerces.impl.dv.xs.TypeValidatorHelper;
 import org.apache.xerces.impl.dv.xs.XSSimpleTypeDecl;
 import org.apache.xerces.impl.xs.SchemaGrammar;
 import org.apache.xerces.impl.xs.SchemaNamespaceSupport;
@@ -443,6 +444,9 @@
     // XML Schema constraint checker
     XSConstraints fXSConstraints;
 
+    // TypeValidatorHelper
+    TypeValidatorHelper fTypeValidatorHelper;
+    
     // these data members are needed for the deferred traversal
     // of local elements.
 
@@ -812,7 +816,7 @@
         XSDocumentInfo currSchemaInfo = null;
         try {
             // note that attributes are freed at end of traverseSchemas()
-            currSchemaInfo = new XSDocumentInfo(schemaRoot, fAttributeChecker, fSymbolTable);
+            currSchemaInfo = new XSDocumentInfo(schemaRoot, fAttributeChecker, fSymbolTable, fTypeValidatorHelper);
         } catch (XMLSchemaException se) {
             reportSchemaError(ELE_ERROR_CODES[referType],
                     new Object[]{locationHint},
@@ -3689,6 +3693,8 @@
         } catch (XMLConfigurationException e) {
         }
         
+        fTypeValidatorHelper = TypeValidatorHelper.getInstance(fSchemaVersion);
+        
     } // reset(XMLComponentManager)
     
     

Modified: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/traversers/XSDocumentInfo.java
URL: http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/traversers/XSDocumentInfo.java?rev=885800&amp;r1=885799&amp;r2=885800&amp;view=diff
==============================================================================
--- xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/traversers/XSDocumentInfo.java (original)
+++ xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/traversers/XSDocumentInfo.java Tue Dec  1 15:37:29 2009
@@ -20,6 +20,7 @@
 import java.util.Stack;
 import java.util.Vector;
 
+import org.apache.xerces.impl.dv.xs.TypeValidatorHelper;
 import org.apache.xerces.impl.validation.ValidationState;
 import org.apache.xerces.impl.xs.SchemaNamespaceSupport;
 import org.apache.xerces.impl.xs.SchemaSymbols;
@@ -100,7 +101,7 @@
 
     // note that the caller must ensure to call returnSchemaAttrs()
     // to avoid memory leaks!
-    XSDocumentInfo (Element schemaRoot, XSAttributeChecker attrChecker, SymbolTable symbolTable)
+    XSDocumentInfo (Element schemaRoot, XSAttributeChecker attrChecker, SymbolTable symbolTable, TypeValidatorHelper typeValidatorHelper)
                     throws XMLSchemaException {
         
         fSchemaElement = schemaRoot;
@@ -117,6 +118,7 @@
             // set namespace support
             fValidationContext.setNamespaceSupport(fNamespaceSupport);
             fValidationContext.setSymbolTable(symbolTable);
+            fValidationContext.setTypeValidatorHelper(typeValidatorHelper);
             
             fSchemaAttrs = attrChecker.checkAttributes(root, true, this);
             // schemaAttrs == null means it's not an &lt;xsd:schema&gt; element

Modified: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/xs/XSFacet.java
URL: http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/xs/XSFacet.java?rev=885800&amp;r1=885799&amp;r2=885800&amp;view=diff
==============================================================================
--- xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/xs/XSFacet.java (original)
+++ xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/xs/XSFacet.java Tue Dec  1 15:37:29 2009
@@ -26,7 +26,7 @@
      * The name of the facet, e.g. &lt;code&gt;FACET_LENGTH, FACET_TOTALDIGITS&lt;/code&gt;
      *  (see &lt;code&gt;XSSimpleTypeDefinition&lt;/code&gt;). 
      */
-    public short getFacetKind();
+    public int getFacetKind();
 
     /**
      * A value of this facet. 

Modified: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/xs/XSMultiValueFacet.java
URL: http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/xs/XSMultiValueFacet.java?rev=885800&amp;r1=885799&amp;r2=885800&amp;view=diff
==============================================================================
--- xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/xs/XSMultiValueFacet.java (original)
+++ xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/xs/XSMultiValueFacet.java Tue Dec  1 15:37:29 2009
@@ -27,7 +27,7 @@
      * The name of the facet, i.e. &lt;code&gt;FACET_ENUMERATION&lt;/code&gt; and 
      * &lt;code&gt;FACET_PATTERN&lt;/code&gt; (see &lt;code&gt;XSSimpleTypeDefinition&lt;/code&gt;). 
      */
-    public short getFacetKind();
+    public int getFacetKind();
 
     /**
      * Values of this facet. 

Modified: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/xs/XSSimpleTypeDefinition.java
URL: http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/xs/XSSimpleTypeDefinition.java?rev=885800&amp;r1=885799&amp;r2=885800&amp;view=diff
==============================================================================
--- xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/xs/XSSimpleTypeDefinition.java (original)
+++ xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/xs/XSSimpleTypeDefinition.java Tue Dec  1 15:37:29 2009
@@ -48,60 +48,75 @@
     /**
      * No facets defined.
      */
-    public static final short FACET_NONE                = 0;
+    public static final int FACET_NONE                  = 0;
     /**
      * 4.3.1 Length
      */
-    public static final short FACET_LENGTH              = 1;
+    public static final int FACET_LENGTH                = 1;
     /**
      * 4.3.2 minLength. 
      */
-    public static final short FACET_MINLENGTH           = 2;
+    public static final int FACET_MINLENGTH             = 2;
     /**
      * 4.3.3 maxLength.
      */
-    public static final short FACET_MAXLENGTH           = 4;
+    public static final int FACET_MAXLENGTH             = 4;
     /**
      * 4.3.4 pattern.
      */
-    public static final short FACET_PATTERN             = 8;
+    public static final int FACET_PATTERN               = 8;
     /**
-     * 4.3.5 whitespace.
+     * 4.3.6 whitespace.
      */
-    public static final short FACET_WHITESPACE          = 16;
+    public static final int FACET_WHITESPACE            = 16;
     /**
      * 4.3.7 maxInclusive.
      */
-    public static final short FACET_MAXINCLUSIVE        = 32;
+    public static final int FACET_MAXINCLUSIVE          = 32;
     /**
      * 4.3.9 maxExclusive.
      */
-    public static final short FACET_MAXEXCLUSIVE        = 64;
+    public static final int FACET_MAXEXCLUSIVE          = 64;
     /**
      * 4.3.9 minExclusive.
      */
-    public static final short FACET_MINEXCLUSIVE        = 128;
+    public static final int FACET_MINEXCLUSIVE          = 128;
     /**
      * 4.3.10 minInclusive.
      */
-    public static final short FACET_MININCLUSIVE        = 256;
+    public static final int FACET_MININCLUSIVE          = 256;
     /**
      * 4.3.11 totalDigits .
      */
-    public static final short FACET_TOTALDIGITS         = 512;
+    public static final int FACET_TOTALDIGITS           = 512;
     /**
      * 4.3.12 fractionDigits.
      */
-    public static final short FACET_FRACTIONDIGITS      = 1024;
+    public static final int FACET_FRACTIONDIGITS        = 1024;
     /**
      * 4.3.5 enumeration.
      */
-    public static final short FACET_ENUMERATION         = 2048;
+    public static final int FACET_ENUMERATION           = 2048;
     
     /**
-     * 'assertion' facet introduced in XML Schema 1.1
+     * 4.3.13 maxScale (XML Schema 1.1)
      */
-    public static final short FACET_ASSERT              = 4096;
+    public static final int FACET_MAXSCALE              = 4096;         
+
+    /**
+     * 4.3.14 minScale (XML Schema 1.1)
+     */
+    public static final int FACET_MINSCALE              = 8192;
+
+    /**
+     * 4.3.15 assert (XML Schema 1.1)
+     */
+    public static final int FACET_ASSERT                = 16384;
+
+    /**
+     * 4.3.16 explicitTimeZone (XML Schema 1.1)
+     */
+    public static final int FACET_EXPLICITTIMEZONE      = 32768;
 
     /**
      * A constant defined for the 'ordered' fundamental facet: not ordered.
@@ -153,7 +168,7 @@
      * [facets]: all facets defined on this type. The value is a bit 
      * combination of FACET_XXX constants of all defined facets. 
      */
-    public short getDefinedFacets();
+    public int getDefinedFacets();
 
     /**
      * Convenience method. [Facets]: check whether a facet is defined on this 
@@ -161,12 +176,12 @@
      * @param facetName  The name of the facet. 
      * @return  True if the facet is defined, false otherwise.
      */
-    public boolean isDefinedFacet(short facetName);
+    public boolean isDefinedFacet(int facetName);
 
     /**
      * [facets]: all defined facets for this type which are fixed.
      */
-    public short getFixedFacets();
+    public int getFixedFacets();
 
     /**
      * Convenience method. [Facets]: check whether a facet is defined and 
@@ -174,7 +189,7 @@
      * @param facetName  The name of the facet. 
      * @return  True if the facet is fixed, false otherwise.
      */
-    public boolean isFixedFacet(short facetName);
+    public boolean isFixedFacet(int facetName);
 
     /**
      * Convenience method. Returns a value of a single constraining facet for 
@@ -188,7 +203,7 @@
      * @return A value of the facet specified in &lt;code&gt;facetName&lt;/code&gt; for 
      *   this simple type definition or &lt;code&gt;null&lt;/code&gt;. 
      */
-    public String getLexicalFacetValue(short facetName);
+    public String getLexicalFacetValue(int facetName);
 
     /**
      * A list of enumeration values if it exists, otherwise an empty 



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



</pre>
</div>
</content>
</entry>
<entry>
<title>svn commit: r885352 - /xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/models/XCMValidatorHelper.java</title>
<author><name>mrglavas@apache.org</name></author>
<link rel="alternate" href="http://mail-archives.apache.org/mod_mbox/xerces-commits/200911.mbox/%3c20091130084437.9714223889BF@eris.apache.org%3e"/>
<id>urn:uuid:%3c20091130084437-9714223889BF@eris-apache-org%3e</id>
<updated>2009-11-30T08:44:37Z</updated>
<content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml">
<pre>
Author: mrglavas
Date: Mon Nov 30 08:44:36 2009
New Revision: 885352

URL: http://svn.apache.org/viewvc?rev=885352&amp;view=rev
Log:
Adding @xerces.internal to an internal class.

Modified:
    xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/models/XCMValidatorHelper.java

Modified: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/models/XCMValidatorHelper.java
URL: http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/models/XCMValidatorHelper.java?rev=885352&amp;r1=885351&amp;r2=885352&amp;view=diff
==============================================================================
--- xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/models/XCMValidatorHelper.java
(original)
+++ xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/models/XCMValidatorHelper.java
Mon Nov 30 08:44:36 2009
@@ -21,6 +21,8 @@
 import org.apache.xerces.xni.QName;
 
 /**
+ * @xerces.internal
+ * 
  * @version $Id$
  */
 public interface XCMValidatorHelper {



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



</pre>
</div>
</content>
</entry>
<entry>
<title>svn commit: r885076 - /xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/XMLAssertPsychopathImpl.java</title>
<author><name>mukulg@apache.org</name></author>
<link rel="alternate" href="http://mail-archives.apache.org/mod_mbox/xerces-commits/200911.mbox/%3c20091128084223.8304B2388962@eris.apache.org%3e"/>
<id>urn:uuid:%3c20091128084223-8304B2388962@eris-apache-org%3e</id>
<updated>2009-11-28T08:42:23Z</updated>
<content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml">
<pre>
Author: mukulg
Date: Sat Nov 28 08:42:23 2009
New Revision: 885076

URL: http://svn.apache.org/viewvc?rev=885076&amp;view=rev
Log:
some fixes to typed value of xpath2 variable, $value. found this bug while testing for asserts,
in ComplexType -&gt; SimpleContent -&gt; restriction.

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

Modified: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/XMLAssertPsychopathImpl.java
URL: http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/XMLAssertPsychopathImpl.java?rev=885076&amp;r1=885075&amp;r2=885076&amp;view=diff
==============================================================================
--- xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/XMLAssertPsychopathImpl.java
(original)
+++ xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/XMLAssertPsychopathImpl.java
Sat Nov 28 08:42:23 2009
@@ -278,21 +278,25 @@
     private void setValueOf$value(String value) {
        PSVIElementNSImpl currentAssertPSVINode = (PSVIElementNSImpl) currentAssertDomNode;
        
-       String typeName = "";
-       if (Constants.NS_XMLSCHEMA.equals(currentAssertPSVINode.getTypeNamespace())) {
-           typeName = currentAssertPSVINode.getTypeDefinition().getName();    
-       } else if (Constants.NS_XMLSCHEMA.equals(currentAssertPSVINode.
-                                         getTypeDefinition().
-                                         getBaseType().getNamespace())) {
-           typeName = currentAssertPSVINode.getTypeDefinition().getBaseType().
-                                         getName();
-       }
-       
+       String xsdTypeName = getXSDtypeOf$Value(currentAssertPSVINode.getTypeDefinition());
      
        Object psychoPathType = abstrPsychopathImpl.getPsychoPathTypeForXSDType
-                                                             (typeName, value);
-       
+                                                         (xsdTypeName, value);       
        fDynamicContext.set_variable(
                new org.eclipse.wst.xml.xpath2.processor.internal.types.QName(
                        "value"), (AnyType) psychoPathType);
     }
+    
+    /*
+       Find the built in XSD type for XPath2 variable, $value. This function
+       recursively searches the XSD type hierarchy navigating up the base
+       types, to find the needed built-in type.
+    */
+    private String getXSDtypeOf$Value(XSTypeDefinition elementType) {
+      if (Constants.NS_XMLSCHEMA.equals(elementType.getNamespace())) {
+        return elementType.getName();    
+      }
+      else {
+        return getXSDtypeOf$Value(elementType.getBaseType()); 
+      }
+    }
 }



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



</pre>
</div>
</content>
</entry>
<entry>
<title>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/</title>
<author><name>knoaman@apache.org</name></author>
<link rel="alternate" href="http://mail-archives.apache.org/mod_mbox/xerces-commits/200911.mbox/%3c20091126143005.6B22A23889EC@eris.apache.org%3e"/>
<id>urn:uuid:%3c20091126143005-6B22A23889EC@eris-apache-org%3e</id>
<updated>2009-11-26T14:30:02Z</updated>
<content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml">
<pre>
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&amp;r1=884565&amp;r2=884566&amp;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&amp;r1=884565&amp;r2=884566&amp;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 &amp;&amp; publicAttr == null)
+        if (systemAttr == null &amp;&amp; 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&amp;r1=884565&amp;r2=884566&amp;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 &amp;&amp; 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) &amp;&amp; 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 &amp;&amp; (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) &amp;&amp; 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 &amp;&amp; (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 &amp;&amp; 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 &amp;&amp;
-                    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 &amp;&amp;
-                        checkBuiltIn(refName, schemaDoc.fTargetNamespace)) {
-                    return null;
-                }
-                reportSchemaError("cos-st-restricts.1.1", new Object[]{baseTypeStr.rawname,
refName}, elm);
-                return SchemaGrammar.fAnySimpleType;
-            }
-            if ((baseType.getFinal() &amp; 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 &amp;&amp;
+            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() &amp; 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&amp;r1=884565&amp;r2=884566&amp;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&amp;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 &lt; fLength; i++) {
+                if (fArray[i] == null)
+                    return true;
+            }
+        }
+        else {
+            for (int i = 0; i &lt; fLength; i++) {
+                if (item.equals(fArray[i]))
+                    return true;
+            }
+        }
+        return false;
+    }
+    
+    public Object item(int index) {
+        if (index &lt; 0 || index &gt;= fLength) {
+            return null;
+        }
+        return fArray[index];
+    }
+    
+    /*
+     * List methods
+     */
+    public Object get(int index) {
+        if (index &gt;= 0 &amp;&amp; index &lt; 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 &lt; fLength) {
+            Class arrayClass = a.getClass();
+            Class componentType = arrayClass.getComponentType();
+            a = (Object[]) Array.newInstance(componentType, fLength);
+        }
+        toArray0(a);
+        if (a.length &gt; fLength) {
+            a[fLength] = null;
+        }
+        return a;
+    }
+
+    private void toArray0(Object[] a) {
+        if (fLength &gt; 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&amp;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&amp;r1=884565&amp;r2=884566&amp;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&amp;r1=884565&amp;r2=884566&amp;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&amp;r1=884565&amp;r2=884566&amp;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



</pre>
</div>
</content>
</entry>
<entry>
<title>svn commit: r884566 [2/3] - in /xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces: impl/xs/models/ impl/xs/traversers/ impl/xs/util/ parsers/</title>
<author><name>knoaman@apache.org</name></author>
<link rel="alternate" href="http://mail-archives.apache.org/mod_mbox/xerces-commits/200911.mbox/%3c20091126143005.65C4123889DF@eris.apache.org%3e"/>
<id>urn:uuid:%3c20091126143005-65C4123889DF@eris-apache-org%3e</id>
<updated>2009-11-26T14:30:02Z</updated>
<content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml">
<pre>
Modified: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/traversers/XSDHandler.java
URL: http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/traversers/XSDHandler.java?rev=884566&amp;r1=884565&amp;r2=884566&amp;view=diff
==============================================================================
--- xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/traversers/XSDHandler.java (original)
+++ xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/traversers/XSDHandler.java Thu Nov 26 14:30:01 2009
@@ -20,6 +20,7 @@
 import java.io.IOException;
 import java.io.StringReader;
 import java.util.ArrayList;
+import java.util.Enumeration;
 import java.util.Hashtable;
 import java.util.Locale;
 import java.util.Stack;
@@ -33,13 +34,16 @@
 import org.apache.xerces.impl.XMLEntityManager;
 import org.apache.xerces.impl.XMLErrorReporter;
 import org.apache.xerces.impl.dv.InvalidDatatypeValueException;
+import org.apache.xerces.impl.dv.SchemaDVFactory;
 import org.apache.xerces.impl.dv.xs.DecimalDV;
 import org.apache.xerces.impl.dv.xs.TypeValidator;
+import org.apache.xerces.impl.dv.xs.XSSimpleTypeDecl;
 import org.apache.xerces.impl.xs.SchemaGrammar;
 import org.apache.xerces.impl.xs.SchemaNamespaceSupport;
 import org.apache.xerces.impl.xs.SchemaSymbols;
 import org.apache.xerces.impl.xs.XMLSchemaException;
 import org.apache.xerces.impl.xs.XMLSchemaLoader;
+import org.apache.xerces.impl.xs.XSAttributeDecl;
 import org.apache.xerces.impl.xs.XSAttributeGroupDecl;
 import org.apache.xerces.impl.xs.XSComplexTypeDecl;
 import org.apache.xerces.impl.xs.XSConstraints;
@@ -50,11 +54,14 @@
 import org.apache.xerces.impl.xs.XSGroupDecl;
 import org.apache.xerces.impl.xs.XSMessageFormatter;
 import org.apache.xerces.impl.xs.XSModelGroupImpl;
+import org.apache.xerces.impl.xs.XSNotationDecl;
 import org.apache.xerces.impl.xs.XSParticleDecl;
+import org.apache.xerces.impl.xs.identity.IdentityConstraint;
 import org.apache.xerces.impl.xs.opti.ElementImpl;
 import org.apache.xerces.impl.xs.opti.SchemaDOMParser;
 import org.apache.xerces.impl.xs.opti.SchemaParsingConfig;
 import org.apache.xerces.impl.xs.util.SimpleLocator;
+import org.apache.xerces.impl.xs.util.XSInputSource;
 import org.apache.xerces.parsers.SAXParser;
 import org.apache.xerces.parsers.XML11Configuration;
 import org.apache.xerces.util.DOMInputSource;
@@ -64,6 +71,7 @@
 import org.apache.xerces.util.SAXInputSource;
 import org.apache.xerces.util.StAXInputSource;
 import org.apache.xerces.util.StAXLocationWrapper;
+import org.apache.xerces.util.SymbolHash;
 import org.apache.xerces.util.SymbolTable;
 import org.apache.xerces.util.XMLSymbols;
 import org.apache.xerces.util.URI.MalformedURIException;
@@ -79,8 +87,22 @@
 import org.apache.xerces.xni.parser.XMLErrorHandler;
 import org.apache.xerces.xni.parser.XMLInputSource;
 import org.apache.xerces.xni.parser.XMLParseException;
+import org.apache.xerces.xs.StringList;
+import org.apache.xerces.xs.XSAttributeDeclaration;
+import org.apache.xerces.xs.XSAttributeGroupDefinition;
+import org.apache.xerces.xs.XSAttributeUse;
+import org.apache.xerces.xs.XSConstants;
+import org.apache.xerces.xs.XSElementDeclaration;
+import org.apache.xerces.xs.XSModelGroup;
+import org.apache.xerces.xs.XSModelGroupDefinition;
+import org.apache.xerces.xs.XSNamedMap;
 import org.apache.xerces.xs.XSObject;
+import org.apache.xerces.xs.XSObjectList;
 import org.apache.xerces.xs.XSParticle;
+import org.apache.xerces.xs.XSSimpleTypeDefinition;
+import org.apache.xerces.xs.XSTerm;
+import org.apache.xerces.xs.XSTypeDefinition;
+import org.apache.xerces.xs.datatypes.ObjectList;
 import org.apache.xerces.xs.datatypes.XSDecimal;
 import org.w3c.dom.Document;
 import org.w3c.dom.Element;
@@ -145,6 +167,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: namespace prefixes. */
     private static final String NAMESPACE_PREFIXES =
         Constants.SAX_FEATURE_PREFIX + Constants.NAMESPACE_PREFIXES_FEATURE;
@@ -238,6 +268,19 @@
     private Hashtable fUnparsedIdentityConstraintRegistrySub = new Hashtable();
     private Hashtable fUnparsedNotationRegistrySub = new Hashtable();
     private Hashtable fUnparsedTypeRegistrySub = new Hashtable();
+
+    // Stores XSDocumentInfo (keyed by component name), to check for duplicate
+    // components declared within the same xsd document
+    private Hashtable fUnparsedRegistriesExt[] = new Hashtable[] {
+        null,
+        new Hashtable(), // ATTRIBUTE_TYPE
+        new Hashtable(), // ATTRIBUTEGROUP_TYPE
+        new Hashtable(), // ELEMENT_TYPE
+        new Hashtable(), // GROUP_TYPE
+        new Hashtable(), // IDENTITYCONSTRAINT_TYPE
+        new Hashtable(), // NOTATION_TYPE
+        new Hashtable(), // TYPEDECL_TYPE
+    };
     
     // this is keyed with a documentNode (or the schemaRoot nodes
     // contained in the XSDocumentInfo objects) and its value is the
@@ -348,6 +391,12 @@
     
     //handle multiple import feature
     private boolean fHonourAllSchemaLocations = false;
+    
+    //handle namespace growth feature
+    boolean fNamespaceGrowth = false;
+    
+    // handle tolerate duplicates feature
+    boolean fTolerateDuplicates = false;
 
     // the XMLErrorReporter
     private XMLErrorReporter fErrorReporter;
@@ -381,6 +430,7 @@
     XSDUniqueOrKeyTraverser fUniqueOrKeyTraverser;
     XSDWildcardTraverser fWildCardTraverser;
     
+    SchemaDVFactory fDVFactory;
     SchemaDOMParser fSchemaParser;
     SchemaContentHandler fXSContentHandler;
     StAXSchemaParser fStAXSchemaParser;
@@ -425,6 +475,15 @@
     private XSElementDecl [] fKeyrefElems = new XSElementDecl [INIT_KEYREF_STACK];
     private String [][] fKeyrefNamespaceContext = new String[INIT_KEYREF_STACK][1];
 
+    // global decls: map from decl name to decl object
+    SymbolHash fGlobalAttrDecls = new SymbolHash();
+    SymbolHash fGlobalAttrGrpDecls = new SymbolHash();
+    SymbolHash fGlobalElemDecls = new SymbolHash();
+    SymbolHash fGlobalGroupDecls = new SymbolHash();
+    SymbolHash fGlobalNotationDecls = new SymbolHash();
+    SymbolHash fGlobalIDConstraintDecls = new SymbolHash();
+    SymbolHash fGlobalTypeDecls = new SymbolHash();
+
     // these data members are needed for the deferred traversal
     // of referral identity constraints.
 
@@ -489,14 +548,28 @@
         // no namespace schema.
         if (referType != XSDDescription.CONTEXT_PREPARSE){
             // first try to find it in the bucket/pool, return if one is found
-            if(fHonourAllSchemaLocations &amp;&amp; referType == XSDDescription.CONTEXT_IMPORT &amp;&amp; isExistingGrammar(desc)) {
+            if (fHonourAllSchemaLocations &amp;&amp; referType == XSDDescription.CONTEXT_IMPORT &amp;&amp; isExistingGrammar(desc, fNamespaceGrowth)) {
                 grammar = fGrammarBucket.getGrammar(desc.getTargetNamespace());
             }
             else {
-                grammar = findGrammar(desc);
+                grammar = findGrammar(desc, fNamespaceGrowth);
+            }
+            if (grammar != null) {
+                if (!fNamespaceGrowth) {
+                    return grammar;
+                }
+                else {
+                    try {
+                        if (grammar.getDocumentLocations().contains(XMLEntityManager.expandSystemId(is.getSystemId(), is.getBaseSystemId(), false))) {
+                            return grammar; 
+                        }
+                    }
+                    catch (MalformedURIException e) {
+                        //REVISIT: return the grammar?
+                    }
+                }
             }
-            if (grammar != null)
-                return grammar;
+
             schemaNamespace = desc.getTargetNamespace();
             // handle empty string URI as null
             if (schemaNamespace != null) {
@@ -525,6 +598,9 @@
                     referType == XSDDescription.CONTEXT_PREPARSE,
                     referType, null);
         } // StAXInputSource
+        else if (is instanceof XSInputSource) {
+            schemaRoot = getSchemaDocument((XSInputSource) is, desc);
+        } // XSInputSource
         else {
         	schemaRoot = getSchemaDocument(schemaNamespace, is,
                   referType == XSDDescription.CONTEXT_PREPARSE,
@@ -534,7 +610,10 @@
 
         if (schemaRoot == null) {
             // something went wrong right off the hop
-            return null;
+            if (is instanceof XSInputSource) {
+                return fGrammarBucket.getGrammar(desc.getTargetNamespace());
+            }
+            return grammar;
         }      
         
         if (referType == XSDDescription.CONTEXT_PREPARSE) {
@@ -549,10 +628,14 @@
             else {
                 schemaNamespace = null;
             }
-            grammar = findGrammar(desc);
-            if (grammar != null)
-                return grammar;
+            grammar = findGrammar(desc, fNamespaceGrowth);
             String schemaId = XMLEntityManager.expandSystemId(is.getSystemId(), is.getBaseSystemId(), false);
+            if (grammar != null) {
+                if (!fNamespaceGrowth || grammar.getDocumentLocations().contains(schemaId)) {
+                    return grammar; 
+                }
+            }
+
             XSDKey key = new XSDKey(schemaId, referType, schemaNamespace);
             fTraversed.put(key, schemaRoot);
             if (schemaId != null) {
@@ -564,7 +647,7 @@
         // all traversers and clear all registries
         prepareForTraverse();
         
-        fRoot = constructTrees(schemaRoot, is.getSystemId(), desc);
+        fRoot = constructTrees(schemaRoot, is.getSystemId(), desc, grammar != null);
         if (fRoot == null) {
             return null;
         }
@@ -672,7 +755,7 @@
      * grammar pool. If a grammar is found in the pool, then add it (and all
      * imported ones) into the bucket.
      */
-    protected SchemaGrammar findGrammar(XSDDescription desc) {
+    protected SchemaGrammar findGrammar(XSDDescription desc, boolean ignoreConflict) {
         SchemaGrammar sg = fGrammarBucket.getGrammar(desc.getTargetNamespace());
         if (sg == null) {
             if (fGrammarPool != null) {
@@ -680,7 +763,7 @@
                 if (sg != null) {
                     // put this grammar into the bucket, along with grammars
                     // imported by it (directly or indirectly)
-                    if (!fGrammarBucket.putGrammar(sg, true)) {
+                    if (!fGrammarBucket.putGrammar(sg, true, ignoreConflict)) {
                         // REVISIT: a conflict between new grammar(s) and grammars
                         // in the bucket. What to do? A warning? An exception?
                         reportSchemaWarning("GrammarConflict", null, null);
@@ -721,7 +804,7 @@
     // depends on.
     // It also makes sure the targetNamespace of the schema it was
     // called to parse is correct.
-    protected XSDocumentInfo constructTrees(Element schemaRoot, String locationHint, XSDDescription desc) {
+    protected XSDocumentInfo constructTrees(Element schemaRoot, String locationHint, XSDDescription desc, boolean nsCollision) {
         if (schemaRoot == null) return null;
         String callerTNS = desc.getTargetNamespace();
         short referType = desc.getContextType();
@@ -800,13 +883,29 @@
         currSchemaInfo.addAllowedNS(currSchemaInfo.fTargetNamespace);
         
         SchemaGrammar sg = null;
-        
-        if (referType == XSDDescription.CONTEXT_INCLUDE ||
+
+        // we have a namespace collision
+        if (nsCollision) {
+            SchemaGrammar sg2 = fGrammarBucket.getGrammar(currSchemaInfo.fTargetNamespace);
+            if (sg2.isImmutable()) {
+                sg = new SchemaGrammar(sg2);
+                fGrammarBucket.putGrammar(sg);
+                // update all the grammars in the bucket to point to the new grammar.
+                updateImportListWith(sg);
+            }
+            else {
+                sg = sg2;
+            }
+
+            // update import list of the new grammar
+            updateImportListFor(sg);
+        }
+        else if (referType == XSDDescription.CONTEXT_INCLUDE ||
                 referType == XSDDescription.CONTEXT_REDEFINE) {
             sg = fGrammarBucket.getGrammar(currSchemaInfo.fTargetNamespace);
         }
         else if(fHonourAllSchemaLocations &amp;&amp; referType == XSDDescription.CONTEXT_IMPORT) {
-            sg = findGrammar(desc);
+            sg = findGrammar(desc, false);
             if(sg == null) {
                 sg = new SchemaGrammar(currSchemaInfo.fTargetNamespace, desc.makeClone(), fSymbolTable, fSchemaVersion);
                 fGrammarBucket.putGrammar(sg);
@@ -834,6 +933,7 @@
             String localName = DOMUtil.getLocalName(child);
             
             short refType = -1;
+            boolean importCollision = false;
             
             if (localName.equals(SchemaSymbols.ELT_ANNOTATION))
                 continue;
@@ -846,11 +946,6 @@
                 schemaNamespace = (String)importAttrs[XSAttributeChecker.ATTIDX_NAMESPACE];
                 if (schemaNamespace != null)
                     schemaNamespace = fSymbolTable.addSymbol(schemaNamespace);
-                // a document can't import another document with the same namespace
-                if (schemaNamespace == currSchemaInfo.fTargetNamespace) {
-                    reportSchemaError(schemaNamespace != null ? 
-                            "src-import.1.1" : "src-import.1.2", new Object [] {schemaNamespace}, child);
-                }
                 
                 // check contents and process optional annotations
                 Element importChild = DOMUtil.getFirstChildElement(child);
@@ -875,10 +970,17 @@
                 }
                 fAttributeChecker.returnAttrArray(importAttrs, currSchemaInfo);
                 
+                // a document can't import another document with the same namespace
+                if (schemaNamespace == currSchemaInfo.fTargetNamespace) {
+                    reportSchemaError(schemaNamespace != null ? 
+                            "src-import.1.1" : "src-import.1.2", new Object [] {schemaNamespace}, child);
+                    continue;
+                }
+
                 // if this namespace has not been imported by this document,
                 //  then import if multiple imports support is enabled.
                 if(currSchemaInfo.isAllowedNS(schemaNamespace)) {
-                    if(!fHonourAllSchemaLocations)
+                    if(!fHonourAllSchemaLocations &amp;&amp; !fNamespaceGrowth)
                         continue;
                 }
                 else  {
@@ -910,15 +1012,33 @@
                 
                 // if a grammar with the same namespace and location exists (or being
                 // built), ignore this one (don't traverse it).
-                if ((!fHonourAllSchemaLocations &amp;&amp; findGrammar(fSchemaGrammarDescription) != null) || isExistingGrammar(fSchemaGrammarDescription))
-                    continue;
+                SchemaGrammar isg = findGrammar(fSchemaGrammarDescription, fNamespaceGrowth);
+                if (isg != null) {
+                    if (fNamespaceGrowth) {
+                        try {
+                            if (isg.getDocumentLocations().contains(XMLEntityManager.expandSystemId(schemaHint, fSchemaGrammarDescription.getBaseSystemId(), false))) {
+                                continue;
+                            }
+                            else {
+                                importCollision = true;
+                            }
+                        } 
+                        catch (MalformedURIException e) {
+                        }
+                    }
+                    else if (!fHonourAllSchemaLocations || isExistingGrammar(fSchemaGrammarDescription, false)) {
+                        continue;
+                    }
+                }
+                //if ((!fHonourAllSchemaLocations &amp;&amp; findGrammar(fSchemaGrammarDescription) != null) || isExistingGrammar(fSchemaGrammarDescription))
+                //    continue;
+
                 // If "findGrammar" returns a grammar, then this is not the
                 // the first time we see a location for a given namespace.
                 // Don't consult the location pair hashtable in this case,
                 // otherwise the location will be ignored because it'll get
                 // resolved to the same location as the first hint.
-                newSchemaRoot = resolveSchema(fSchemaGrammarDescription, false, child,
-                                              findGrammar(fSchemaGrammarDescription) == null);
+                newSchemaRoot = resolveSchema(fSchemaGrammarDescription, false, child, isg == null);
             }
             else if ((localName.equals(SchemaSymbols.ELT_INCLUDE)) ||
                     (localName.equals(SchemaSymbols.ELT_REDEFINE))) {
@@ -995,8 +1115,26 @@
                 fSchemaGrammarDescription.setBaseSystemId(doc2SystemId(schemaRoot));
                 fSchemaGrammarDescription.setLocationHints(new String[]{schemaHint});
                 fSchemaGrammarDescription.setTargetNamespace(callerTNS);
-                newSchemaRoot = resolveSchema(fSchemaGrammarDescription, mustResolve, child, true);
-                schemaNamespace = currSchemaInfo.fTargetNamespace;
+                
+                boolean alreadyTraversed = false;
+                XMLInputSource schemaSource = resolveSchemaSource(fSchemaGrammarDescription, mustResolve, child, true);
+                if (fNamespaceGrowth &amp;&amp; refType == XSDDescription.CONTEXT_INCLUDE) {
+                    try {
+                        final String schemaId = XMLEntityManager.expandSystemId(schemaSource.getSystemId(), schemaSource.getBaseSystemId(), false);
+                        alreadyTraversed = sg.getDocumentLocations().contains(schemaId);
+                    }
+                    catch(MalformedURIException e) {
+                        
+                    }
+                }
+
+                if (!alreadyTraversed) {
+                    newSchemaRoot = resolveSchema(schemaSource, fSchemaGrammarDescription, mustResolve, child);
+                    schemaNamespace = currSchemaInfo.fTargetNamespace;
+                }
+                else {
+                    fLastSchemaWasDuplicate = true;
+                }
             }
             else {
                 // no more possibility of schema references in well-formed
@@ -1011,7 +1149,7 @@
                 newSchemaInfo = newSchemaRoot == null ? null : (XSDocumentInfo)fDoc2XSDocumentMap.get(newSchemaRoot);
             }
             else {
-               	newSchemaInfo = constructTrees(newSchemaRoot, schemaHint, fSchemaGrammarDescription);
+               	newSchemaInfo = constructTrees(newSchemaRoot, schemaHint, fSchemaGrammarDescription, importCollision);
             }
             
             if (localName.equals(SchemaSymbols.ELT_REDEFINE) &amp;&amp;
@@ -1031,10 +1169,10 @@
         return currSchemaInfo;
     } // end constructTrees
     
-    private boolean isExistingGrammar(XSDDescription desc) {
+    private boolean isExistingGrammar(XSDDescription desc, boolean ignoreConflict) {
         SchemaGrammar sg = fGrammarBucket.getGrammar(desc.getTargetNamespace());
         if (sg == null) {
-            return findGrammar(desc) != null;
+            return findGrammar(desc, ignoreConflict) != null;
         }
         else if (sg.isImmutable()) {
             return true;
@@ -1048,7 +1186,58 @@
             }
         }
     }
-    
+
+    /**
+     * Namespace growth
+     * 
+     * Go through the import list of a given grammar and for each imported
+     * grammar, check to see if the grammar bucket has a newer version.
+     * If a new instance is found, we update the import list with the
+     * newer version.
+     */
+    private void updateImportListFor(SchemaGrammar grammar) {
+        Vector importedGrammars = grammar.getImportedGrammars();
+        if (importedGrammars != null) {
+            for (int i=0; i&lt;importedGrammars.size(); i++) {
+                SchemaGrammar isg1 = (SchemaGrammar) importedGrammars.elementAt(i);
+                SchemaGrammar isg2 = fGrammarBucket.getGrammar(isg1.getTargetNamespace());
+                if (isg2 != null &amp;&amp; isg1 != isg2) {
+                    importedGrammars.set(i, isg2);
+                }
+            }
+        }
+    }
+
+    /**
+     * Namespace growth
+     * 
+     * Go throuth the grammar bucket, and for each grammar in the bucket
+     * check the import list. If there exists a grammar in import list
+     * that has the same namespace as newGrammar, but a different instance,
+     * then update the import list and replace the old grammar instance with
+     * the new one
+     */
+    private void updateImportListWith(SchemaGrammar newGrammar) {
+        SchemaGrammar[] schemaGrammars = fGrammarBucket.getGrammars();
+        for (int i = 0; i &lt; schemaGrammars.length; ++i) {
+            SchemaGrammar sg = schemaGrammars[i];
+            if (sg != newGrammar) {
+                Vector importedGrammars = sg.getImportedGrammars();
+                if (importedGrammars != null) {
+                    for (int j=0; j&lt;importedGrammars.size(); j++) {
+                        SchemaGrammar isg = (SchemaGrammar) importedGrammars.elementAt(j);
+                        if (null2EmptyString(isg.getTargetNamespace()).equals(null2EmptyString(newGrammar.getTargetNamespace()))) {
+                            if (isg != newGrammar) {
+                                importedGrammars.set(j, newGrammar);
+                            }
+                            break;
+                        }
+                    }
+                }
+            }
+        }
+    }
+
     // This method builds registries for all globally-referenceable
     // names.  A registry will be built for each symbol space defined
     // by the spec.  It is also this method's job to rename redefined
@@ -1114,7 +1303,7 @@
                                     currSchemaDoc.fTargetNamespace +","+lName;
                         String componentType = DOMUtil.getLocalName(redefineComp);
                         if (componentType.equals(SchemaSymbols.ELT_ATTRIBUTEGROUP)) {
-                            checkForDuplicateNames(qName, fUnparsedAttributeGroupRegistry, fUnparsedAttributeGroupRegistrySub, redefineComp, currSchemaDoc);
+                            checkForDuplicateNames(qName, ATTRIBUTEGROUP_TYPE, fUnparsedAttributeGroupRegistry, fUnparsedAttributeGroupRegistrySub, redefineComp, currSchemaDoc);
                             // the check will have changed our name;
                             String targetLName = DOMUtil.getAttrValue(redefineComp, SchemaSymbols.ATT_NAME)+REDEF_IDENTIFIER;
                             // and all we need to do is error-check+rename our kkids:
@@ -1123,7 +1312,7 @@
                         }
                         else if ((componentType.equals(SchemaSymbols.ELT_COMPLEXTYPE)) ||
                                 (componentType.equals(SchemaSymbols.ELT_SIMPLETYPE))) {
-                            checkForDuplicateNames(qName, fUnparsedTypeRegistry, fUnparsedTypeRegistrySub, redefineComp, currSchemaDoc);
+                            checkForDuplicateNames(qName, TYPEDECL_TYPE, fUnparsedTypeRegistry, fUnparsedTypeRegistrySub, redefineComp, currSchemaDoc);
                             // the check will have changed our name;
                             String targetLName = DOMUtil.getAttrValue(redefineComp, SchemaSymbols.ATT_NAME) + REDEF_IDENTIFIER;
                             // and all we need to do is error-check+rename our kkids:
@@ -1137,7 +1326,7 @@
                             }
                         }
                         else if (componentType.equals(SchemaSymbols.ELT_GROUP)) {
-                            checkForDuplicateNames(qName, fUnparsedGroupRegistry, fUnparsedGroupRegistrySub, redefineComp, currSchemaDoc);
+                            checkForDuplicateNames(qName, GROUP_TYPE, fUnparsedGroupRegistry, fUnparsedGroupRegistrySub, redefineComp, currSchemaDoc);
                             // the check will have changed our name;
                             String targetLName = DOMUtil.getAttrValue(redefineComp, SchemaSymbols.ATT_NAME)+REDEF_IDENTIFIER;
                             // and all we need to do is error-check+rename our kids:
@@ -1169,23 +1358,23 @@
                             ","+lName:
                                 currSchemaDoc.fTargetNamespace +","+lName;
                     if (componentType.equals(SchemaSymbols.ELT_ATTRIBUTE)) {
-                        checkForDuplicateNames(qName, fUnparsedAttributeRegistry, fUnparsedAttributeRegistrySub, globalComp, currSchemaDoc);
+                        checkForDuplicateNames(qName, ATTRIBUTE_TYPE, fUnparsedAttributeRegistry, fUnparsedAttributeRegistrySub, globalComp, currSchemaDoc);
                     }
                     else if (componentType.equals(SchemaSymbols.ELT_ATTRIBUTEGROUP)) {
-                        checkForDuplicateNames(qName, fUnparsedAttributeGroupRegistry, fUnparsedAttributeGroupRegistrySub, globalComp, currSchemaDoc);
+                        checkForDuplicateNames(qName, ATTRIBUTEGROUP_TYPE, fUnparsedAttributeGroupRegistry, fUnparsedAttributeGroupRegistrySub, globalComp, currSchemaDoc);
                     }
                     else if ((componentType.equals(SchemaSymbols.ELT_COMPLEXTYPE)) ||
                             (componentType.equals(SchemaSymbols.ELT_SIMPLETYPE))) {
-                        checkForDuplicateNames(qName, fUnparsedTypeRegistry, fUnparsedTypeRegistrySub, globalComp, currSchemaDoc);
+                        checkForDuplicateNames(qName, TYPEDECL_TYPE, fUnparsedTypeRegistry, fUnparsedTypeRegistrySub, globalComp, currSchemaDoc);
                     }
                     else if (componentType.equals(SchemaSymbols.ELT_ELEMENT)) {
-                        checkForDuplicateNames(qName, fUnparsedElementRegistry, fUnparsedElementRegistrySub, globalComp, currSchemaDoc);
+                        checkForDuplicateNames(qName, ELEMENT_TYPE, fUnparsedElementRegistry, fUnparsedElementRegistrySub, globalComp, currSchemaDoc);
                     }
                     else if (componentType.equals(SchemaSymbols.ELT_GROUP)) {
-                        checkForDuplicateNames(qName, fUnparsedGroupRegistry, fUnparsedGroupRegistrySub, globalComp, currSchemaDoc);
+                        checkForDuplicateNames(qName, GROUP_TYPE, fUnparsedGroupRegistry, fUnparsedGroupRegistrySub, globalComp, currSchemaDoc);
                     }
                     else if (componentType.equals(SchemaSymbols.ELT_NOTATION)) {
-                        checkForDuplicateNames(qName, fUnparsedNotationRegistry, fUnparsedNotationRegistrySub, globalComp, currSchemaDoc);
+                        checkForDuplicateNames(qName, NOTATION_TYPE, fUnparsedNotationRegistry, fUnparsedNotationRegistrySub, globalComp, currSchemaDoc);
                     }
                 }
             } // end for
@@ -1379,7 +1568,112 @@
             "Internal-Error",
             "st-props-correct.2",       //or ct-props-correct.3
     };
-    
+
+    // add a global attribute decl from a current schema load (only if no existing decl is found)
+    void addGlobalAttributeDecl(XSAttributeDecl decl) {
+        final String namespace = decl.getNamespace();
+        final String declKey = (namespace == null || namespace.length() == 0)
+            ? "," + decl.getName() : namespace + "," + decl.getName();
+
+        if (fGlobalAttrDecls.get(declKey) == null) {
+            fGlobalAttrDecls.put(declKey, decl);
+        }
+    }
+
+    // add a global attribute group decl from a current schema load (only if no existing decl is found)
+    void addGlobalAttributeGroupDecl(XSAttributeGroupDecl decl) {
+        final String namespace = decl.getNamespace();
+        final String declKey = (namespace == null || namespace.length() == 0)
+            ? "," + decl.getName() : namespace + "," + decl.getName();
+
+        if (fGlobalAttrGrpDecls.get(declKey) == null) {
+            fGlobalAttrGrpDecls.put(declKey, decl);
+        }
+    }
+
+    // add a global element decl from a current schema load (only if no existing decl is found)
+    void addGlobalElementDecl(XSElementDecl decl) {
+        final String namespace = decl.getNamespace();
+        final String declKey = (namespace == null || namespace.length() == 0)
+            ? "," + decl.getName() : namespace + "," + decl.getName();
+
+        if (fGlobalElemDecls.get(declKey) == null) {
+            fGlobalElemDecls.put(declKey, decl);
+        }
+    }
+
+    // add a global group decl from a current schema load (only if no existing decl is found)
+    void addGlobalGroupDecl(XSGroupDecl decl) {
+        final String namespace = decl.getNamespace();
+        final String declKey = (namespace == null || namespace.length() == 0)
+            ? "," + decl.getName() : namespace + "," + decl.getName();
+
+        if (fGlobalGroupDecls.get(declKey) == null) {
+            fGlobalGroupDecls.put(declKey, decl);
+        }
+    }
+
+    // add a global notation decl from a current schema load (only if no existing decl is found)
+    void addGlobalNotationDecl(XSNotationDecl decl) {
+        final String namespace = decl.getNamespace();
+        final String declKey = (namespace == null || namespace.length() == 0)
+            ? "," + decl.getName() : namespace + "," + decl.getName();
+
+        if (fGlobalNotationDecls.get(declKey) == null) {
+            fGlobalNotationDecls.put(declKey, decl);
+        }
+    }
+
+    // add a global type decl from a current schema load (only if no existing decl is found)
+    void addGlobalTypeDecl(XSTypeDefinition decl) {
+        final String namespace = decl.getNamespace();
+        final String declKey = (namespace == null || namespace.length() == 0)
+            ? "," + decl.getName() : namespace + "," + decl.getName();
+
+        if (fGlobalTypeDecls.get(declKey) == null) {
+            fGlobalTypeDecls.put(declKey, decl);
+        }
+    }
+
+    // add a identity constraint decl from a current schema load (only if no existing decl is found)
+    void addIDConstraintDecl(IdentityConstraint decl) {
+        final String namespace = decl.getNamespace();
+        final String declKey = (namespace == null || namespace.length() == 0)
+            ? "," + decl.getIdentityConstraintName() : namespace + "," + decl.getIdentityConstraintName();
+
+        if (fGlobalIDConstraintDecls.get(declKey) == null) {
+            fGlobalIDConstraintDecls.put(declKey, decl);
+        }
+    }
+
+    private XSAttributeDecl getGlobalAttributeDecl(String declKey) {
+        return (XSAttributeDecl)fGlobalAttrDecls.get(declKey);
+    }
+
+    private XSAttributeGroupDecl getGlobalAttributeGroupDecl(String declKey) {
+        return (XSAttributeGroupDecl)fGlobalAttrGrpDecls.get(declKey);
+    }
+
+    private XSElementDecl getGlobalElementDecl(String declKey) {
+        return (XSElementDecl)fGlobalElemDecls.get(declKey);
+    }
+
+    private XSGroupDecl getGlobalGroupDecl(String declKey) {
+        return (XSGroupDecl)fGlobalGroupDecls.get(declKey);
+    }
+
+    private XSNotationDecl getGlobalNotationDecl(String declKey) {
+        return (XSNotationDecl)fGlobalNotationDecls.get(declKey);
+    }
+
+    private XSTypeDefinition getGlobalTypeDecl(String declKey) {
+        return (XSTypeDefinition)fGlobalTypeDecls.get(declKey);
+    }
+
+    private IdentityConstraint getIDConstraintDecl(String declKey) {
+        return (IdentityConstraint)fGlobalIDConstraintDecls.get(declKey);
+    }
+
     // since it is forbidden for traversers to talk to each other
     // directly (except wen a traverser encounters a local declaration),
     // this provides a generic means for a traverser to call
@@ -1426,7 +1720,7 @@
                     return retObj;
             }
         }
-        
+
         // now check whether this document can access the requsted namespace
         if (!currSchema.isAllowedNS(declToTraverse.uri)) {
             // cannot get to this schema from the one containing the requesting decl
@@ -1434,9 +1728,10 @@
                 String code = declToTraverse.uri == null ? "src-resolve.4.1" : "src-resolve.4.2";
                 reportSchemaError(code, new Object[]{fDoc2SystemId.get(currSchema.fSchemaElement), declToTraverse.uri, declToTraverse.rawname}, elmNode);
             }
-            return null;
+            // Recover and continue to look for the component.
+            // return null;
         }
-        
+
         // check whether there is grammar for the requested namespace
         SchemaGrammar sGrammar = fGrammarBucket.getGrammar(declToTraverse.uri);
         if (sGrammar == null) {
@@ -1444,44 +1739,30 @@
                 reportSchemaError("src-resolve", new Object[]{declToTraverse.rawname, COMP_TYPE[declType]}, elmNode);
             return null;
         }
-        
+
         // if there is such grammar, check whether the requested component is in the grammar
-        Object retObj = null;
-        switch (declType) {
-        case ATTRIBUTE_TYPE :
-            retObj = sGrammar.getGlobalAttributeDecl(declToTraverse.localpart);
-            break;
-        case ATTRIBUTEGROUP_TYPE :
-            retObj = sGrammar.getGlobalAttributeGroupDecl(declToTraverse.localpart);
-            break;
-        case ELEMENT_TYPE :
-            retObj = sGrammar.getGlobalElementDecl(declToTraverse.localpart);
-            break;
-        case GROUP_TYPE :
-            retObj = sGrammar.getGlobalGroupDecl(declToTraverse.localpart);
-            break;
-        case IDENTITYCONSTRAINT_TYPE :
-            retObj = sGrammar.getIDConstraintDecl(declToTraverse.localpart);
-            break;
-        case NOTATION_TYPE :
-            retObj = sGrammar.getGlobalNotationDecl(declToTraverse.localpart);
-            break;
-        case TYPEDECL_TYPE :
-            retObj = sGrammar.getGlobalTypeDecl(declToTraverse.localpart);
-            break;
-        }
+        Object retObj = getGlobalDeclFromGrammar(sGrammar, declType, declToTraverse.localpart);
+        String declKey = declToTraverse.uri == null? ","+declToTraverse.localpart:
+            declToTraverse.uri+","+declToTraverse.localpart;
         
         // if the component is parsed, return it
-        if (retObj != null)
-            return retObj;
-        
+        if (!fTolerateDuplicates) {
+            if (retObj != null) {
+                return retObj;
+            }
+        }
+        else {
+            Object retObj2 = getGlobalDecl(declKey, declType);
+            if (retObj2 != null) {
+                return retObj2;
+            }
+        }
+
         XSDocumentInfo schemaWithDecl = null;
         Element decl = null;
         XSDocumentInfo declDoc = null;
-        
+
         // the component is not parsed, try to find a DOM element for it
-        String declKey = declToTraverse.uri == null? ","+declToTraverse.localpart:
-            declToTraverse.uri+","+declToTraverse.localpart;
         switch (declType) {
         case ATTRIBUTE_TYPE :
             decl = (Element)fUnparsedAttributeRegistry.get(declKey);
@@ -1514,119 +1795,231 @@
         default:
             reportSchemaError("Internal-Error", new Object [] {"XSDHandler asked to locate component of type " + declType + "; it does not recognize this type!"}, elmNode);
         }
-        
+
         // no DOM element found, so the component can't be located
         if (decl == null) {
-            reportSchemaError("src-resolve", new Object[]{declToTraverse.rawname, COMP_TYPE[declType]}, elmNode);
-            return null;
+            if (retObj == null) {
+                reportSchemaError("src-resolve", new Object[]{declToTraverse.rawname, COMP_TYPE[declType]}, elmNode);
+            }
+            return retObj;
         }
-        
+
         // get the schema doc containing the component to be parsed
         // it should always return non-null value, but since null-checking
         // comes for free, let's be safe and check again
         schemaWithDecl = findXSDocumentForDecl(currSchema, decl, declDoc);
         if (schemaWithDecl == null) {
             // cannot get to this schema from the one containing the requesting decl
-            String code = declToTraverse.uri == null ? "src-resolve.4.1" : "src-resolve.4.2";
-            reportSchemaError(code, new Object[]{fDoc2SystemId.get(currSchema.fSchemaElement), declToTraverse.uri, declToTraverse.rawname}, elmNode);
-            return null;
+            if (retObj == null) {
+                String code = declToTraverse.uri == null ? "src-resolve.4.1" : "src-resolve.4.2";
+                reportSchemaError(code, new Object[]{fDoc2SystemId.get(currSchema.fSchemaElement), declToTraverse.uri, declToTraverse.rawname}, elmNode);
+            }
+            return retObj;
         }
+
         // a component is hidden, meaning either it's traversed, or being traversed.
         // but we didn't find it in the grammar, so it's the latter case, and
         // a circular reference. error!
         if (DOMUtil.isHidden(decl, fHiddenNodes)) {
-            String code = CIRCULAR_CODES[declType];
-            if (declType == TYPEDECL_TYPE) {
-                if (SchemaSymbols.ELT_COMPLEXTYPE.equals(DOMUtil.getLocalName(decl)))
-                    code = "ct-props-correct.3";
+            if (retObj == null) {
+                String code = CIRCULAR_CODES[declType];
+                if (declType == TYPEDECL_TYPE) {
+                    if (SchemaSymbols.ELT_COMPLEXTYPE.equals(DOMUtil.getLocalName(decl))) {
+                        code = "ct-props-correct.3";
+                    }
+                }
+                // decl must not be null if we're here...
+                reportSchemaError(code, new Object [] {declToTraverse.prefix+":"+declToTraverse.localpart}, elmNode);
             }
-            // decl must not be null if we're here...
-            reportSchemaError(code, new Object [] {declToTraverse.prefix+":"+declToTraverse.localpart}, elmNode);
-            return null;
+            return retObj;
         }
-        
-        DOMUtil.setHidden(decl, fHiddenNodes);
-        SchemaNamespaceSupport nsSupport = null;
-        // if the parent is &lt;redefine&gt; use the namespace delcs for it.
-        Element parent = DOMUtil.getParent(decl);
-        if (DOMUtil.getLocalName(parent).equals(SchemaSymbols.ELT_REDEFINE))
-            nsSupport = (SchemaNamespaceSupport)fRedefine2NSSupport.get(parent);
-        // back up the current SchemaNamespaceSupport, because we need to provide
-        // a fresh one to the traverseGlobal methods.
-        schemaWithDecl.backupNSSupport(nsSupport);
-        
-        // traverse the referenced global component
+
+        return traverseGlobalDecl(declType, decl, schemaWithDecl, sGrammar);
+    } // getGlobalDecl(XSDocumentInfo, int, QName):  Object
+
+    // If we are tolerating duplicate declarations and allowing namespace growth
+    // use the declaration from the current schema load (if it exists)
+    protected Object getGlobalDecl(String declKey, int declType) {
+        Object retObj = null;
+
         switch (declType) {
         case ATTRIBUTE_TYPE :
-            retObj = fAttributeTraverser.traverseGlobal(decl, schemaWithDecl, sGrammar);
+            retObj = getGlobalAttributeDecl(declKey);
             break;
         case ATTRIBUTEGROUP_TYPE :
-            retObj = fAttributeGroupTraverser.traverseGlobal(decl, schemaWithDecl, sGrammar);
+            retObj = getGlobalAttributeGroupDecl(declKey);
             break;
         case ELEMENT_TYPE :
-            retObj = fElementTraverser.traverseGlobal(decl, schemaWithDecl, sGrammar);
+            retObj = getGlobalElementDecl(declKey);
             break;
         case GROUP_TYPE :
-            retObj = fGroupTraverser.traverseGlobal(decl, schemaWithDecl, sGrammar);
+            retObj = getGlobalGroupDecl(declKey);
             break;
         case IDENTITYCONSTRAINT_TYPE :
-            // identity constraints should have been parsed already...
-            // we should never get here
-            retObj = null;
+            retObj = getIDConstraintDecl(declKey);
             break;
         case NOTATION_TYPE :
-            retObj = fNotationTraverser.traverse(decl, schemaWithDecl, sGrammar);
+            retObj = getGlobalNotationDecl(declKey);
             break;
         case TYPEDECL_TYPE :
-            if (DOMUtil.getLocalName(decl).equals(SchemaSymbols.ELT_COMPLEXTYPE))
-                retObj = fComplexTypeTraverser.traverseGlobal(decl, schemaWithDecl, sGrammar);
-            else
-                retObj = fSimpleTypeTraverser.traverseGlobal(decl, schemaWithDecl, sGrammar);
+            retObj = getGlobalTypeDecl(declKey);
+            break;
         }
-        
-        // restore the previous SchemaNamespaceSupport, so that the caller can get
-        // proper namespace binding.
-        schemaWithDecl.restoreNSSupport();
-        
+
         return retObj;
-    } // getGlobalDecl(XSDocumentInfo, int, QName):  Object
-    
-    // This method determines whether there is a group
-    // (attributeGroup) which the given one has redefined by
-    // restriction.  If so, it returns it; else it returns null.
-    // @param type:  whether what's been redefined is an
-    // attributeGroup or a group;
-    // @param name:  the QName of the component doing the redefining.
-    // @param currSchema:  schema doc in which the redefining component lives.
-    // @return:  Object representing decl redefined if present, null
-    // otherwise.
-    Object getGrpOrAttrGrpRedefinedByRestriction(int type, QName name, XSDocumentInfo currSchema, Element elmNode) {
-        String realName = name.uri != null?name.uri+","+name.localpart:
-            ","+name.localpart;
-        String nameToFind = null;
-        switch (type) {
-        case ATTRIBUTEGROUP_TYPE:
-            nameToFind = (String)fRedefinedRestrictedAttributeGroupRegistry.get(realName);
+    }
+
+    protected Object getGlobalDeclFromGrammar(SchemaGrammar sGrammar, int declType, String localpart) {
+        Object retObj = null;
+
+        switch (declType) {
+        case ATTRIBUTE_TYPE :
+            retObj = sGrammar.getGlobalAttributeDecl(localpart);
             break;
-        case GROUP_TYPE:
-            nameToFind = (String)fRedefinedRestrictedGroupRegistry.get(realName);
+        case ATTRIBUTEGROUP_TYPE :
+            retObj = sGrammar.getGlobalAttributeGroupDecl(localpart);
+            break;
+        case ELEMENT_TYPE :
+            retObj = sGrammar.getGlobalElementDecl(localpart);
+            break;
+        case GROUP_TYPE :
+            retObj = sGrammar.getGlobalGroupDecl(localpart);
+            break;
+        case IDENTITYCONSTRAINT_TYPE :
+            retObj = sGrammar.getIDConstraintDecl(localpart);
+            break;
+        case NOTATION_TYPE :
+            retObj = sGrammar.getGlobalNotationDecl(localpart);
+            break;
+        case TYPEDECL_TYPE :
+            retObj = sGrammar.getGlobalTypeDecl(localpart);
             break;
-        default:
-            return null;
         }
-        if (nameToFind == null) return null;
-        int commaPos = nameToFind.indexOf(",");
-        QName qNameToFind = new QName(XMLSymbols.EMPTY_STRING, nameToFind.substring(commaPos+1),
-                nameToFind.substring(commaPos), (commaPos == 0)? null : nameToFind.substring(0, commaPos));
-        Object retObj = getGlobalDecl(currSchema, type, qNameToFind, elmNode);
-        if(retObj == null) {
-            switch (type) {
-            case ATTRIBUTEGROUP_TYPE:
-                reportSchemaError("src-redefine.7.2.1", new Object []{name.localpart}, elmNode);
-                break;
-            case GROUP_TYPE:
-                reportSchemaError("src-redefine.6.2.1", new Object []{name.localpart}, elmNode);
-                break;
+
+        return retObj;
+    }
+
+    protected Object getGlobalDeclFromGrammar(SchemaGrammar sGrammar, int declType, String localpart, String schemaLoc) {
+        Object retObj = null;
+
+        switch (declType) {
+        case ATTRIBUTE_TYPE :
+            retObj = sGrammar.getGlobalAttributeDecl(localpart, schemaLoc);
+            break;
+        case ATTRIBUTEGROUP_TYPE :
+            retObj = sGrammar.getGlobalAttributeGroupDecl(localpart, schemaLoc);
+            break;
+        case ELEMENT_TYPE :
+            retObj = sGrammar.getGlobalElementDecl(localpart, schemaLoc);
+            break;
+        case GROUP_TYPE :
+            retObj = sGrammar.getGlobalGroupDecl(localpart, schemaLoc);
+            break;
+        case IDENTITYCONSTRAINT_TYPE :
+            retObj = sGrammar.getIDConstraintDecl(localpart, schemaLoc);
+            break;
+        case NOTATION_TYPE :
+            retObj = sGrammar.getGlobalNotationDecl(localpart, schemaLoc);
+            break;
+        case TYPEDECL_TYPE :
+            retObj = sGrammar.getGlobalTypeDecl(localpart, schemaLoc);
+            break;
+        }
+
+        return retObj;
+    }
+
+    protected Object traverseGlobalDecl(int declType, Element decl, XSDocumentInfo schemaDoc, SchemaGrammar grammar) {
+        Object retObj = null;
+
+        DOMUtil.setHidden(decl, fHiddenNodes);
+        SchemaNamespaceSupport nsSupport = null;
+        // if the parent is &lt;redefine&gt; use the namespace delcs for it.
+        Element parent = DOMUtil.getParent(decl);
+        if (DOMUtil.getLocalName(parent).equals(SchemaSymbols.ELT_REDEFINE))
+            nsSupport = (SchemaNamespaceSupport)fRedefine2NSSupport.get(parent);
+        // back up the current SchemaNamespaceSupport, because we need to provide
+        // a fresh one to the traverseGlobal methods.
+        schemaDoc.backupNSSupport(nsSupport);
+
+        // traverse the referenced global component
+        switch (declType) {
+        case TYPEDECL_TYPE :
+            if (DOMUtil.getLocalName(decl).equals(SchemaSymbols.ELT_COMPLEXTYPE)) {
+                retObj = fComplexTypeTraverser.traverseGlobal(decl, schemaDoc, grammar);
+            }
+            else {
+                retObj = fSimpleTypeTraverser.traverseGlobal(decl, schemaDoc, grammar);
+            }
+            break;
+        case ATTRIBUTE_TYPE :
+            retObj = fAttributeTraverser.traverseGlobal(decl, schemaDoc, grammar);
+            break;            
+        case ELEMENT_TYPE :
+            retObj = fElementTraverser.traverseGlobal(decl, schemaDoc, grammar);
+            break;
+        case ATTRIBUTEGROUP_TYPE :
+            retObj = fAttributeGroupTraverser.traverseGlobal(decl, schemaDoc, grammar);
+            break;
+        case GROUP_TYPE :
+            retObj = fGroupTraverser.traverseGlobal(decl, schemaDoc, grammar);
+            break;
+        case NOTATION_TYPE :
+            retObj = fNotationTraverser.traverse(decl, schemaDoc, grammar);
+            break;
+        case IDENTITYCONSTRAINT_TYPE :
+            // identity constraints should have been parsed already...
+            // we should never get here
+            break;            
+        }
+
+        // restore the previous SchemaNamespaceSupport, so that the caller can get
+        // proper namespace binding.
+        schemaDoc.restoreNSSupport();
+
+        return retObj;
+    }
+
+    public String schemaDocument2SystemId(XSDocumentInfo schemaDoc) {
+        return (String)fDoc2SystemId.get(schemaDoc.fSchemaElement);
+    }
+    
+    // This method determines whether there is a group
+    // (attributeGroup) which the given one has redefined by
+    // restriction.  If so, it returns it; else it returns null.
+    // @param type:  whether what's been redefined is an
+    // attributeGroup or a group;
+    // @param name:  the QName of the component doing the redefining.
+    // @param currSchema:  schema doc in which the redefining component lives.
+    // @return:  Object representing decl redefined if present, null
+    // otherwise.
+    Object getGrpOrAttrGrpRedefinedByRestriction(int type, QName name, XSDocumentInfo currSchema, Element elmNode) {
+        String realName = name.uri != null?name.uri+","+name.localpart:
+            ","+name.localpart;
+        String nameToFind = null;
+        switch (type) {
+        case ATTRIBUTEGROUP_TYPE:
+            nameToFind = (String)fRedefinedRestrictedAttributeGroupRegistry.get(realName);
+            break;
+        case GROUP_TYPE:
+            nameToFind = (String)fRedefinedRestrictedGroupRegistry.get(realName);
+            break;
+        default:
+            return null;
+        }
+        if (nameToFind == null) return null;
+        int commaPos = nameToFind.indexOf(",");
+        QName qNameToFind = new QName(XMLSymbols.EMPTY_STRING, nameToFind.substring(commaPos+1),
+                nameToFind.substring(commaPos), (commaPos == 0)? null : nameToFind.substring(0, commaPos));
+        Object retObj = getGlobalDecl(currSchema, type, qNameToFind, elmNode);
+        if(retObj == null) {
+            switch (type) {
+            case ATTRIBUTEGROUP_TYPE:
+                reportSchemaError("src-redefine.7.2.1", new Object []{name.localpart}, elmNode);
+                break;
+            case GROUP_TYPE:
+                reportSchemaError("src-redefine.6.2.1", new Object []{name.localpart}, elmNode);
+                break;
             }
             return null;
         }
@@ -1693,7 +2086,7 @@
         if (keyrefName.length() != 0) {
             String keyrefQName = schemaDoc.fTargetNamespace == null?
                     "," + keyrefName: schemaDoc.fTargetNamespace+","+keyrefName;
-            checkForDuplicateNames(keyrefQName, fUnparsedIdentityConstraintRegistry, fUnparsedIdentityConstraintRegistrySub, keyrefToStore, schemaDoc);
+            checkForDuplicateNames(keyrefQName, IDENTITYCONSTRAINT_TYPE, fUnparsedIdentityConstraintRegistry, fUnparsedIdentityConstraintRegistrySub, keyrefToStore, schemaDoc);
         }
         // now set up all the registries we'll need...
         
@@ -1775,16 +2168,61 @@
             }
         }
         if (schemaSource instanceof DOMInputSource) {
-            return getSchemaDocument(desc.getTargetNamespace(), (DOMInputSource) schemaSource, mustResolve, desc.getContextType(), referElement);
+            return getSchemaDocument(desc.getTargetNamespace(), (DOMInputSource) schemaSource, mustResolve, desc.getContextType(), referElement);    
         } // DOMInputSource
         else if (schemaSource instanceof SAXInputSource) {
-            return getSchemaDocument(desc.getTargetNamespace(), (SAXInputSource) schemaSource, mustResolve, desc.getContextType(), referElement);    
+            return getSchemaDocument(desc.getTargetNamespace(), (SAXInputSource) schemaSource, mustResolve, desc.getContextType(), referElement);         
         } // SAXInputSource
         else if (schemaSource instanceof StAXInputSource) {
-            return getSchemaDocument(desc.getTargetNamespace(), (StAXInputSource) schemaSource, mustResolve, desc.getContextType(), referElement);
+            return getSchemaDocument(desc.getTargetNamespace(), (StAXInputSource) schemaSource, mustResolve, desc.getContextType(), referElement); 
         } // StAXInputSource
+        else if (schemaSource instanceof XSInputSource) {
+            return getSchemaDocument((XSInputSource) schemaSource, desc);
+        } // XSInputSource
         return getSchemaDocument(desc.getTargetNamespace(), schemaSource, mustResolve, desc.getContextType(), referElement);
     } // getSchema(String, String, String, boolean, short):  Document
+
+    private Element resolveSchema(XMLInputSource schemaSource, XSDDescription desc,
+            boolean mustResolve, Element referElement) {
+
+        if (schemaSource instanceof DOMInputSource) {
+            return getSchemaDocument(desc.getTargetNamespace(), (DOMInputSource) schemaSource, mustResolve, desc.getContextType(), referElement);    
+        } // DOMInputSource
+        else if (schemaSource instanceof SAXInputSource) {
+            return getSchemaDocument(desc.getTargetNamespace(), (SAXInputSource) schemaSource, mustResolve, desc.getContextType(), referElement);         
+        } // SAXInputSource
+        else if (schemaSource instanceof StAXInputSource) {
+            return getSchemaDocument(desc.getTargetNamespace(), (StAXInputSource) schemaSource, mustResolve, desc.getContextType(), referElement); 
+        } // StAXInputSource
+        else if (schemaSource instanceof XSInputSource) {
+            return getSchemaDocument((XSInputSource) schemaSource, desc);
+        } // XSInputSource
+        return getSchemaDocument(desc.getTargetNamespace(), schemaSource, mustResolve, desc.getContextType(), referElement);
+    }
+
+    private XMLInputSource resolveSchemaSource(XSDDescription desc, boolean mustResolve,
+            Element referElement, boolean usePairs) {
+
+        XMLInputSource schemaSource = null;
+        try {
+            Hashtable pairs = usePairs ? fLocationPairs : EMPTY_TABLE;
+            schemaSource = XMLSchemaLoader.resolveDocument(desc, pairs, fEntityResolver);
+        }
+        catch (IOException ex) {
+            if (mustResolve) {
+                reportSchemaError("schema_reference.4",
+                        new Object[]{desc.getLocationHints()[0]},
+                        referElement);
+            }
+            else {
+                reportSchemaWarning("schema_reference.4",
+                        new Object[]{desc.getLocationHints()[0]},
+                        referElement);
+            }
+        }
+        
+        return schemaSource;
+    }
     
     /**
      * getSchemaDocument method uses XMLInputSource to parse a schema document.
@@ -2139,6 +2577,893 @@
         return null;
     } // getSchemaDocument1(boolean, boolean, XMLInputSource, Element): Element
     
+    /**
+     * getSchemaDocument method uses XMLInputSource to parse a schema document.
+     * @param schemaNamespace
+     * @param schemaSource
+     * @param mustResolve
+     * @param referType
+     * @param referElement
+     * @return A schema Element.
+     */
+    private Element getSchemaDocument(XSInputSource schemaSource, XSDDescription desc) {
+
+        SchemaGrammar[] grammars = schemaSource.getGrammars();
+        short referType = desc.getContextType();
+        
+        if (grammars != null &amp;&amp; grammars.length &gt; 0) {
+            Vector expandedGrammars = expandGrammars(grammars);
+            // check for existing grammars in our bucket
+            // and if there exist any, and namespace growth is
+            // not enabled - we do nothing
+            if (fNamespaceGrowth || !existingGrammars(expandedGrammars)) {
+                addGrammars(expandedGrammars);
+                if (referType == XSDDescription.CONTEXT_PREPARSE) {
+                    desc.setTargetNamespace(grammars[0].getTargetNamespace());
+                }
+            }
+        }
+        else {
+            XSObject[] components = schemaSource.getComponents();
+            if (components != null &amp;&amp; components.length &gt; 0) {
+                Hashtable importDependencies = new Hashtable();
+                Vector expandedComponents = expandComponents(components, importDependencies);
+                if (fNamespaceGrowth || canAddComponents(expandedComponents)) {
+                    addGlobalComponents(expandedComponents, importDependencies);
+                    if (referType == XSDDescription.CONTEXT_PREPARSE) {
+                        desc.setTargetNamespace(components[0].getNamespace());
+                    }
+                }
+            }
+        }
+        return null;
+    } // getSchemaDocument(String, XSInputSource, boolean, short, Element): Element
+
+    private Vector expandGrammars(SchemaGrammar[] grammars) {
+        Vector currGrammars = new Vector();
+
+        for (int i=0; i&lt;grammars.length; i++) {
+            if (!currGrammars.contains(grammars[i])) {
+                currGrammars.add(grammars[i]);
+            }
+        }
+
+        // for all (recursively) imported grammars
+        SchemaGrammar sg1, sg2;
+        Vector gs;
+        for (int i = 0; i &lt; currGrammars.size(); i++) {
+            // get the grammar
+            sg1 = (SchemaGrammar)currGrammars.elementAt(i);
+            // we need to add grammars imported by sg1 too
+            gs = sg1.getImportedGrammars();
+            // for all grammars imported by sg2, but not in the vector
+            // we add them to the vector
+            if (gs == null) {
+                continue;
+            }
+
+            for (int j = gs.size() - 1; j &gt;= 0; j--) {
+                sg2 = (SchemaGrammar)gs.elementAt(j);
+                if (!currGrammars.contains(sg2)) {
+                    currGrammars.addElement(sg2);
+                }
+            }
+        }
+
+        return currGrammars;
+    }
+
+    private boolean existingGrammars(Vector grammars) {
+        int length = grammars.size();
+        final XSDDescription desc = new XSDDescription();
+        
+        for (int i=0; i &lt; length; i++) {
+            final SchemaGrammar sg1 = (SchemaGrammar)grammars.elementAt(i);
+            desc.setNamespace(sg1.getTargetNamespace());
+            
+            final SchemaGrammar sg2 = findGrammar(desc, false);
+            if (sg2 != null) {
+                return true;
+            }
+        }
+
+        return false;
+    }
+
+    private boolean canAddComponents(Vector components) {
+        final int size = components.size();
+        final XSDDescription desc = new XSDDescription(); 
+        for (int i=0; i&lt;size; i++) {
+            XSObject component = (XSObject) components.elementAt(i);
+            if (!canAddComponent(component, desc)) {
+                return false;
+            }
+        }
+        return true;
+    }
+
+    private boolean canAddComponent(XSObject component, XSDDescription desc) {
+        desc.setNamespace(component.getNamespace());
+
+        final SchemaGrammar sg = findGrammar(desc, false);
+        if (sg == null) {
+            return true;
+        }
+        else if (sg.isImmutable()) {
+            return false;
+        }
+
+        short componentType = component.getType();
+        final String name = component.getName();
+
+        switch (componentType) {
+        case XSConstants.TYPE_DEFINITION :
+            if (sg.getGlobalTypeDecl(name) == component) {
+                return true;
+            }
+            break;
+        case XSConstants.ATTRIBUTE_DECLARATION :
+            if (sg.getGlobalAttributeDecl(name) == component) {
+                return true;
+            }
+            break;
+        case XSConstants.ATTRIBUTE_GROUP :
+            if (sg.getGlobalAttributeDecl(name) == component) {
+                return true;
+            }
+            break;
+        case XSConstants.ELEMENT_DECLARATION :
+            if (sg.getGlobalElementDecl(name) == component) {
+                return true;
+            }
+            break;
+        case XSConstants.MODEL_GROUP_DEFINITION :
+            if (sg.getGlobalGroupDecl(name) == component) {
+                return true;
+            }
+            break;
+        case XSConstants.NOTATION_DECLARATION :
+            if (sg.getGlobalNotationDecl(name) == component) {
+                return true;
+            }
+            break;
+        case XSConstants.IDENTITY_CONSTRAINT :
+        case XSConstants.ATTRIBUTE_USE :
+        default :
+            return true;
+        }
+        return false;
+    }
+
+    private void addGrammars(Vector grammars) {
+        int length = grammars.size();
+        XSDDescription desc = new XSDDescription();
+        
+        for (int i=0; i &lt; length; i++) {
+            final SchemaGrammar sg1 = (SchemaGrammar)grammars.elementAt(i);
+            desc.setNamespace(sg1.getTargetNamespace());
+
+            final SchemaGrammar sg2 = findGrammar(desc, fNamespaceGrowth);
+            if (sg1 != sg2) {
+                addGrammarComponents(sg1, sg2);
+            }
+        }
+    }
+
+    private void addGrammarComponents(SchemaGrammar srcGrammar, SchemaGrammar dstGrammar) {
+        if (dstGrammar == null) {
+            createGrammarFrom(srcGrammar);
+            return;
+        }
+
+        SchemaGrammar tmpGrammar = dstGrammar;
+        if (tmpGrammar.isImmutable()) {
+            tmpGrammar = createGrammarFrom(dstGrammar);
+        }
+
+        // add any new locations
+        addNewGrammarLocations(srcGrammar, tmpGrammar);
+        
+        // add any new imported grammars
+        addNewImportedGrammars(srcGrammar, tmpGrammar);
+
+        // add any new global components
+        addNewGrammarComponents(srcGrammar, tmpGrammar);
+    }
+
+    private SchemaGrammar createGrammarFrom(SchemaGrammar grammar) {
+        SchemaGrammar newGrammar = new SchemaGrammar(grammar);
+        fGrammarBucket.putGrammar(newGrammar);
+        // update all the grammars in the bucket to point to the new grammar.
+        updateImportListWith(newGrammar);
+        // update import list of the new grammar
+        updateImportListFor(newGrammar);
+        return newGrammar;
+    }
+
+    private void addNewGrammarLocations(SchemaGrammar srcGrammar, SchemaGrammar dstGrammar) {
+        final StringList locations = srcGrammar.getDocumentLocations();
+        final int locSize = locations.size();
+        final StringList locations2 = dstGrammar.getDocumentLocations();
+        
+        for (int i=0; i&lt;locSize; i++) {
+            String loc = locations.item(i);
+            if (!locations2.contains(loc)) {
+                dstGrammar.addDocument(null, loc);
+            }
+        }
+    }
+
+    private void addNewImportedGrammars(SchemaGrammar srcGrammar, SchemaGrammar dstGrammar) {
+        final Vector igs1 = srcGrammar.getImportedGrammars();
+        if (igs1 != null) {
+            Vector igs2 = dstGrammar.getImportedGrammars();
+            
+            if (igs2 == null) {
+                igs2 = ((Vector) igs1.clone());
+                dstGrammar.setImportedGrammars(igs2);
+            }
+            else {
+                updateImportList(igs1, igs2);
+            }
+        }
+    }
+
+    private void updateImportList(Vector importedSrc, Vector importedDst)
+    {
+        final int size = importedSrc.size();
+
+        for (int i=0; i&lt;size; i++) {
+            final SchemaGrammar sg = (SchemaGrammar) importedSrc.elementAt(i);
+            if (!containedImportedGrammar(importedDst, sg)) {
+                importedDst.add(sg);
+            }
+        }
+    }
+
+    private void addNewGrammarComponents(SchemaGrammar srcGrammar, SchemaGrammar dstGrammar) {
+        dstGrammar.resetComponents();
+        addGlobalElementDecls(srcGrammar, dstGrammar);
+        addGlobalAttributeDecls(srcGrammar, dstGrammar);
+        addGlobalAttributeGroupDecls(srcGrammar, dstGrammar);
+        addGlobalGroupDecls(srcGrammar, dstGrammar);
+        addGlobalTypeDecls(srcGrammar, dstGrammar);
+        addGlobalNotationDecls(srcGrammar, dstGrammar);
+    }
+
+    private void addGlobalElementDecls(SchemaGrammar srcGrammar, SchemaGrammar dstGrammar) {
+        XSNamedMap components = srcGrammar.getComponents(XSConstants.ELEMENT_DECLARATION);
+        int len = components.getLength();
+        XSElementDecl srcDecl, dstDecl;
+
+        // add global components
+        for (int i=0; i&lt;len; i++) {
+            srcDecl = (XSElementDecl) components.item(i);
+            dstDecl = dstGrammar.getGlobalElementDecl(srcDecl.getName()); 
+            if (dstDecl == null) {
+                dstGrammar.addGlobalElementDecl(srcDecl);
+            }
+            else if (dstDecl != srcDecl){
+                // TODO: if not tolerating duplicate, generate an error message
+            }
+        }
+
+        // add any extended (duplicate) global components
+        ObjectList componentsExt = srcGrammar.getComponentsExt(XSConstants.ELEMENT_DECLARATION);
+        len = componentsExt.getLength();
+
+        for (int i=0; i&lt;len; i+= 2) {
+            final String key = (String) componentsExt.item(i);
+            final int index = key.indexOf(',');
+            final String location = key.substring(0, index);
+            final String name = key.substring(index + 1, key.length());
+
+            srcDecl = (XSElementDecl)componentsExt.item(i+1);
+            dstDecl = dstGrammar.getGlobalElementDecl(name, location); 
+            if ( dstDecl == null) {
+                dstGrammar.addGlobalElementDecl(srcDecl, location);
+            }
+            else if (dstDecl != srcDecl){
+                // TODO: if not tolerating duplicate, generate an error message
+            }
+        }
+    }
+    
+    private void addGlobalAttributeDecls(SchemaGrammar srcGrammar, SchemaGrammar dstGrammar) {
+        XSNamedMap components = srcGrammar.getComponents(XSConstants.ATTRIBUTE_DECLARATION);
+        int len = components.getLength();
+        XSAttributeDecl srcDecl, dstDecl;
+
+        // add global components
+        for (int i=0; i&lt;len; i++) {
+            srcDecl = (XSAttributeDecl) components.item(i);
+            dstDecl = dstGrammar.getGlobalAttributeDecl(srcDecl.getName()); 
+            if (dstDecl == null) {
+                dstGrammar.addGlobalAttributeDecl(srcDecl);
+            }
+            else if (dstDecl != srcDecl &amp;&amp; !fTolerateDuplicates) {
+                reportSharingError(srcDecl.getNamespace(), srcDecl.getName());
+            }
+        }
+
+        // add any extended (duplicate) global components
+        ObjectList componentsExt = srcGrammar.getComponentsExt(XSConstants.ATTRIBUTE_DECLARATION);
+        len = componentsExt.getLength();
+
+        for (int i=0; i&lt;len; i+= 2) {
+            final String key = (String) componentsExt.item(i);
+            final int index = key.indexOf(',');
+            final String location = key.substring(0, index);
+            final String name = key.substring(index + 1, key.length());
+            
+            srcDecl = (XSAttributeDecl)componentsExt.item(i+1);
+            dstDecl = dstGrammar.getGlobalAttributeDecl(name, location); 
+            if (dstDecl == null) {
+                dstGrammar.addGlobalAttributeDecl(srcDecl, location);
+            }
+            // REVISIT - do we report an error?
+            else if (dstDecl != srcDecl) {
+            }
+        }
+    }
+
+    private void addGlobalAttributeGroupDecls(SchemaGrammar srcGrammar, SchemaGrammar dstGrammar) {
+        XSNamedMap components = srcGrammar.getComponents(XSConstants.ATTRIBUTE_GROUP);
+        int len = components.getLength();
+        XSAttributeGroupDecl srcDecl, dstDecl;
+
+        // add global components
+        for (int i=0; i&lt;len; i++) {
+            srcDecl = (XSAttributeGroupDecl) components.item(i);
+            dstDecl = dstGrammar.getGlobalAttributeGroupDecl(srcDecl.getName());
+            if (dstDecl == null) {
+                dstGrammar.addGlobalAttributeGroupDecl(srcDecl);
+            }
+            else if (dstDecl != srcDecl &amp;&amp; !fTolerateDuplicates) {
+                reportSharingError(srcDecl.getNamespace(), srcDecl.getName());
+            }
+        }
+
+        // add any extended (duplicate) global components
+        ObjectList componentsExt = srcGrammar.getComponentsExt(XSConstants.ATTRIBUTE_GROUP);
+        len = componentsExt.getLength();
+
+        for (int i=0; i&lt;len; i+= 2) {
+            final String key = (String) componentsExt.item(i);
+            final int index = key.indexOf(',');
+            final String location = key.substring(0, index);
+            final String name = key.substring(index + 1, key.length());
+            
+            srcDecl = (XSAttributeGroupDecl)componentsExt.item(i+1);
+            dstDecl = dstGrammar.getGlobalAttributeGroupDecl(name, location);
+            if (dstDecl == null) {
+                dstGrammar.addGlobalAttributeGroupDecl(srcDecl, location);
+            }
+            // REVISIT - do we report an error?
+            else if (dstDecl != srcDecl) {
+            }
+        }
+    }
+    
+    private void addGlobalNotationDecls(SchemaGrammar srcGrammar, SchemaGrammar dstGrammar) {
+        XSNamedMap components = srcGrammar.getComponents(XSConstants.NOTATION_DECLARATION);
+        int len = components.getLength();
+        XSNotationDecl srcDecl, dstDecl;
+
+        // add global components
+        for (int i=0; i&lt;len; i++) {
+            srcDecl = (XSNotationDecl) components.item(i);
+            dstDecl = dstGrammar.getGlobalNotationDecl(srcDecl.getName());
+            if (dstDecl == null) {
+                dstGrammar.addGlobalNotationDecl(srcDecl);
+            }
+            else if (dstDecl != srcDecl &amp;&amp; !fTolerateDuplicates) {
+                reportSharingError(srcDecl.getNamespace(), srcDecl.getName());
+            }
+        }
+
+        // add any extended (duplicate) global components
+        ObjectList componentsExt = srcGrammar.getComponentsExt(XSConstants.NOTATION_DECLARATION);
+        len = componentsExt.getLength();
+
+        for (int i=0; i&lt;len; i+= 2) {
+            final String key = (String) componentsExt.item(i);
+            final int index = key.indexOf(',');
+            final String location = key.substring(0, index);
+            final String name = key.substring(index + 1, key.length());
+
+            srcDecl = (XSNotationDecl)componentsExt.item(i+1);
+            dstDecl = dstGrammar.getGlobalNotationDecl(name, location);
+            if (dstDecl == null) {
+                dstGrammar.addGlobalNotationDecl(srcDecl, location);
+            }
+            // REVISIT - do we report an error?
+            else if (dstDecl != srcDecl) {
+            }
+        }
+    }
+    
+    private void addGlobalGroupDecls(SchemaGrammar srcGrammar, SchemaGrammar dstGrammar) {
+        XSNamedMap components = srcGrammar.getComponents(XSConstants.MODEL_GROUP_DEFINITION);
+        int len = components.getLength();
+        XSGroupDecl srcDecl, dstDecl;
+
+        // add global components
+        for (int i=0; i&lt;len; i++) {
+            srcDecl = (XSGroupDecl) components.item(i);
+            dstDecl = dstGrammar.getGlobalGroupDecl(srcDecl.getName());
+            if (dstDecl == null) {
+                dstGrammar.addGlobalGroupDecl(srcDecl);
+            }
+            else if (srcDecl != dstDecl &amp;&amp; !fTolerateDuplicates) {
+                reportSharingError(srcDecl.getNamespace(), srcDecl.getName());
+            }
+        }
+
+        // add any extended (duplicate) global components
+        ObjectList componentsExt = srcGrammar.getComponentsExt(XSConstants.MODEL_GROUP_DEFINITION);
+        len = componentsExt.getLength();
+
+        for (int i=0; i&lt;len; i+= 2) {
+            final String key = (String) componentsExt.item(i);
+            final int index = key.indexOf(',');
+            final String location = key.substring(0, index);
+            final String name = key.substring(index + 1, key.length());
+
+            srcDecl = (XSGroupDecl)componentsExt.item(i+1);
+            dstDecl = dstGrammar.getGlobalGroupDecl(name, location);
+            if (dstDecl == null) {
+                dstGrammar.addGlobalGroupDecl(srcDecl, location);
+            }
+            // REVIST - do we report an error?
+            else if (dstDecl != srcDecl) {
+            }
+        }
+    }
+
+    private void addGlobalTypeDecls(SchemaGrammar srcGrammar, SchemaGrammar dstGrammar) {
+        XSNamedMap components = srcGrammar.getComponents(XSConstants.TYPE_DEFINITION);
+        int len = components.getLength();
+        XSTypeDefinition srcDecl, dstDecl;
+
+        // add global components
+        for (int i=0; i&lt;len; i++) {
+            srcDecl = (XSTypeDefinition) components.item(i);
+            dstDecl = dstGrammar.getGlobalTypeDecl(srcDecl.getName());
+            if (dstDecl == null) {
+                dstGrammar.addGlobalTypeDecl(srcDecl);
+            }
+            else if (dstDecl != srcDecl &amp;&amp; !fTolerateDuplicates) {
+                reportSharingError(srcDecl.getNamespace(), srcDecl.getName());
+            }
+        }
+
+        // add any extended (duplicate) global components
+        ObjectList componentsExt = srcGrammar.getComponentsExt(XSConstants.TYPE_DEFINITION);
+        len = componentsExt.getLength();
+
+        for (int i=0; i&lt;len; i+= 2) {
+            final String key = (String) componentsExt.item(i);
+            final int index = key.indexOf(',');
+            final String location = key.substring(0, index);
+            final String name = key.substring(index + 1, key.length());
+
+            srcDecl = (XSTypeDefinition)componentsExt.item(i+1);
+            dstDecl = dstGrammar.getGlobalTypeDecl(name, location);
+            if (dstDecl == null) {
+                dstGrammar.addGlobalTypeDecl(srcDecl, location);
+            }
+            // REVISIT - do we report an error?
+            else if (dstDecl != srcDecl) {
+            }
+        }
+    }
+
+    private Vector expandComponents(XSObject[] components, Hashtable dependencies) {
+        Vector newComponents = new Vector();
+        
+        for (int i=0; i&lt;components.length; i++) {
+            if (!newComponents.contains(components[i])) {
+                newComponents.add(components[i]);
+            }
+        }
+        
+        for (int i=0; i&lt;newComponents.size(); i++) {
+            final XSObject component = (XSObject) newComponents.elementAt(i);
+            expandRelatedComponents(component, newComponents, dependencies);
+        }
+        
+        return newComponents;
+    }
+    
+    private void expandRelatedComponents(XSObject component, Vector componentList, Hashtable dependencies) {
+        short componentType = component.getType();
+        switch (componentType) {
+        case XSConstants.TYPE_DEFINITION :
+            expandRelatedTypeComponents((XSTypeDefinition) component, componentList, component.getNamespace(), dependencies);
+            break;
+        case XSConstants.ATTRIBUTE_DECLARATION :
+            expandRelatedAttributeComponents((XSAttributeDeclaration) component, componentList, component.getNamespace(), dependencies);
+            break;
+        case XSConstants.ATTRIBUTE_GROUP :
+            expandRelatedAttributeGroupComponents((XSAttributeGroupDefinition) component, componentList, component.getNamespace(), dependencies);
+        case XSConstants.ELEMENT_DECLARATION :
+            expandRelatedElementComponents((XSElementDeclaration) component, componentList, component.getNamespace(), dependencies);
+            break;
+        case XSConstants.MODEL_GROUP_DEFINITION :
+            expandRelatedModelGroupDefinitionComponents((XSModelGroupDefinition) component, componentList, component.getNamespace(), dependencies);
+        case XSConstants.ATTRIBUTE_USE :
+            //expandRelatedAttributeUseComponents((XSAttributeUse)component, componentList, dependencies);
+        case XSConstants.NOTATION_DECLARATION :
+        case XSConstants.IDENTITY_CONSTRAINT :
+        default :
+            break;
+        }
+    }
+
+    private void expandRelatedAttributeComponents(XSAttributeDeclaration decl, Vector componentList, String namespace, Hashtable dependencies) {
+        addRelatedType(decl.getTypeDefinition(), componentList, namespace, dependencies);
+
+        /*final XSComplexTypeDefinition enclosingType = decl.getEnclosingCTDefinition();
+        if (enclosingType != null) {
+            addRelatedType(enclosingType, componentList, namespace, dependencies);
+        }*/
+    }
+
+    private void expandRelatedElementComponents(XSElementDeclaration decl, Vector componentList, String namespace, Hashtable dependencies) {
+        addRelatedType(decl.getTypeDefinition(), componentList, namespace, dependencies);
+        
+        /*final XSTypeDefinition enclosingType = decl.getEnclosingCTDefinition();
+        if (enclosingType != null) {
+            addRelatedType(enclosingType, componentList, namespace, dependencies);
+        }*/
+
+        final XSElementDeclaration[] subElemDecl = decl.getSubstitutionGroupAffiliation();
+        if (subElemDecl != null) {
+            for (int i=0; i&lt;subElemDecl.length; i++) {
+                addRelatedElement(subElemDecl[i], componentList, namespace, dependencies);
+            }
+        }
+    }
+    
+    private void expandRelatedTypeComponents(XSTypeDefinition type, Vector componentList, String namespace, Hashtable dependencies) {
+        if (type instanceof XSComplexTypeDecl) {
+            expandRelatedComplexTypeComponents((XSComplexTypeDecl) type, componentList, namespace, dependencies);
+        }
+        else if (type instanceof XSSimpleTypeDecl) {
+            expandRelatedSimpleTypeComponents((XSSimpleTypeDefinition) type, componentList, namespace, dependencies);
+        }
+    }
+
+    private void expandRelatedModelGroupDefinitionComponents(XSModelGroupDefinition modelGroupDef, Vector componentList,
+            String namespace, Hashtable dependencies) {
+        expandRelatedModelGroupComponents(modelGroupDef.getModelGroup(), componentList, namespace, dependencies);
+    }
+
+    private void expandRelatedAttributeGroupComponents(XSAttributeGroupDefinition attrGroup, Vector componentList
+            , String namespace, Hashtable dependencies) {
+        expandRelatedAttributeUsesComponents(attrGroup.getAttributeUses(), componentList, namespace, dependencies);
+    }
+
+    private void expandRelatedComplexTypeComponents(XSComplexTypeDecl type, Vector componentList, String namespace, Hashtable dependencies) {
+        addRelatedType(type.getBaseType(), componentList, namespace, dependencies);
+        expandRelatedAttributeUsesComponents(type.getAttributeUses(), componentList, namespace, dependencies);
+        final XSParticle particle = type.getParticle();
+        if (particle != null) {
+            expandRelatedParticleComponents(particle, componentList, namespace, dependencies);
+        }
+    }
+
+    private void expandRelatedSimpleTypeComponents(XSSimpleTypeDefinition type, Vector componentList, String namespace, Hashtable dependencies) {
+        final XSTypeDefinition baseType = type.getBaseType();
+        if (baseType != null) {
+            addRelatedType(baseType, componentList, namespace, dependencies);
+        }
+
+        final XSTypeDefinition itemType = type.getItemType();
+        if (itemType != null) {
+            addRelatedType(itemType, componentList, namespace, dependencies);
+        }
+        
+        final XSTypeDefinition primitiveType = type.getPrimitiveType();
+        if (primitiveType != null) {
+            addRelatedType(primitiveType, componentList, namespace, dependencies);
+        }
+
+        final XSObjectList memberTypes = type.getMemberTypes();
+        if (memberTypes.size() &gt; 0) {
+            for (int i=0; i&lt;memberTypes.size(); i++) {
+                addRelatedType((XSTypeDefinition)memberTypes.item(i), componentList, namespace, dependencies);
+            }
+        }
+    }
+    
+    private void expandRelatedAttributeUsesComponents(XSObjectList attrUses, Vector componentList,
+            String namespace, Hashtable dependencies) {
+        final int attrUseSize = (attrUses == null) ? 0 : attrUses.size();
+        for (int i=0; i&lt;attrUseSize; i++) {
+            expandRelatedAttributeUseComponents((XSAttributeUse)attrUses.item(i), componentList, namespace, dependencies);
+        }
+    }
+
+    private void expandRelatedAttributeUseComponents(XSAttributeUse component, Vector componentList,
+            String namespace, Hashtable dependencies) {
+        addRelatedAttribute(component.getAttrDeclaration(), componentList, namespace, dependencies);
+    }
+
+    private void expandRelatedParticleComponents(XSParticle component, Vector componentList,
+            String namespace, Hashtable dependencies) {
+        XSTerm term = component.getTerm();
+        switch (term.getType()) {
+        case XSConstants.ELEMENT_DECLARATION :
+            addRelatedElement((XSElementDeclaration) term, componentList, namespace, dependencies);
+            break;
+        case XSConstants.MODEL_GROUP :
+            expandRelatedModelGroupComponents((XSModelGroup) term, componentList, namespace, dependencies);
+            break;
+        default:
+            break;
+        }
+    }
+
+    private void expandRelatedModelGroupComponents(XSModelGroup modelGroup, Vector componentList,
+            String namespace, Hashtable dependencies) {
+        XSObjectList particles = modelGroup.getParticles();
+        final int length = (particles == null) ? 0 : particles.getLength();
+        for (int i=0; i&lt;length; i++) {
+            expandRelatedParticleComponents((XSParticle)particles.item(i), componentList, namespace, dependencies);
+        }
+    }
+    
+    private void addRelatedType(XSTypeDefinition type, Vector componentList, String namespace, Hashtable dependencies) {
+        if (!type.getAnonymous()) {
+            if (!type.getNamespace().equals(SchemaSymbols.URI_SCHEMAFORSCHEMA)) { //REVISIT - do we use == instead
+                if (!componentList.contains(type)) {
+                    final Vector importedNamespaces = findDependentNamespaces(namespace, dependencies);
+                    addNamespaceDependency(namespace, type.getNamespace(), importedNamespaces);
+                    componentList.add(type);
+                }
+            }
+        }
+        else {
+            expandRelatedTypeComponents(type, componentList, namespace, dependencies);
+        }
+    }
+    
+    private void addRelatedElement(XSElementDeclaration decl, Vector componentList, String namespace, Hashtable dependencies) {
+        if (decl.getScope() == XSConstants.SCOPE_GLOBAL) {
+            if (!componentList.contains(decl)) {
+                Vector importedNamespaces = findDependentNamespaces(namespace, dependencies);
+                addNamespaceDependency(namespace, decl.getNamespace(), importedNamespaces);
+                componentList.add(decl);
+            }
+        }
+        else {
+            expandRelatedElementComponents(decl, componentList, namespace, dependencies);
+        }
+    }
+
+    private void addRelatedAttribute(XSAttributeDeclaration decl, Vector componentList, String namespace, Hashtable dependencies) {
+        if (decl.getScope() == XSConstants.SCOPE_GLOBAL) {
+            if (!componentList.contains(decl)) {
+                Vector importedNamespaces = findDependentNamespaces(namespace, dependencies);
+                addNamespaceDependency(namespace, decl.getNamespace(), importedNamespaces);
+                componentList.add(decl);
+            }
+        }
+        else {
+            expandRelatedAttributeComponents(decl, componentList, namespace, dependencies);
+        }
+    }
+
+    private void addGlobalComponents(Vector components, Hashtable importDependencies) {
+        final XSDDescription desc = new XSDDescription();
+        final int size = components.size();
+        
+        for (int i=0; i&lt;size; i++) {
+            addGlobalComponent((XSObject) components.elementAt(i), desc);
+        }
+        updateImportDependencies(importDependencies);
+    }
+
+    private void addGlobalComponent(XSObject component, XSDDescription desc) {
+        final String namespace = component.getNamespace();
+        
+        desc.setNamespace(namespace);
+        final SchemaGrammar sg = getSchemaGrammar(desc);
+
+        short componentType = component.getType();
+        final String name = component.getName();
+
+        switch (componentType) {
+        case XSConstants.TYPE_DEFINITION :
+            if (!((XSTypeDefinition) component).getAnonymous()) {
+                if (sg.getGlobalTypeDecl(name) == null) {
+                    sg.addGlobalTypeDecl((XSTypeDefinition) component);
+                }
+                // store the declaration in the extended map, using an empty location
+                if (sg.getGlobalTypeDecl(name, "") == null) {
+                    sg.addGlobalTypeDecl((XSTypeDefinition) component, "");
+                }
+            }
+            break;
+        case XSConstants.ATTRIBUTE_DECLARATION :
+            if (((XSAttributeDecl) component).getScope() == XSAttributeDecl.SCOPE_GLOBAL) {
+                if (sg.getGlobalAttributeDecl(name) == null) {
+                    sg.addGlobalAttributeDecl((XSAttributeDecl) component);
+                }
+                // store the declaration in the extended map, using an empty location
+                if (sg.getGlobalAttributeDecl(name, "") == null) {
+                    sg.addGlobalAttributeDecl((XSAttributeDecl) component, "");
+                }
+            }
+            break;
+        case XSConstants.ATTRIBUTE_GROUP :
+            if (sg.getGlobalAttributeDecl(name) == null) {
+                sg.addGlobalAttributeGroupDecl((XSAttributeGroupDecl) component);
+            }
+            // store the declaration in the extended map, using an empty location
+            if (sg.getGlobalAttributeDecl(name, "") == null) {
+                sg.addGlobalAttributeGroupDecl((XSAttributeGroupDecl) component, "");
+            }
+            break;
+        case XSConstants.ELEMENT_DECLARATION :
+            if (((XSElementDecl) component).getScope() == XSElementDecl.SCOPE_GLOBAL) {
+                sg.addGlobalElementDeclAll((XSElementDecl) component);
+
+                if (sg.getGlobalElementDecl(name) == null) {
+                    sg.addGlobalElementDecl((XSElementDecl) component);
+                }
+                // store the declaration in the extended map, using an empty location
+                if (sg.getGlobalElementDecl(name, "") == null) {
+                    sg.addGlobalElementDecl((XSElementDecl) component, "");
+                }
+            }
+            break;
+        case XSConstants.MODEL_GROUP_DEFINITION :
+            if (sg.getGlobalGroupDecl(name) == null) {
+                sg.addGlobalGroupDecl((XSGroupDecl) component);
+            }
+            // store the declaration in the extended map, using an empty location
+            if (sg.getGlobalGroupDecl(name, "") == null) {
+                sg.addGlobalGroupDecl((XSGroupDecl) component, "");
+            }
+            break;
+        case XSConstants.NOTATION_DECLARATION :
+            if (sg.getGlobalNotationDecl(name) == null) {
+                sg.addGlobalNotationDecl((XSNotationDecl) component);
+            }
+            // store the declaration in the extended map, using an empty location
+            if (sg.getGlobalNotationDecl(name, "") == null) {
+                sg.addGlobalNotationDecl((XSNotationDecl) component, "");
+            }
+            break;
+        case XSConstants.IDENTITY_CONSTRAINT :
+        case XSConstants.ATTRIBUTE_USE :
+        default :
+            break;
+        }
+    }
+
+    private void updateImportDependencies(Hashtable table) {
+        Enumeration keys = table.keys();
+        String namespace;
+        Vector importList;
+        while (keys.hasMoreElements()) {
+            namespace = (String) keys.nextElement();
+            importList = (Vector) table.get(null2EmptyString(namespace));
+            if (importList.size() &gt; 0) {
+                expandImportList(namespace, importList);
+            }
+        }
+    }
+    
+    private void expandImportList(String namespace, Vector namespaceList) {
+        SchemaGrammar sg = fGrammarBucket.getGrammar(namespace);
+        // shouldn't be null
+        if (sg != null) {
+            Vector isgs = sg.getImportedGrammars();
+            if (isgs == null) {
+                isgs = new Vector();
+                addImportList(sg, isgs, namespaceList);
+                sg.setImportedGrammars(isgs);
+            }
+            else {
+                updateImportList(sg, isgs, namespaceList);
+            }
+        }
+    }
+
+    private void addImportList(SchemaGrammar sg, Vector importedGrammars, Vector namespaceList) {
+        final int size = namespaceList.size();
+        SchemaGrammar isg;
+
+        for (int i=0; i&lt;size; i++) {
+            isg = fGrammarBucket.getGrammar((String)namespaceList.elementAt(i));
+            if (isg != null) {
+                importedGrammars.add(isg);
+            }
+            else {
+                //REVIST: report an error message
+            }
+        }
+    }
+
+    private void updateImportList(SchemaGrammar sg, Vector importedGrammars, Vector namespaceList) {
+        final int size = namespaceList.size();
+        SchemaGrammar isg;
+
+        for (int i=0; i&lt;size; i++) {
+            isg = fGrammarBucket.getGrammar((String)namespaceList.elementAt(i));
+            if (isg != null) {
+                if (!containedImportedGrammar(importedGrammars, isg)) {
+                    importedGrammars.add(isg);
+                }
+            }
+            else {
+                //REVIST: report an error message
+            }
+        }
+    }
+
+    private boolean containedImportedGrammar(Vector importedGrammar, SchemaGrammar grammar) {

[... 199 lines stripped ...]


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



</pre>
</div>
</content>
</entry>
<entry>
<title>svn commit: r884566 [1/3] - in /xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces: impl/xs/models/ impl/xs/traversers/ impl/xs/util/ parsers/</title>
<author><name>knoaman@apache.org</name></author>
<link rel="alternate" href="http://mail-archives.apache.org/mod_mbox/xerces-commits/200911.mbox/%3c20091126143005.5CCD323888FD@eris.apache.org%3e"/>
<id>urn:uuid:%3c20091126143005-5CCD323888FD@eris-apache-org%3e</id>
<updated>2009-11-26T14:30:02Z</updated>
<content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml">
<pre>
Author: knoaman
Date: Thu Nov 26 14:30:01 2009
New Revision: 884566

URL: http://svn.apache.org/viewvc?rev=884566&amp;view=rev
Log:
Synchronize the 1.1 branch with Xerces-J trunk- Part 2

Added:
    xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/models/XCMValidatorHelper.java   (with props)
    xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/util/ObjectListImpl.java   (with props)
    xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/util/XSInputSource.java   (with props)
Modified:
    xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/models/XS11AllCM.java
    xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/models/XSAllCM.java
    xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/models/XSCMValidator.java
    xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/models/XSDFACM.java
    xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/models/XSEmptyCM.java
    xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/traversers/XSDAbstractIDConstraintTraverser.java
    xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/traversers/XSDAbstractTraverser.java
    xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/traversers/XSDAttributeGroupTraverser.java
    xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/traversers/XSDAttributeTraverser.java
    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/XSDElementTraverser.java
    xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/traversers/XSDGroupTraverser.java
    xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/traversers/XSDHandler.java
    xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/traversers/XSDKeyrefTraverser.java
    xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/traversers/XSDNotationTraverser.java
    xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/traversers/XSDSimpleTypeTraverser.java
    xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/traversers/XSDUniqueOrKeyTraverser.java
    xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/parsers/DOMParserImpl.java
    xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/parsers/StandardParserConfiguration.java
    xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/parsers/XML11Configuration.java

Added: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/models/XCMValidatorHelper.java
URL: http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/models/XCMValidatorHelper.java?rev=884566&amp;view=auto
==============================================================================
--- xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/models/XCMValidatorHelper.java (added)
+++ xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/models/XCMValidatorHelper.java Thu Nov 26 14:30:01 2009
@@ -0,0 +1,29 @@
+/*
+ * 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.models;
+
+import org.apache.xerces.impl.xs.XSElementDecl;
+import org.apache.xerces.xni.QName;
+
+/**
+ * @version $Id$
+ */
+public interface XCMValidatorHelper {
+
+    public XSElementDecl getGlobalElementDecl(QName element);
+}

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

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

Modified: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/models/XS11AllCM.java
URL: http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/models/XS11AllCM.java?rev=884566&amp;r1=884565&amp;r2=884566&amp;view=diff
==============================================================================
--- xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/models/XS11AllCM.java (original)
+++ xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/models/XS11AllCM.java Thu Nov 26 14:30:01 2009
@@ -20,7 +20,6 @@
 import java.util.Vector;
 
 import org.apache.xerces.impl.Constants;
-import org.apache.xerces.impl.xs.SchemaGrammar;
 import org.apache.xerces.impl.xs.SubstitutionGroupHandler;
 import org.apache.xerces.impl.xs.XMLSchemaException;
 import org.apache.xerces.impl.xs.XSConstraints;
@@ -151,12 +150,12 @@
     private boolean allowExpandedName(XSWildcardDecl wildcard,
                                       QName curElem,
                                       SubstitutionGroupHandler subGroupHandler,
-                                      SchemaGrammar grammar) {
+                                      XCMValidatorHelper xcmHelper) {
         if (wildcard.allowQName(curElem)) {
             if (wildcard.fDisallowedSibling &amp;&amp; findMatchingElemDecl(curElem, subGroupHandler) != null) {
                 return false;
             }
-            if (wildcard.fDisallowedDefined &amp;&amp; grammar.getElementDeclaration(curElem.localpart) != null) {
+            if (wildcard.fDisallowedDefined &amp;&amp; xcmHelper.getGlobalElementDecl(curElem) != null) {
                 return false;
             }
             return true;
@@ -171,7 +170,8 @@
      * @param currentState  Current state
      * @return an element decl object
      */
-    public Object oneTransition (QName elementName, int[] currentState, SubstitutionGroupHandler subGroupHandler, SchemaGrammar grammar) {
+    public Object oneTransition (QName elementName, int[] currentState,
+            SubstitutionGroupHandler subGroupHandler, XCMValidatorHelper xcmHelper) {
         // error state
         if (currentState[0] &lt; 0) {
             currentState[0] = XSCMValidator.SUBSEQUENT_ERROR;
@@ -180,7 +180,7 @@
 
         // open content - suffix mode
         if (currentState[0] == STATE_SUFFIX) {
-            if (allowExpandedName(fOpenContent.fWildcard, elementName, subGroupHandler, grammar)) {
+            if (allowExpandedName(fOpenContent.fWildcard, elementName, subGroupHandler, xcmHelper)) {
                 return fOpenContent;
             }
             else { // error
@@ -210,7 +210,7 @@
             if (currentState[i + 1] == fDeclsOccurs[declMaxOccurs]) {
                 continue;
             }
-            if (allowExpandedName((XSWildcardDecl)fAllDecls[i], elementName, subGroupHandler, grammar)) {
+            if (allowExpandedName((XSWildcardDecl)fAllDecls[i], elementName, subGroupHandler, xcmHelper)) {
                 // found the decl, mark this element as "seen".
                 ++currentState[i + 1];
                 return fAllDecls[i];
@@ -228,7 +228,7 @@
                     return findMatchingDecl(elementName, subGroupHandler);
                 }
             }
-            if (allowExpandedName(fOpenContent.fWildcard, elementName, subGroupHandler, grammar)) {
+            if (allowExpandedName(fOpenContent.fWildcard, elementName, subGroupHandler, xcmHelper)) {
             //if (fOpenContent.fWildcard.allowQName(elementName)) {
                 return fOpenContent;
             }

Modified: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/models/XSAllCM.java
URL: http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/models/XSAllCM.java?rev=884566&amp;r1=884565&amp;r2=884566&amp;view=diff
==============================================================================
--- xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/models/XSAllCM.java (original)
+++ xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/models/XSAllCM.java Thu Nov 26 14:30:01 2009
@@ -19,8 +19,6 @@
 
 import java.util.Vector;
 
-import org.apache.xerces.impl.Constants;
-import org.apache.xerces.impl.xs.SchemaGrammar;
 import org.apache.xerces.impl.xs.SubstitutionGroupHandler;
 import org.apache.xerces.impl.xs.XMLSchemaException;
 import org.apache.xerces.impl.xs.XSConstraints;
@@ -115,7 +113,7 @@
      * @param currentState  Current state
      * @return an element decl object
      */
-    public Object oneTransition (QName elementName, int[] currentState, SubstitutionGroupHandler subGroupHandler, SchemaGrammar grammar) {
+    public Object oneTransition (QName elementName, int[] currentState, SubstitutionGroupHandler subGroupHandler, XCMValidatorHelper xcmHelper) {
 
         // error state
         if (currentState[0] &lt; 0) {

Modified: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/models/XSCMValidator.java
URL: http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/models/XSCMValidator.java?rev=884566&amp;r1=884565&amp;r2=884566&amp;view=diff
==============================================================================
--- xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/models/XSCMValidator.java (original)
+++ xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/models/XSCMValidator.java Thu Nov 26 14:30:01 2009
@@ -19,7 +19,6 @@
 
 import java.util.Vector;
 
-import org.apache.xerces.impl.xs.SchemaGrammar;
 import org.apache.xerces.impl.xs.SubstitutionGroupHandler;
 import org.apache.xerces.impl.xs.XMLSchemaException;
 import org.apache.xerces.impl.xs.XSConstraints;
@@ -58,11 +57,11 @@
      *
      * @param elementName
      * @param state  Current state
-     * @param grammar SchemaGrammar that corresponds to the namespace of the element
+     * @param xcmHelper A helper that allows inquiry of global element declarations
      * @return element decl or wildcard decl that
      *         corresponds to the element from the Schema grammar
      */
-    public Object oneTransition (QName elementName, int[] state, SubstitutionGroupHandler subGroupHandler, SchemaGrammar grammar);
+    public Object oneTransition (QName elementName, int[] state, SubstitutionGroupHandler subGroupHandler, XCMValidatorHelper xcmHelper);
 
 
     /**

Modified: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/models/XSDFACM.java
URL: http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/models/XSDFACM.java?rev=884566&amp;r1=884565&amp;r2=884566&amp;view=diff
==============================================================================
--- xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/models/XSDFACM.java (original)
+++ xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/models/XSDFACM.java Thu Nov 26 14:30:01 2009
@@ -23,7 +23,6 @@
 import org.apache.xerces.impl.Constants;
 import org.apache.xerces.impl.dtd.models.CMNode;
 import org.apache.xerces.impl.dtd.models.CMStateSet;
-import org.apache.xerces.impl.xs.SchemaGrammar;
 import org.apache.xerces.impl.xs.SchemaSymbols;
 import org.apache.xerces.impl.xs.SubstitutionGroupHandler;
 import org.apache.xerces.impl.xs.XMLSchemaException;
@@ -269,7 +268,7 @@
      *
      * @exception RuntimeException thrown on error
      */
-    public Object oneTransition(QName curElem, int[] state, SubstitutionGroupHandler subGroupHandler, SchemaGrammar grammar) {
+    public Object oneTransition(QName curElem, int[] state, SubstitutionGroupHandler subGroupHandler, XCMValidatorHelper xcmHelper) {
         int curState = state[0];
 
         if(curState == XSCMValidator.FIRST_ERROR || curState == XSCMValidator.SUBSEQUENT_ERROR) {
@@ -283,7 +282,7 @@
         }
         // apply open content - suffix mode 
         else if (state[3] == STATE_SUFFIX) {
-            if (allowExpandedName(fOpenContent.fWildcard, curElem, subGroupHandler, grammar)) {//if (fOpenContent.fWildcard.allowQName(curElem)) {
+            if (allowExpandedName(fOpenContent.fWildcard, curElem, subGroupHandler, xcmHelper)) {//if (fOpenContent.fWildcard.allowQName(curElem)) {
                 return fOpenContent;
             }
 
@@ -317,7 +316,7 @@
                     }
                 }
                 // XML Schema 1.1
-                else if (allowExpandedName((XSWildcardDecl)fElemMap[elemIndex], curElem, subGroupHandler, grammar)) {
+                else if (allowExpandedName((XSWildcardDecl)fElemMap[elemIndex], curElem, subGroupHandler, xcmHelper)) {
                     matchingDecl = fElemMap[elemIndex];
                     // Element has precedence over a wildcard
                     // if no occurences or we reached minOccurs, keep looking for
@@ -356,7 +355,7 @@
         if (matchingDecl == null) {
             // XML Schema 1.1
             // Validate against Open Content
-            if (fOpenContent != null &amp;&amp; matchOpenContentModel(curElem, state, subGroupHandler, curState, grammar)) {
+            if (fOpenContent != null &amp;&amp; matchOpenContentModel(curElem, state, subGroupHandler, curState, xcmHelper)) {
                 return fOpenContent;
             }
 
@@ -395,7 +394,7 @@
                         // we've already seen enough instances of the first "foo" perhaps there is
                         // another element declaration or wildcard deeper in the element map which
                         // matches.
-                        return findMatchingDecl(curElem, state, subGroupHandler, elemIndex, grammar);
+                        return findMatchingDecl(curElem, state, subGroupHandler, elemIndex, xcmHelper);
                     }  
                 }
                 else if (state[2] &lt; o.minOccurs) {
@@ -450,7 +449,7 @@
         return null;
     } // findMatchingDecl(QName, SubstitutionGroupHandler): Object
     
-    Object findMatchingDecl(QName curElem, int[] state, SubstitutionGroupHandler subGroupHandler, int elemIndex, SchemaGrammar grammar) {    
+    Object findMatchingDecl(QName curElem, int[] state, SubstitutionGroupHandler subGroupHandler, int elemIndex, XCMValidatorHelper xcmHelper) {    
         
         int curState = state[0];
         int nextState = 0;
@@ -477,7 +476,7 @@
                     }
                 }
                 // XML Schema 1.1
-                else if (allowExpandedName((XSWildcardDecl)fElemMap[elemIndex], curElem, subGroupHandler, grammar)) {
+                else if (allowExpandedName((XSWildcardDecl)fElemMap[elemIndex], curElem, subGroupHandler, xcmHelper)) {
                     matchingDecl = fElemMap[elemIndex];
                     // Element has precedence over a wildcard
                     // if no occurences or we reached minOccurs, keep looking for
@@ -514,7 +513,7 @@
         if (matchingDecl == null) {
             // XML Schema 1.1
             // Validate against Open Content
-            if (fOpenContent != null &amp;&amp; matchOpenContentModel(curElem, state, subGroupHandler, curState, grammar)) {
+            if (fOpenContent != null &amp;&amp; matchOpenContentModel(curElem, state, subGroupHandler, curState, xcmHelper)) {
                 return fOpenContent;
             }
 
@@ -549,12 +548,12 @@
         return null;
     } // findMatchingDecl(QName, SubstitutionGroupHandler): Object
     
-    boolean allowExpandedName(XSWildcardDecl wildcard, QName curElem, SubstitutionGroupHandler subGroupHandler, SchemaGrammar grammar) {
+    boolean allowExpandedName(XSWildcardDecl wildcard, QName curElem, SubstitutionGroupHandler subGroupHandler, XCMValidatorHelper xcmHelper) {
         if (wildcard.allowQName(curElem)) {
             if (wildcard.fDisallowedSibling &amp;&amp; findMatchingElemDecl(curElem, subGroupHandler) != null) {
                 return false;
             }
-            if (wildcard.fDisallowedDefined &amp;&amp; grammar != null &amp;&amp; grammar.getElementDeclaration(curElem.localpart) != null) {
+            if (wildcard.fDisallowedDefined &amp;&amp; xcmHelper.getGlobalElementDecl(curElem) != null) {
                 return false;
             }
             return true;
@@ -562,7 +561,7 @@
         return false;
     }
     
-    boolean matchOpenContentModel(QName curElem, int[] state, SubstitutionGroupHandler subGroupHandler, int curState, SchemaGrammar grammar) {
+    boolean matchOpenContentModel(QName curElem, int[] state, SubstitutionGroupHandler subGroupHandler, int curState, XCMValidatorHelper xcmHelper) {
         // if suffix mode, we should have reached a final state
         if (fOpenContent.fMode == XSOpenContentDecl.MODE_SUFFIX) {
             if (fFinalStateFlags[curState]) {
@@ -578,7 +577,7 @@
                 return false;
             }
         }
-        if (allowExpandedName(fOpenContent.fWildcard, curElem, subGroupHandler, grammar)) {
+        if (allowExpandedName(fOpenContent.fWildcard, curElem, subGroupHandler, xcmHelper)) {
             return true;
         }
 

Modified: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/models/XSEmptyCM.java
URL: http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/models/XSEmptyCM.java?rev=884566&amp;r1=884565&amp;r2=884566&amp;view=diff
==============================================================================
--- xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/models/XSEmptyCM.java (original)
+++ xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/models/XSEmptyCM.java Thu Nov 26 14:30:01 2009
@@ -19,7 +19,6 @@
 
 import java.util.Vector;
 
-import org.apache.xerces.impl.xs.SchemaGrammar;
 import org.apache.xerces.impl.xs.SubstitutionGroupHandler;
 import org.apache.xerces.impl.xs.XMLSchemaException;
 import org.apache.xerces.impl.xs.XSConstraints;
@@ -92,7 +91,7 @@
      * @param subGroupHandler the substitution group handler
      * @return element index corresponding to the element from the Schema grammar
      */
-    public Object oneTransition (QName elementName, int[] currentState, SubstitutionGroupHandler subGroupHandler, SchemaGrammar grammar){
+    public Object oneTransition (QName elementName, int[] currentState, SubstitutionGroupHandler subGroupHandler, XCMValidatorHelper xcmHelper){
 
         // error state
         if (currentState[0] &lt; 0) {
@@ -101,7 +100,7 @@
         }
 
         if (fOpenContent != null) {
-            if (allowExpandedName(fOpenContent.fWildcard, elementName, subGroupHandler, grammar)) {
+            if (allowExpandedName(fOpenContent.fWildcard, elementName, subGroupHandler, xcmHelper)) {
                 return fOpenContent;
             }
         }
@@ -170,9 +169,9 @@
     private boolean allowExpandedName(XSWildcardDecl wildcard,
             QName curElem,
             SubstitutionGroupHandler subGroupHandler,
-            SchemaGrammar grammar) {
+            XCMValidatorHelper xcmHelper) {
         if (wildcard.allowQName(curElem)) {
-            if (wildcard.fDisallowedDefined &amp;&amp; grammar.getElementDeclaration(curElem.localpart) != null) {
+            if (wildcard.fDisallowedDefined &amp;&amp; xcmHelper.getGlobalElementDecl(curElem) != null) {
                 return false;
             }
             return true;

Modified: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/traversers/XSDAbstractIDConstraintTraverser.java
URL: http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/traversers/XSDAbstractIDConstraintTraverser.java?rev=884566&amp;r1=884565&amp;r2=884566&amp;view=diff
==============================================================================
--- xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/traversers/XSDAbstractIDConstraintTraverser.java (original)
+++ xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/traversers/XSDAbstractIDConstraintTraverser.java Thu Nov 26 14:30:01 2009
@@ -24,11 +24,9 @@
 import org.apache.xerces.impl.xs.identity.Field;
 import org.apache.xerces.impl.xs.identity.IdentityConstraint;
 import org.apache.xerces.impl.xs.identity.Selector;
-import org.apache.xerces.impl.xs.util.XSObjectListImpl;
 import org.apache.xerces.util.DOMUtil;
 import org.apache.xerces.util.XMLChar;
 import org.apache.xerces.xni.QName;
-import org.apache.xerces.xs.XSAnnotation;
 import org.w3c.dom.Element;
 
 /**
@@ -47,7 +45,7 @@
         super(handler, gAttrCheck);
     }
     
-    void traverseIdentityConstraint(IdentityConstraint ic,
+    boolean traverseIdentityConstraint(IdentityConstraint ic,
             Element icElem, XSDocumentInfo schemaDoc, Object [] icElemAttrs) {
         
         // General Attribute Checking will have been done on icElem by caller
@@ -58,7 +56,7 @@
             reportSchemaError("s4s-elt-must-match.2",
                     new Object[]{"identity constraint", "(annotation?, selector, field+)"},
                     icElem);
-            return;
+            return false;
         }
         
         // General Attribute Checking on sElem
@@ -69,7 +67,7 @@
             // if no more children report an error
             if(sElem == null) {
                 reportSchemaError("s4s-elt-must-match.2", new Object[]{"identity constraint", "(annotation?, selector, field+)"}, icElem);
-                return;
+                return false;
             }
         }
         else {
@@ -79,13 +77,14 @@
             }
         }
         
-        Object [] attrValues = fAttrChecker.checkAttributes(sElem, false, schemaDoc);
-        
-        // if more than one annotation report an error
+        // must be &lt;selector&gt;
         if(!DOMUtil.getLocalName(sElem).equals(SchemaSymbols.ELT_SELECTOR)) {
             reportSchemaError("s4s-elt-must-match.1", new Object[]{"identity constraint", "(annotation?, selector, field+)", SchemaSymbols.ELT_SELECTOR}, sElem);
+            return false;
         }
-        // and make sure &lt;selector&gt;'s content is fine:
+        Object [] attrValues = fAttrChecker.checkAttributes(sElem, false, schemaDoc);
+        
+        // make sure &lt;selector&gt;'s content is fine:
         Element selChild = DOMUtil.getFirstChildElement(sElem);
         
         if (selChild !=null) {
@@ -111,7 +110,7 @@
         String sText = ((String)attrValues[XSAttributeChecker.ATTIDX_XPATH]);
         if(sText == null) {
             reportSchemaError("s4s-att-must-appear", new Object [] {SchemaSymbols.ELT_SELECTOR, SchemaSymbols.ATT_XPATH}, sElem);
-            return;
+            return false;
         }
         sText = XMLChar.trim(sText);
         
@@ -126,7 +125,7 @@
             reportSchemaError(e.getKey(), new Object[]{sText}, sElem);
             // put back attr values...
             fAttrChecker.returnAttrArray(attrValues, schemaDoc);
-            return;
+            return false;
         }
         
         // put back attr values...
@@ -136,14 +135,18 @@
         Element fElem = DOMUtil.getNextSiblingElement(sElem);
         if(fElem == null) {
             reportSchemaError("s4s-elt-must-match.2", new Object[]{"identity constraint", "(annotation?, selector, field+)"}, sElem);
+            return false;
         }
         while (fElem != null) {
+            if(!DOMUtil.getLocalName(fElem).equals(SchemaSymbols.ELT_FIELD)) {
+                reportSchemaError("s4s-elt-must-match.1", new Object[]{"identity constraint", "(annotation?, selector, field+)", SchemaSymbols.ELT_FIELD}, fElem);
+                fElem = DOMUtil.getNextSiblingElement(fElem);
+                continue;
+            }
+            
             // General Attribute Checking
             attrValues = fAttrChecker.checkAttributes(fElem, false, schemaDoc);
             
-            if(!DOMUtil.getLocalName(fElem).equals(SchemaSymbols.ELT_FIELD))
-                reportSchemaError("s4s-elt-must-match.1", new Object[]{"identity constraint", "(annotation?, selector, field+)", SchemaSymbols.ELT_FIELD}, fElem);
-            
             // and make sure &lt;field&gt;'s content is fine:
             Element fieldChild = DOMUtil.getFirstChildElement(fElem);
             if (fieldChild != null) {            
@@ -163,9 +166,10 @@
                 }
             }
             String fText = ((String)attrValues[XSAttributeChecker.ATTIDX_XPATH]);
-            if(fText == null) {
+            if (fText == null) {
                 reportSchemaError("s4s-att-must-appear", new Object [] {SchemaSymbols.ELT_FIELD, SchemaSymbols.ATT_XPATH}, fElem);
-                return;
+                fAttrChecker.returnAttrArray(attrValues, schemaDoc);
+                return false;
             }
             fText = XMLChar.trim(fText);
             try {
@@ -178,13 +182,14 @@
                 reportSchemaError(e.getKey(), new Object[]{fText}, fElem);
                 // put back attr values...
                 fAttrChecker.returnAttrArray(attrValues, schemaDoc);
-                return;
+                return false;
             }
             fElem = DOMUtil.getNextSiblingElement(fElem);
             // put back attr values...
             fAttrChecker.returnAttrArray(attrValues, schemaDoc);
         }
         
+        return ic.getFieldCount() &gt; 0;
     } // traverseIdentityConstraint(IdentityConstraint,Element, XSDocumentInfo)
     
     void traverseIdentityConstraintReferral(Element icElem, XSElementDecl element, 

Modified: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/traversers/XSDAbstractTraverser.java
URL: http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/traversers/XSDAbstractTraverser.java?rev=884566&amp;r1=884565&amp;r2=884566&amp;view=diff
==============================================================================
--- xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/traversers/XSDAbstractTraverser.java (original)
+++ xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/traversers/XSDAbstractTraverser.java Thu Nov 26 14:30:01 2009
@@ -43,6 +43,7 @@
 import org.apache.xerces.util.NamespaceSupport;
 import org.apache.xerces.util.SymbolTable;
 import org.apache.xerces.xni.QName;
+import org.apache.xerces.xs.XSAttributeUse;
 import org.apache.xerces.xs.XSMultiValueFacet;
 import org.apache.xerces.xs.XSObjectList;
 import org.apache.xerces.xs.XSSimpleTypeDefinition;
@@ -128,12 +129,13 @@
                         (name.equals(SchemaSymbols.ELT_DOCUMENTATION)))) {
                     reportSchemaError("src-annotation", new Object[]{name}, child);
                 }
-                
-                // General Attribute Checking
-                // There is no difference between global or local appinfo/documentation,
-                // so we assume it's always global.
-                attrValues = fAttrChecker.checkAttributes(child, true, schemaDoc);
-                fAttrChecker.returnAttrArray(attrValues, schemaDoc);
+                else {
+                    // General Attribute Checking
+                    // There is no difference between global or local appinfo/documentation,
+                    // so we assume it's always global.
+                    attrValues = fAttrChecker.checkAttributes(child, true, schemaDoc);
+                    fAttrChecker.returnAttrArray(attrValues, schemaDoc);
+                }
                 
                 child = DOMUtil.getNextSiblingElement(child);
             }
@@ -366,14 +368,23 @@
                         baseValidator.getPrimitiveKind() == XSSimpleType.PRIMITIVE_NOTATION) {
                     // need to use the namespace context returned from checkAttributes
                     schemaDoc.fValidationContext.setNamespaceSupport(nsDecls);
+                    Object notation = null;
                     try{
                         QName temp = (QName)fQNameDV.validate(enumVal, schemaDoc.fValidationContext, null);
                         // try to get the notation decl. if failed, getGlobalDecl
                         // reports an error, so we don't need to report one again.
-                        fSchemaHandler.getGlobalDecl(schemaDoc, XSDHandler.NOTATION_TYPE, temp, content);
+                        notation = fSchemaHandler.getGlobalDecl(schemaDoc, XSDHandler.NOTATION_TYPE, temp, content);
                     }catch(InvalidDatatypeValueException ex){
                         reportSchemaError(ex.getKey(), ex.getArgs(), content);
                     }
+                    if (notation == null) {
+                        // Either the QName value is invalid, or it doens't
+                        // resolve to a notation declaration.
+                        // Ignore this facet, to avoid instance validation problems
+                        fAttrChecker.returnAttrArray (attrs, schemaDoc);
+                        content = DOMUtil.getNextSiblingElement(content);
+                        continue;
+                    }
                     // restore to the normal namespace context
                     schemaDoc.fValidationContext.setNamespaceSupport(schemaDoc.fNamespaceSupport);
                 }
@@ -735,6 +746,7 @@
         Element child=null;
         XSAttributeGroupDecl tempAttrGrp = null;
         XSAttributeUseImpl tempAttrUse = null;
+        XSAttributeUse otherUse = null;
         String childName;
         
         for (child=firstAttr; child!=null; child=DOMUtil.getNextSiblingElement(child)) {
@@ -744,9 +756,15 @@
                         schemaDoc,
                         grammar,
                         enclosingCT);
-                if (tempAttrUse == null) break;
-                if (attrGrp.getAttributeUse(tempAttrUse.fAttrDecl.getNamespace(),
-                        tempAttrUse.fAttrDecl.getName())==null) {
+                if (tempAttrUse == null) continue;
+                if (tempAttrUse.fUse == SchemaSymbols.USE_PROHIBITED) {
+                    attrGrp.addAttributeUse(tempAttrUse);
+                    continue;
+                }
+                otherUse = attrGrp.getAttributeUseNoProhibited(
+                        tempAttrUse.fAttrDecl.getNamespace(),
+                        tempAttrUse.fAttrDecl.getName());
+                if (otherUse==null) {
                     String idName = attrGrp.addAttributeUse(tempAttrUse);
                     // Only applies to XML Schema 1.0
                     if (fSchemaHandler.fSchemaVersion &lt; Constants.SCHEMA_VERSION_1_1 &amp;&amp; idName != null) {
@@ -755,8 +773,7 @@
                         reportSchemaError(code, new Object[]{name, tempAttrUse.fAttrDecl.getName(), idName}, child);
                     }
                 }
-                else {
-                    // REVISIT: what if one of the attribute uses is "prohibited"
+                else if (otherUse != tempAttrUse) {
                     String code = (enclosingCT == null) ? "ag-props-correct.2" : "ct-props-correct.4";
                     String name = (enclosingCT == null) ? attrGrp.fName : enclosingCT.getName();
                     reportSchemaError(code, new Object[]{name, tempAttrUse.fAttrDecl.getName()}, child);
@@ -766,14 +783,20 @@
                 //REVISIT: do we need to save some state at this point??
                 tempAttrGrp = fSchemaHandler.fAttributeGroupTraverser.traverseLocal(
                         child, schemaDoc, grammar);
-                if(tempAttrGrp == null ) break;
+                if(tempAttrGrp == null ) continue;
                 XSObjectList attrUseS = tempAttrGrp.getAttributeUses();
-                XSAttributeUseImpl existingAttrUse = null, oneAttrUse;
+                XSAttributeUseImpl oneAttrUse;
                 int attrCount = attrUseS.getLength();
                 for (int i=0; i&lt;attrCount; i++) {
                     oneAttrUse = (XSAttributeUseImpl)attrUseS.item(i);
-                    if (existingAttrUse == attrGrp.getAttributeUse(oneAttrUse.fAttrDecl.getNamespace(),
-                            oneAttrUse.fAttrDecl.getName())) {
+                    if (oneAttrUse.fUse == SchemaSymbols.USE_PROHIBITED) {
+                        attrGrp.addAttributeUse(oneAttrUse);
+                        continue;
+                    }
+                    otherUse = attrGrp.getAttributeUseNoProhibited(
+                            oneAttrUse.fAttrDecl.getNamespace(),
+                            oneAttrUse.fAttrDecl.getName());
+                    if (otherUse==null) {
                         String idName = attrGrp.addAttributeUse(oneAttrUse);
                         // Only applies to XML Schema 1.0
                         if (fSchemaHandler.fSchemaVersion &lt; Constants.SCHEMA_VERSION_1_1 &amp;&amp; idName != null) {
@@ -782,8 +805,7 @@
                             reportSchemaError(code, new Object[]{name, oneAttrUse.fAttrDecl.getName(), idName}, child);
                         }
                     }
-                    else {
-                        // REVISIT: what if one of the attribute uses is "prohibited"
+                    else if (oneAttrUse != otherUse) {
                         String code = (enclosingCT == null) ? "ag-props-correct.2" : "ct-props-correct.4";
                         String name = (enclosingCT == null) ? attrGrp.fName : enclosingCT.getName();
                         reportSchemaError(code, new Object[]{name, oneAttrUse.fAttrDecl.getName()}, child);
@@ -898,7 +920,7 @@
         // reference a &lt;group&gt; whose model group is an all model group,
         // minOccurs and maxOccurs must be one.
         if (processingAllEl) {
-        	// XML Schema 1.1 - maxOccurs can have a value &gt; 1
+            // XML Schema 1.1 - maxOccurs can have a value &gt; 1
             if (max != 1 &amp;&amp; fSchemaHandler.fSchemaVersion != Constants.SCHEMA_VERSION_1_1) {
                 reportSchemaError("cos-all-limited.2", new Object[]{new Integer(max),
                         ((XSElementDecl)particle.fValue).getName()}, parent);

Modified: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/traversers/XSDAttributeGroupTraverser.java
URL: http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/traversers/XSDAttributeGroupTraverser.java?rev=884566&amp;r1=884565&amp;r2=884566&amp;view=diff
==============================================================================
--- xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/traversers/XSDAttributeGroupTraverser.java (original)
+++ xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/traversers/XSDAttributeGroupTraverser.java Thu Nov 26 14:30:01 2009
@@ -76,7 +76,6 @@
         // get global decl
         attrGrp = (XSAttributeGroupDecl)fSchemaHandler.getGlobalDecl(schemaDoc, XSDHandler.ATTRIBUTEGROUP_TYPE, refAttr, elmNode);
         
-        
         // no children are allowed here except annotation, which is optional.
         Element child = DOMUtil.getFirstChildElement(elmNode);
         if (child != null) {
@@ -116,7 +115,7 @@
         // global declaration must have a name
         if (nameAttr == null) {
             reportSchemaError("s4s-att-must-appear", new Object[]{"attributeGroup (global)", "name"}, elmNode);
-            nameAttr = "no name";
+            nameAttr = NO_NAME;
         }
         
         attrGrp.fName = nameAttr;
@@ -147,6 +146,12 @@
             reportSchemaError("s4s-elt-must-match.1", args, nextNode);
         } 
         
+        if (nameAttr.equals(NO_NAME)) {
+            // if a global group doesn't have a name, then don't add it.
+            fAttrChecker.returnAttrArray(attrValues, schemaDoc);
+            return null;
+        }
+
         // Remove prohibited attributes from the set
         attrGrp.removeProhibitedAttrs();
         
@@ -174,7 +179,24 @@
         attrGrp.fAnnotations = annotations;
         
         // make an entry in global declarations.
-        grammar.addGlobalAttributeGroupDecl(attrGrp);
+        if (grammar.getGlobalAttributeGroupDecl(attrGrp.fName) == null) {
+            grammar.addGlobalAttributeGroupDecl(attrGrp);
+        }
+
+        // also add it to extended map
+        final String loc = fSchemaHandler.schemaDocument2SystemId(schemaDoc);
+        final XSAttributeGroupDecl attrGrp2 = grammar.getGlobalAttributeGroupDecl(attrGrp.fName, loc);
+        if (attrGrp2 == null) {
+            grammar.addGlobalAttributeGroupDecl(attrGrp, loc);
+        }
+
+        // handle duplicates
+        if (fSchemaHandler.fTolerateDuplicates) {
+            if (attrGrp2 != null) {
+                attrGrp = attrGrp2;
+            }
+            fSchemaHandler.addGlobalAttributeGroupDecl(attrGrp);
+        }
         
         fAttrChecker.returnAttrArray(attrValues, schemaDoc);
         return attrGrp;

Modified: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/traversers/XSDAttributeTraverser.java
URL: http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/traversers/XSDAttributeTraverser.java?rev=884566&amp;r1=884565&amp;r2=884566&amp;view=diff
==============================================================================
--- xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/traversers/XSDAttributeTraverser.java (original)
+++ xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/traversers/XSDAttributeTraverser.java Thu Nov 26 14:30:01 2009
@@ -103,8 +103,7 @@
                 
                 if (child != null) {
                     reportSchemaError("src-attribute.3.2", new Object[]{refAtt.rawname}, child);
-                }               
-                
+                }
                 // for error reporting
                 nameAtt = refAtt.localpart;
             } else {
@@ -172,6 +171,8 @@
         if (consType == XSConstants.VC_DEFAULT &amp;&amp;
                 useAtt != null &amp;&amp; useAtt.intValue() != SchemaSymbols.USE_OPTIONAL) {
             reportSchemaError("src-attribute.2", new Object[]{nameAtt}, attrDecl);
+            // Recover by honouring the default value
+            attrUse.fUse = SchemaSymbols.USE_OPTIONAL;
         }
         
         // a-props-correct
@@ -185,6 +186,9 @@
             catch (InvalidDatatypeValueException ide) {
                 reportSchemaError (ide.getKey(), ide.getArgs(), attrDecl);
                 reportSchemaError ("a-props-correct.2", new Object[]{nameAtt, defaultAtt}, attrDecl);
+                // Recover by removing the default value
+                attrUse.fDefault = null;
+                attrUse.fConstraintType = XSConstants.VC_NONE;
             }
             
             // 3 If the {type definition} is or is derived from ID then there must not be a {value constraint}.
@@ -192,6 +196,9 @@
             // Only applies to XML Schema 1.0
             if (fSchemaHandler.fSchemaVersion &lt; Constants.SCHEMA_VERSION_1_1 &amp;&amp; ((XSSimpleType)attribute.getTypeDefinition()).isIDType() ) {
                 reportSchemaError ("a-props-correct.3", new Object[]{nameAtt}, attrDecl);
+                // Recover by removing the default value
+                attrUse.fDefault = null;
+                attrUse.fConstraintType = XSConstants.VC_NONE;
             }
             
             // check 3.5.6 constraint
@@ -202,6 +209,9 @@
                 if (attrUse.fConstraintType != XSConstants.VC_FIXED ||
                         !attrUse.fAttrDecl.getValInfo().actualValue.equals(attrUse.fDefault.actualValue)) {
                     reportSchemaError ("au-props-correct.2", new Object[]{nameAtt, attrUse.fAttrDecl.getValInfo().stringValue()}, attrDecl);
+                    // Recover by using the decl's {value constraint}
+                    attrUse.fDefault = attrUse.fAttrDecl.getValInfo();
+                    attrUse.fConstraintType = XSConstants.VC_FIXED;
                 }
             }
         }
@@ -327,7 +337,7 @@
             }
         }
         
-        // Handler type attribute
+        // Handle type attribute
         if (attrType == null &amp;&amp; typeAtt != null) {
             XSTypeDefinition type = (XSTypeDefinition)fSchemaHandler.getGlobalDecl(schemaDoc, XSDHandler.TYPEDECL_TYPE, typeAtt, attrDecl);
             if (type != null &amp;&amp; type.getTypeCategory() == XSTypeDefinition.SIMPLE_TYPE) {
@@ -361,10 +371,6 @@
         attribute.setValues(nameAtt, tnsAtt, attrType, constraintType, scope,
                 attDefault, enclCT, annotations, inheritable);
         
-        // Step 2: register attribute decl to the grammar
-        if (isGlobal &amp;&amp; nameAtt != null)
-            grammar.addGlobalAttributeDecl(attribute);
-        
         // Step 3: check against schema for schemas
         
         // required attributes
@@ -440,6 +446,11 @@
             catch (InvalidDatatypeValueException ide) {
                 reportSchemaError (ide.getKey(), ide.getArgs(), attrDecl);
                 reportSchemaError ("a-props-correct.2", new Object[]{nameAtt, attDefault.normalizedValue}, attrDecl);
+                // Recover by removing the default value
+                attDefault = null;
+                constraintType = XSConstants.VC_NONE;
+                attribute.setValues(nameAtt, tnsAtt, attrType, constraintType, scope,
+                        attDefault, enclCT, annotations, inheritable);
             }
         }
         
@@ -449,6 +460,11 @@
         if (fSchemaHandler.fSchemaVersion &lt; Constants.SCHEMA_VERSION_1_1 &amp;&amp; attDefault != null) {
             if (attrType.isIDType() ) {
                 reportSchemaError ("a-props-correct.3", new Object[]{nameAtt}, attrDecl);
+                // Recover by removing the default value
+                attDefault = null;
+                constraintType = XSConstants.VC_NONE;
+                attribute.setValues(nameAtt, tnsAtt, attrType, constraintType, scope,
+                        attDefault, enclCT, annotations, inheritable);
             }
         }
         
@@ -457,6 +473,7 @@
         // The {name} of an attribute declaration must not match xmlns.
         if (nameAtt != null &amp;&amp; nameAtt.equals(XMLSymbols.PREFIX_XMLNS)) {
             reportSchemaError("no-xmlns", null, attrDecl);
+            return null;
         }
         
         // no-xsi
@@ -464,15 +481,37 @@
         // The {target namespace} of an attribute declaration, whether local or top-level, must not match http://www.w3.org/2001/XMLSchema-instance (unless it is one of the four built-in declarations given in the next section).
         if (tnsAtt != null &amp;&amp; tnsAtt.equals(SchemaSymbols.URI_XSI)) {
             reportSchemaError("no-xsi", new Object[]{SchemaSymbols.URI_XSI}, attrDecl);
+            return null;
         }
         
         // Attribute without a name. Return null.
-        if (attribute.getName() == null)
+        if (nameAtt.equals(NO_NAME))
             return null;
-        
+
+        // Step 2: register attribute decl to the grammar
+        if (isGlobal) {
+            if (grammar.getGlobalAttributeDecl(nameAtt) == null) {
+                grammar.addGlobalAttributeDecl(attribute);
+            }
+
+            // also add it to extended map
+            final String loc = fSchemaHandler.schemaDocument2SystemId(schemaDoc);
+            final XSAttributeDecl attribute2 = grammar.getGlobalAttributeDecl(nameAtt, loc);
+            if (attribute2  == null) {
+                grammar.addGlobalAttributeDecl(attribute, loc);
+            }
+
+            if (fSchemaHandler.fTolerateDuplicates) {
+                if (attribute2  != null) {
+                    attribute = attribute2;
+                }
+                fSchemaHandler.addGlobalAttributeDecl(attribute);
+            }
+        }
+
         return attribute;
     }
-    
+
     // throws an error if the constraint value is invalid for the given type
     void checkDefaultValid(XSAttributeDecl attribute) throws InvalidDatatypeValueException {
         // validate the original lexical rep, and set the actual value

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=884566&amp;r1=884565&amp;r2=884566&amp;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 Thu Nov 26 14:30:01 2009
@@ -18,7 +18,6 @@
 
 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.XSFacets;
 import org.apache.xerces.impl.dv.XSSimpleType;
 import org.apache.xerces.impl.dv.xs.XSSimpleTypeDecl;
@@ -29,6 +28,7 @@
 import org.apache.xerces.impl.xs.XSAttributeGroupDecl;
 import org.apache.xerces.impl.xs.XSAttributeUseImpl;
 import org.apache.xerces.impl.xs.XSComplexTypeDecl;
+import org.apache.xerces.impl.xs.XSConstraints;
 import org.apache.xerces.impl.xs.XSModelGroupImpl;
 import org.apache.xerces.impl.xs.XSOpenContentDecl;
 import org.apache.xerces.impl.xs.XSParticleDecl;
@@ -68,13 +68,40 @@
  */
 
 class  XSDComplexTypeTraverser extends XSDAbstractParticleTraverser {
-
-    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";
     
     // size of stack to hold globals:
     private final static int GLOBAL_NUM = 13;
     
+    private static XSParticleDecl fErrorContent = null;
+    private static XSWildcardDecl fErrorWildcard = null;
+    private static XSParticleDecl getErrorContent() {
+        if (fErrorContent == null) {
+            XSParticleDecl particle = new XSParticleDecl();
+            particle.fType = XSParticleDecl.PARTICLE_WILDCARD;
+            particle.fValue = getErrorWildcard();
+            particle.fMinOccurs = 0;
+            particle.fMaxOccurs = SchemaSymbols.OCCURRENCE_UNBOUNDED;
+            XSModelGroupImpl group = new XSModelGroupImpl();
+            group.fCompositor = XSModelGroupImpl.MODELGROUP_SEQUENCE;
+            group.fParticleCount = 1;
+            group.fParticles = new XSParticleDecl[1];
+            group.fParticles[0] = particle;
+            XSParticleDecl errorContent = new XSParticleDecl();
+            errorContent.fType = XSParticleDecl.PARTICLE_MODELGROUP;
+            errorContent.fValue = group;
+            fErrorContent = errorContent;
+        }
+        return fErrorContent;
+    }
+    private static XSWildcardDecl getErrorWildcard() {
+        if (fErrorWildcard == null) {
+            XSWildcardDecl wildcard = new XSWildcardDecl();
+            wildcard.fProcessContents = XSWildcardDecl.PC_SKIP;
+            fErrorWildcard = wildcard;
+        }
+        return fErrorWildcard;
+    }
+    
     // globals for building XSComplexTypeDecls
     private String fName = null;
     private String fTargetNamespace = null;
@@ -92,8 +119,6 @@
     private XSOpenContentDecl fOpenContent = null;
     private XSAssertImpl[] fAssertions = null;
     
-    private XSParticleDecl fEmptyParticle = null;
-    
     // our own little stack to retain state when getGlobalDecls is called:
     private Object [] fGlobalStore = null;
     private int fGlobalStorePos = 0;
@@ -101,22 +126,11 @@
     XSDComplexTypeTraverser (XSDHandler handler,
             XSAttributeChecker gAttrCheck) {
         super(handler, gAttrCheck);
-        if (handler.fSchemaVersion == Constants.SCHEMA_VERSION_1_0) {
-            schemaFactory = SchemaDVFactory.getInstance();
-        }
-        else if (handler.fSchemaVersion == Constants.SCHEMA_VERSION_1_1) {
-            schemaFactory = SchemaDVFactory.getInstance(SCHEMA11_FACTORY_CLASS);
-        }
-        else {
-            schemaFactory =  SchemaDVFactory.getInstance(EXTENDED_SCHEMA_FACTORY_CLASS);
-        }
     }
     
     
     private static final boolean DEBUG=false;
     
-    private SchemaDVFactory schemaFactory;
-    
     private static final class ComplexTypeRecoverableError extends Exception {
         
         private static final long serialVersionUID = 6802729912091130335L;
@@ -181,13 +195,35 @@
         XSComplexTypeDecl type = traverseComplexTypeDecl (complexTypeNode,
                 complexTypeName, attrValues, schemaDoc, grammar);
         contentRestore();
+        // need to add the type to the grammar for later constraint checking
+        grammar.addComplexTypeDecl(type, fSchemaHandler.element2Locator(complexTypeNode));
+
         if (complexTypeName == null) {
             reportSchemaError("s4s-att-must-appear", new Object[]{SchemaSymbols.ELT_COMPLEXTYPE, SchemaSymbols.ATT_NAME}, complexTypeNode);
+            type = null;
         } else {
-            grammar.addGlobalComplexTypeDecl(type);
+            if (grammar.getGlobalTypeDecl(type.getName()) == null) {
+                grammar.addGlobalComplexTypeDecl(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.addGlobalComplexTypeDecl(type, loc);
+            }
+
+            // handle duplicates
+            if (fSchemaHandler.fTolerateDuplicates) {
+                if (type2 != null) {
+                    if (type2 instanceof XSComplexTypeDecl) {
+                        type = (XSComplexTypeDecl) type2;
+                    }
+                }
+                fSchemaHandler.addGlobalTypeDecl(type);
+            }
         }
-        // need to add the type to the grammar for later constraint checking
-        grammar.addComplexTypeDecl(type, fSchemaHandler.element2Locator(complexTypeNode));
+
         fAttrChecker.returnAttrArray(attrValues, schemaDoc);
         
         return type;
@@ -672,16 +708,17 @@
             }
             
             String name = genAnonTypeName(simpleContentElement);
-            fXSSimpleType = schemaFactory.createTypeRestriction(name,schemaDoc.fTargetNamespace,(short)0,baseValidator,null);
-            if (fXSSimpleType instanceof XSSimpleTypeDecl) {
-                ((XSSimpleTypeDecl)fXSSimpleType).setAnonymous(true);
-            }
-            try {
+            fXSSimpleType = fSchemaHandler.fDVFactory.createTypeRestriction(name,schemaDoc.fTargetNamespace,(short)0,baseValidator,null);
+            try{
                 fValidationState.setNamespaceSupport(schemaDoc.fNamespaceSupport);
                 fXSSimpleType.applyFacets(facetData, presentFacets, fixedFacets, fValidationState);
-            }
-            catch(InvalidDatatypeFacetException ex){
+            }catch(InvalidDatatypeFacetException ex){
                 reportSchemaError(ex.getKey(), ex.getArgs(), simpleContent);
+                // Recreate the type, ignoring the facets
+                fXSSimpleType = fSchemaHandler.fDVFactory.createTypeRestriction(name,schemaDoc.fTargetNamespace,(short)0,baseValidator,null);
+            }
+            if (fXSSimpleType instanceof XSSimpleTypeDecl) {
+                ((XSSimpleTypeDecl)fXSSimpleType).setAnonymous(true);
             }
             
             // -----------------------------------------------------------------------
@@ -800,7 +837,7 @@
             boolean mixedOnType, XSDocumentInfo schemaDoc,
             SchemaGrammar grammar)
     throws ComplexTypeRecoverableError {
-
+        
         Object[] complexContentAttrValues = fAttrChecker.checkAttributes(complexContentElement, false,
                 schemaDoc);
 
@@ -1163,18 +1200,7 @@
                 //   {max occurs} 1
                 //   {term}       a model group whose {compositor} is sequence and whose {particles} is empty.
                 else if (fContentType == XSComplexTypeDecl.CONTENTTYPE_EMPTY) {
-                    if (fEmptyParticle == null) {
-                        XSModelGroupImpl group = new XSModelGroupImpl();
-                        group.fCompositor = XSModelGroupImpl.MODELGROUP_SEQUENCE;
-                        group.fParticleCount = 0;
-                        group.fParticles = null;
-                        group.fAnnotations = XSObjectListImpl.EMPTY_LIST;
-                        fEmptyParticle = new XSParticleDecl();
-                        fEmptyParticle.fType = XSParticleDecl.PARTICLE_MODELGROUP;
-                        fEmptyParticle.fValue = group;
-                        fEmptyParticle.fAnnotations = XSObjectListImpl.EMPTY_LIST;
-                    }
-                    fParticle = fEmptyParticle;
+                    fParticle = XSConstraints.getEmptySequence();
                     fContentType = XSComplexTypeDecl.CONTENTTYPE_ELEMENT;
                 }
             }
@@ -1257,11 +1283,14 @@
                             elem);
                 }
             }
-            else {
+            else if (existingAttrUse != oneAttrUse) {
                 if (extension) {
-                    throw new ComplexTypeRecoverableError("ct-props-correct.4",
+                    reportSchemaError("ct-props-correct.4",
                             new Object[]{typeName, oneAttrUse.fAttrDecl.getName()},
                             elem);
+                    // Recover by using the attribute use from the base type,
+                    // to make the resulting schema "more valid".
+                    toAttrGrp.replaceAttributeUse(existingAttrUse, oneAttrUse);
                 }
             }
         }
@@ -1457,18 +1486,7 @@
         // 6.3 Particle of Content type - based on wildcard element
         //    
         if (particle == null &amp;&amp; (isMixed || (!isDerivation &amp;&amp; fOpenContent != null))) {
-            if (fEmptyParticle == null) {
-                XSModelGroupImpl group = new XSModelGroupImpl();
-                group.fCompositor = XSModelGroupImpl.MODELGROUP_SEQUENCE;
-                group.fParticleCount = 0;
-                group.fParticles = null;
-                group.fAnnotations = XSObjectListImpl.EMPTY_LIST;
-                fEmptyParticle = new XSParticleDecl();
-                fEmptyParticle.fType = XSParticleDecl.PARTICLE_MODELGROUP;
-                fEmptyParticle.fValue = group;
-                fEmptyParticle.fAnnotations = XSObjectListImpl.EMPTY_LIST;
-            }
-            particle = fEmptyParticle;
+            particle = XSConstraints.getEmptySequence();
         }
         fParticle = particle;
 
@@ -1659,6 +1677,7 @@
         //
         fBaseType = SchemaGrammar.getXSAnyType(fSchemaHandler.fSchemaVersion);
         fContentType = XSComplexTypeDecl.CONTENTTYPE_MIXED;
+        fXSSimpleType = null;
         fParticle = getErrorContent();
         // REVISIT: do we need to remove all attribute uses already added into
         // the attribute group? maybe it's ok to leave them there. -SG
@@ -1668,30 +1687,6 @@
         
     }
     
-    private XSParticleDecl getErrorContent() {
-        XSParticleDecl particle = new XSParticleDecl();
-        particle.fType = XSParticleDecl.PARTICLE_WILDCARD;
-        particle.fValue = getErrorWildcard();
-        particle.fMinOccurs = 0;
-        particle.fMaxOccurs = SchemaSymbols.OCCURRENCE_UNBOUNDED;
-        XSModelGroupImpl group = new XSModelGroupImpl();
-        group.fCompositor = XSModelGroupImpl.MODELGROUP_SEQUENCE;
-        group.fParticleCount = 1;
-        group.fParticles = new XSParticleDecl[1];
-        group.fParticles[0] = particle;
-        XSParticleDecl errorContent = new XSParticleDecl();
-        errorContent.fType = XSParticleDecl.PARTICLE_MODELGROUP;
-        errorContent.fValue = group;
-        
-        return errorContent;
-    }
-    
-    private XSWildcardDecl getErrorWildcard() {
-        XSWildcardDecl errorWildcard = new XSWildcardDecl();
-        errorWildcard.fProcessContents = XSWildcardDecl.PC_SKIP;
-        return errorWildcard;
-    }
-    
     private void contentBackup() {
         if(fGlobalStore == null) {
             fGlobalStore = new Object [GLOBAL_NUM];

Modified: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/traversers/XSDElementTraverser.java
URL: http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/traversers/XSDElementTraverser.java?rev=884566&amp;r1=884565&amp;r2=884566&amp;view=diff
==============================================================================
--- xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/traversers/XSDElementTraverser.java (original)
+++ xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/traversers/XSDElementTraverser.java Thu Nov 26 14:30:01 2009
@@ -458,7 +458,7 @@
                         fSchemaHandler.checkForDuplicateNames(
                                 (schemaDoc.fTargetNamespace == null) ? ","+DOMUtil.getAttrValue(child, SchemaSymbols.ATT_NAME)
                                         : schemaDoc.fTargetNamespace+","+ DOMUtil.getAttrValue(child, SchemaSymbols.ATT_NAME),
-                                        fSchemaHandler.getIDRegistry(), fSchemaHandler.getIDRegistry_sub(),
+                                        fSchemaHandler.ATTRIBUTE_TYPE, fSchemaHandler.getIDRegistry(), fSchemaHandler.getIDRegistry_sub(),
                                         child, schemaDoc);
                     }
                 } else if (childName.equals(SchemaSymbols.ELT_KEYREF)) {
@@ -471,10 +471,6 @@
             }
         }
         
-        // Step 2: register the element decl to the grammar
-        if (isGlobal &amp;&amp; nameAtt != null)
-            grammar.addGlobalElementDecl(element);
-        
         // Step 3: check against schema for schemas
         
         // required attributes
@@ -488,7 +484,12 @@
         
         // element
         if (child != null) {
-            reportSchemaError("s4s-elt-must-match.1", new Object[]{nameAtt, "(annotation?, (simpleType | complexType)?, alternative*, (unique | key | keyref)*))", DOMUtil.getLocalName(child)}, child);
+            if (fSchemaHandler.fSchemaVersion == Constants.SCHEMA_VERSION_1_1) {
+                reportSchemaError("s4s-elt-must-match.1", new Object[]{nameAtt, "(annotation?, (simpleType | complexType)?, alternative*, (unique | key | keyref)*))", DOMUtil.getLocalName(child)}, child);
+            }
+            else {
+                reportSchemaError("s4s-elt-must-match.1", new Object[]{nameAtt, "(annotation?, (simpleType | complexType)?, (unique | key | keyref)*))", DOMUtil.getLocalName(child)}, child);
+            }
         }
         
         // Step 4: check 3.3.3 constraints
@@ -543,6 +544,7 @@
             fValidationState.setNamespaceSupport(schemaDoc.fNamespaceSupport);
             if (fSchemaHandler.fXSConstraints.ElementDefaultValidImmediate(element.fType, element.fDefault.normalizedValue, fValidationState, element.fDefault) == null) {
                 reportSchemaError ("e-props-correct.2", new Object[]{nameAtt, element.fDefault.normalizedValue}, elmDecl);
+                element.fDefault = null;
                 element.setConstraintType(XSConstants.VC_NONE);
             }
         }
@@ -552,6 +554,7 @@
             for (int i=0; i&lt; element.fSubGroup.length; i++) {
                 if (!fSchemaHandler.fXSConstraints.checkTypeDerivationOk(element.fType, element.fSubGroup[i].fType, element.fSubGroup[i].fFinal)) {
                     reportSchemaError ("e-props-correct.4", new Object[]{nameAtt, ((QName)subGroupAtt.get(i)).prefix +":"+((QName)subGroupAtt.get(i)).localpart}, elmDecl);
+//TODO: remove the subGroup from the list?????
                 }
             }
         }
@@ -565,6 +568,8 @@
                     (elementType.getTypeCategory() == XSTypeDefinition.COMPLEX_TYPE &amp;&amp;
                             ((XSComplexTypeDecl)elementType).containsTypeID())) {
                 reportSchemaError ("e-props-correct.5", new Object[]{element.fName}, elmDecl);
+                element.fDefault = null;
+                element.setConstraintType(XSConstants.VC_NONE);
             }
         }
         
@@ -572,6 +577,31 @@
         if (element.fName == null)
             return null;
         
+        // Step 5: register the element decl to the grammar
+        if (isGlobal) {
+            grammar.addGlobalElementDeclAll(element);
+            
+            if (grammar.getGlobalElementDecl(element.fName) == null) {
+                grammar.addGlobalElementDecl(element);
+            }
+            
+            // we also add the element to the tolerate duplicates list as well
+            final String loc = fSchemaHandler.schemaDocument2SystemId(schemaDoc);
+            final XSElementDecl element2 = grammar.getGlobalElementDecl(element.fName, loc);
+            if (element2 == null) {
+                grammar.addGlobalElementDecl(element, loc);
+            }
+
+            // if we are tolerating duplicates, and we found a duplicate declaration
+            // use the duplicate one instead
+            if (fSchemaHandler.fTolerateDuplicates) {
+                if (element2 != null) {
+                    element = element2;
+                }
+                fSchemaHandler.addGlobalElementDecl(element);
+            }
+        }
+        
         return element;
     }
     

Modified: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/traversers/XSDGroupTraverser.java
URL: http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/traversers/XSDGroupTraverser.java?rev=884566&amp;r1=884565&amp;r2=884566&amp;view=diff
==============================================================================
--- xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/traversers/XSDGroupTraverser.java (original)
+++ xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/traversers/XSDGroupTraverser.java Thu Nov 26 14:30:01 2009
@@ -20,6 +20,7 @@
 import org.apache.xerces.impl.xs.SchemaGrammar;
 import org.apache.xerces.impl.xs.SchemaSymbols;
 import org.apache.xerces.impl.xs.XSAnnotationImpl;
+import org.apache.xerces.impl.xs.XSConstraints;
 import org.apache.xerces.impl.xs.XSGroupDecl;
 import org.apache.xerces.impl.xs.XSModelGroupImpl;
 import org.apache.xerces.impl.xs.XSParticleDecl;
@@ -152,7 +153,9 @@
             reportSchemaError("s4s-att-must-appear", new Object[]{"group (global)", "name"}, elmNode);
         }
         
-        XSGroupDecl group = null;
+        // Create the group defi up-front, so it can be passed
+        // to the traversal methods
+        XSGroupDecl group = new XSGroupDecl();
         XSParticleDecl particle = null;
         
         // must have at least one child
@@ -163,10 +166,6 @@
                     new Object[]{"group (global)", "(annotation?, (all | choice | sequence))"},
                     elmNode);
         } else {
-            // Create the group defi up-front, so it can be passed
-            // to the traversal methods
-            group = new XSGroupDecl();
-            
             String childName = l_elmChild.getLocalName();
             if (childName.equals(SchemaSymbols.ELT_ANNOTATION)) {
                 annotation = traverseAnnotationDecl(l_elmChild, attrValues, true, schemaDoc);
@@ -204,37 +203,56 @@
                         DOMUtil.getLocalName(DOMUtil.getNextSiblingElement(l_elmChild))},
                         DOMUtil.getNextSiblingElement(l_elmChild));
             }
-            
-            // add global group declaration to the grammar
-            if (strNameAttr != null) {
-                group.fName = strNameAttr;
-                group.fTargetNamespace = schemaDoc.fTargetNamespace;
-                // TODO: if particle == null (error situation?), should we
-                //       recover by synthesizing an empty sequence?
-                if (particle != null)
-                    group.fModelGroup = (XSModelGroupImpl)particle.fValue;
-                XSObjectList annotations;
-                if (annotation != null) {
-                    annotations = new XSObjectListImpl();
-                    ((XSObjectListImpl) annotations).addXSObject(annotation);
-                } else {
-                    annotations = XSObjectListImpl.EMPTY_LIST;
-                }
-                group.fAnnotations = annotations;                
+        }
+        
+        // add global group declaration to the grammar
+        if (strNameAttr != null) {
+            group.fName = strNameAttr;
+            group.fTargetNamespace = schemaDoc.fTargetNamespace;
+            if (particle == null) {
+                particle = XSConstraints.getEmptySequence(); 
+            }
+            group.fModelGroup = (XSModelGroupImpl)particle.fValue;
+            XSObjectList annotations;
+            if (annotation != null) {
+                annotations = new XSObjectListImpl();
+                ((XSObjectListImpl) annotations).addXSObject(annotation);
+            } else {
+                annotations = XSObjectListImpl.EMPTY_LIST;
+            }
+            group.fAnnotations = annotations;
+            // Add group declaration to grammar
+            if (grammar.getGlobalGroupDecl(group.fName) == null) {
                 grammar.addGlobalGroupDecl(group);
             }
-            else {
-                // name attribute is not there, don't return this group.
-                group = null;
+
+            // also add it to extended map
+            final String loc = fSchemaHandler.schemaDocument2SystemId(schemaDoc);
+            final XSGroupDecl group2 = grammar.getGlobalGroupDecl(group.fName, loc);
+            if (group2 == null) {
+                grammar.addGlobalGroupDecl(group, loc);
+            }
+
+            // handle duplicates
+            if (fSchemaHandler.fTolerateDuplicates) {
+                if (group2 != null) {
+                    group = group2;
+                }
+                fSchemaHandler.addGlobalGroupDecl(group); 
             }
         }
-        if(group != null) { 
+        else {
+            // name attribute is not there, don't return this group.
+            group = null;
+        }
+
+        if (group != null) { 
             // store groups redefined by restriction in the grammar so
             // that we can get at them at full-schema-checking time.
             Object redefinedGrp = fSchemaHandler.getGrpOrAttrGrpRedefinedByRestriction(XSDHandler.GROUP_TYPE,
                     new QName(XMLSymbols.EMPTY_STRING, strNameAttr, strNameAttr, schemaDoc.fTargetNamespace),
                     schemaDoc, elmNode);
-            if(redefinedGrp != null) {
+            if (redefinedGrp != null) {
                 // store in grammar
                 grammar.addRedefinedGroupDecl(group, (XSGroupDecl)redefinedGrp,
                         fSchemaHandler.element2Locator(elmNode));



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



</pre>
</div>
</content>
</entry>
<entry>
<title>svn commit: r884565 [2/2] - in /xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces: dom/ impl/ impl/dv/xs/ impl/xs/</title>
<author><name>knoaman@apache.org</name></author>
<link rel="alternate" href="http://mail-archives.apache.org/mod_mbox/xerces-commits/200911.mbox/%3c20091126142838.570A123889E8@eris.apache.org%3e"/>
<id>urn:uuid:%3c20091126142838-570A123889E8@eris-apache-org%3e</id>
<updated>2009-11-26T14:28:34Z</updated>
<content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml">
<pre>
Modified: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/XSModelImpl.java
URL: http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/XSModelImpl.java?rev=884565&amp;r1=884564&amp;r2=884565&amp;view=diff
==============================================================================
--- xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/XSModelImpl.java
(original)
+++ xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/XSModelImpl.java
Thu Nov 26 14:28:33 2009
@@ -42,6 +42,7 @@
 import org.apache.xerces.xs.XSNamespaceItem;
 import org.apache.xerces.xs.XSNamespaceItemList;
 import org.apache.xerces.xs.XSNotationDeclaration;
+import org.apache.xerces.xs.XSObject;
 import org.apache.xerces.xs.XSObjectList;
 import org.apache.xerces.xs.XSTypeDefinition;
 
@@ -193,7 +194,7 @@
         fSubGroupMap = buildSubGroups(s4sVersion);
     }
     
-    private SymbolHash buildSubGroups(short s4sVersion) {
+    private SymbolHash buildSubGroups_Org(short s4sVersion) {
         SubstitutionGroupHandler sgHandler = new SubstitutionGroupHandler(null);
         for (int i = 0 ; i &lt; fGrammarCount; i++) {
             sgHandler.addSubstitutionGroup(fGrammarList[i].getSubstitutionGroups());
@@ -213,6 +214,50 @@
         return subGroupMap;
     }
     
+    private SymbolHash buildSubGroups(short s4sVersion) {
+        SubstitutionGroupHandler sgHandler = new SubstitutionGroupHandler(null);
+        for (int i = 0 ; i &lt; fGrammarCount; i++) {
+            sgHandler.addSubstitutionGroup(fGrammarList[i].getSubstitutionGroups());
+        }
+
+        final XSObjectListImpl elements = getGlobalElements();
+        final int len = elements.getLength();
+        final SymbolHash subGroupMap = new SymbolHash(len*2);
+        XSElementDecl head;
+        XSElementDeclaration[] subGroup;
+        for (int i = 0; i &lt; len; i++) {
+            head = (XSElementDecl)elements.item(i);
+            subGroup = sgHandler.getSubstitutionGroup(head, s4sVersion);
+            subGroupMap.put(head, subGroup.length &gt; 0 ? 
+                    new XSObjectListImpl(subGroup, subGroup.length) : XSObjectListImpl.EMPTY_LIST);
+        }
+        return subGroupMap;
+    }
+    
+    private XSObjectListImpl getGlobalElements() {
+        final SymbolHash[] tables = new SymbolHash[fGrammarCount];
+        int length = 0;
+
+        for (int i = 0; i &lt; fGrammarCount; i++) {
+            tables[i] = fGrammarList[i].fAllGlobalElemDecls;
+            length += tables[i].getLength();
+        }
+        
+        if (length == 0) {
+            return XSObjectListImpl.EMPTY_LIST;
+        }
+
+        final XSObject[] components = new XSObject[length];
+        
+        int start = 0;
+        for (int i = 0; i &lt; fGrammarCount; i++) {
+            tables[i].getValues(components, start);
+            start += tables[i].getLength();
+        }
+
+        return new XSObjectListImpl(components, length);
+    }
+    
     /**
      * Convenience method. Returns a list of all namespaces that belong to
      * this schema.
@@ -392,6 +437,25 @@
     }
 
     /**
+     * Convenience method. Returns a top-level simple or complex type
+     * definition.
+     * @param name The name of the definition.
+     * @param namespace The namespace of the definition, otherwise null.
+     * @param loc The schema location where the component was defined
+     * @return An &lt;code&gt;XSTypeDefinition&lt;/code&gt; or null if such definition
+     *   does not exist.
+     */
+    public XSTypeDefinition getTypeDefinition(String name,
+                                              String namespace,
+                                              String loc) {
+        SchemaGrammar sg = (SchemaGrammar)fGrammarMap.get(null2EmptyString(namespace));
+        if (sg == null) {
+            return null;
+        }
+        return sg.getGlobalTypeDecl(name, loc);
+    }
+
+    /**
      * Convenience method. Returns a top-level attribute declaration.
      * @param name The name of the declaration.
      * @param namespace The namespace of the definition, otherwise null.
@@ -408,6 +472,24 @@
     }
 
     /**
+     * Convenience method. Returns a top-level attribute declaration.
+     * @param name The name of the declaration.
+     * @param namespace The namespace of the definition, otherwise null.
+     * @param loc The schema location where the component was defined
+     * @return A top-level attribute declaration or null if such declaration
+     *   does not exist.
+     */
+    public XSAttributeDeclaration getAttributeDeclaration(String name,
+                                                   String namespace,
+                                                   String loc) {
+        SchemaGrammar sg = (SchemaGrammar)fGrammarMap.get(null2EmptyString(namespace));
+        if (sg == null) {
+            return null;
+        }
+        return sg.getGlobalAttributeDecl(name, loc);
+    }
+
+    /**
      * Convenience method. Returns a top-level element declaration.
      * @param name The name of the declaration.
      * @param namespace The namespace of the definition, otherwise null.
@@ -424,6 +506,24 @@
     }
 
     /**
+     * Convenience method. Returns a top-level element declaration.
+     * @param name The name of the declaration.
+     * @param namespace The namespace of the definition, otherwise null.
+     * @param loc The schema location where the component was defined
+     * @return A top-level element declaration or null if such declaration
+     *   does not exist.
+     */
+    public XSElementDeclaration getElementDeclaration(String name,
+                                               String namespace,
+                                               String loc) {
+        SchemaGrammar sg = (SchemaGrammar)fGrammarMap.get(null2EmptyString(namespace));
+        if (sg == null) {
+            return null;
+        }
+        return sg.getGlobalElementDecl(name, loc);
+    }
+
+    /**
      * Convenience method. Returns a top-level attribute group definition.
      * @param name The name of the definition.
      * @param namespace The namespace of the definition, otherwise null.
@@ -438,6 +538,24 @@
         }
         return (XSAttributeGroupDefinition)sg.fGlobalAttrGrpDecls.get(name);
     }
+    
+    /**
+     * Convenience method. Returns a top-level attribute group definition.
+     * @param name The name of the definition.
+     * @param namespace The namespace of the definition, otherwise null.
+     * @param loc The schema location where the component was defined
+     * @return A top-level attribute group definition or null if such
+     *   definition does not exist.
+     */
+    public XSAttributeGroupDefinition getAttributeGroup(String name,
+                                                        String namespace,
+                                                        String loc) {
+        SchemaGrammar sg = (SchemaGrammar)fGrammarMap.get(null2EmptyString(namespace));
+        if (sg == null) {
+            return null;
+        }
+        return sg.getGlobalAttributeGroupDecl(name, loc);
+    }
 
     /**
      * Convenience method. Returns a top-level model group definition.
@@ -455,6 +573,25 @@
         }
         return (XSModelGroupDefinition)sg.fGlobalGroupDecls.get(name);
     }
+    
+    /**
+     * Convenience method. Returns a top-level model group definition.
+     *
+     * @param name      The name of the definition.
+     * @param namespace The namespace of the definition, otherwise null.
+     * @param loc The schema location where the component was defined
+     * @return A top-level model group definition definition or null if such
+     *         definition does not exist.
+     */
+    public XSModelGroupDefinition getModelGroupDefinition(String name,
+                                                          String namespace,
+                                                          String loc) {
+        SchemaGrammar sg = (SchemaGrammar)fGrammarMap.get(null2EmptyString(namespace));
+        if (sg == null) {
+            return null;
+        }
+        return sg.getGlobalGroupDecl(name, loc);
+    }
 
 
     /**
@@ -469,6 +606,16 @@
         return (XSNotationDeclaration)sg.fGlobalNotationDecls.get(name);
     }
 
+    public XSNotationDeclaration getNotationDeclaration(String name,
+                                                 String namespace,
+                                                 String loc) {
+        SchemaGrammar sg = (SchemaGrammar)fGrammarMap.get(null2EmptyString(namespace));
+        if (sg == null) {
+            return null;
+        }
+        return sg.getGlobalNotationDecl(name, loc);
+    }
+
     /**
      *  [annotations]: a set of annotations if it exists, otherwise an empty 
      * &lt;code&gt;XSObjectList&lt;/code&gt;. 



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



</pre>
</div>
</content>
</entry>
<entry>
<title>svn commit: r884565 [1/2] - in /xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces: dom/ impl/ impl/dv/xs/ impl/xs/</title>
<author><name>knoaman@apache.org</name></author>
<link rel="alternate" href="http://mail-archives.apache.org/mod_mbox/xerces-commits/200911.mbox/%3c20091126142837.6F63623888FD@eris.apache.org%3e"/>
<id>urn:uuid:%3c20091126142837-6F63623888FD@eris-apache-org%3e</id>
<updated>2009-11-26T14:28:34Z</updated>
<content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml">
<pre>
Author: knoaman
Date: Thu Nov 26 14:28:33 2009
New Revision: 884565

URL: http://svn.apache.org/viewvc?rev=884565&amp;view=rev
Log:
Synchronize the 1.1 branch with Xerces-J trunk- Part 1

Modified:
    xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/dom/DOMConfigurationImpl.java
    xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/Constants.java
    xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/BaseSchemaDVFactory.java
    xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/XSSimpleTypeDecl.java
    xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/SchemaGrammar.java
    xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/XMLSchemaLoader.java
    xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/XMLSchemaValidator.java
    xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/XSAttributeGroupDecl.java
    xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/XSConstraints.java
    xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/XSDeclarationPool.java
    xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/XSGrammarBucket.java
    xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/XSModelImpl.java

Modified: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/dom/DOMConfigurationImpl.java
URL: http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/dom/DOMConfigurationImpl.java?rev=884565&amp;r1=884564&amp;r2=884565&amp;view=diff
==============================================================================
--- xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/dom/DOMConfigurationImpl.java (original)
+++ xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/dom/DOMConfigurationImpl.java Thu Nov 26 14:28:33 2009
@@ -129,6 +129,12 @@
     protected static final String WARN_ON_DUPLICATE_ATTDEF =
         Constants.XERCES_FEATURE_PREFIX + Constants.WARN_ON_DUPLICATE_ATTDEF_FEATURE;
     
+    /** Feature identifier: namespace growth */
+    protected static final String NAMESPACE_GROWTH = 
+        Constants.XERCES_FEATURE_PREFIX + Constants.NAMESPACE_GROWTH_FEATURE;
+    
+    protected static final String TOLERATE_DUPLICATES = 
+        Constants.XERCES_FEATURE_PREFIX + Constants.TOLERATE_DUPLICATES_FEATURE;    
     // property identifiers
 
     /** Property identifier: entity manager. */
@@ -190,6 +196,10 @@
     protected static final String SCHEMA_NONS_LOCATION =
         Constants.XERCES_PROPERTY_PREFIX + Constants.SCHEMA_NONS_LOCATION;
     
+    /** Property identifier: Schema DV Factory */
+    protected static final String SCHEMA_DV_FACTORY =
+        Constants.XERCES_PROPERTY_PREFIX + Constants.SCHEMA_DV_FACTORY_PROPERTY;
+    
     //
     // Data
     //
@@ -300,7 +310,9 @@
             DISALLOW_DOCTYPE_DECL_FEATURE,
             BALANCE_SYNTAX_TREES,
             WARN_ON_DUPLICATE_ATTDEF,
-            PARSER_SETTINGS
+            PARSER_SETTINGS,
+            NAMESPACE_GROWTH,
+            TOLERATE_DUPLICATES
         };
         addRecognizedFeatures(recognizedFeatures);
 
@@ -321,6 +333,8 @@
         setFeature(BALANCE_SYNTAX_TREES, false);
         setFeature(WARN_ON_DUPLICATE_ATTDEF, false);
         setFeature(PARSER_SETTINGS, true);
+        setFeature(NAMESPACE_GROWTH, false);
+        setFeature(TOLERATE_DUPLICATES, false);
 
         // add default recognized properties
         final String[] recognizedProperties = {
@@ -338,7 +352,8 @@
             SCHEMA_LOCATION,
             SCHEMA_NONS_LOCATION,
             DTD_VALIDATOR_PROPERTY,
-            DTD_VALIDATOR_FACTORY_PROPERTY
+            DTD_VALIDATOR_FACTORY_PROPERTY,
+            SCHEMA_DV_FACTORY
         };
         addRecognizedProperties(recognizedProperties);
 

Modified: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/Constants.java
URL: http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/Constants.java?rev=884565&amp;r1=884564&amp;r2=884565&amp;view=diff
==============================================================================
--- xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/Constants.java (original)
+++ xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/Constants.java Thu Nov 26 14:28:33 2009
@@ -282,6 +282,12 @@
     /** Honour all schemaLocations feature ("honour-all-schemaLocations"). */
     public static final String HONOUR_ALL_SCHEMALOCATIONS_FEATURE = "honour-all-schemaLocations";
     
+    /** Namespace growth feature ("namespace-growth"). */
+    public static final String NAMESPACE_GROWTH_FEATURE = "namespace-growth";
+
+    /** Tolerate duplicates feature ("internal/tolerate-duplicates"). */
+    public static final String TOLERATE_DUPLICATES_FEATURE = "internal/tolerate-duplicates";
+    
     /** XInclude processing feature ("xinclude"). */
     public static final String XINCLUDE_FEATURE = "xinclude";
     
@@ -421,12 +427,15 @@
     /** Validation manager property ("internal/validation-manager"). */
     public static final String VALIDATION_MANAGER_PROPERTY = "internal/validation-manager";
     
-    /** Schema type of the root element in a document ("validation/schema/root-type-definition"). */
+    /** Schema type for the root element in a document ("validation/schema/root-type-definition"). */
     public static final String ROOT_TYPE_DEFINITION_PROPERTY = "validation/schema/root-type-definition";
     
     /** Schema element declaration for the root element in a document ("validation/schema/root-element-declaration"). */
     public static final String ROOT_ELEMENT_DECLARATION_PROPERTY = "validation/schema/root-element-declaration";
 
+    /** Schema element declaration for the root element in a document ("internal/validation/schema/dv-factory"). */
+    public static final String SCHEMA_DV_FACTORY_PROPERTY = "internal/validation/schema/dv-factory";
+
     /** Datatype XML version property ("validation/schema/datatype-xml-version"). */
     public static final String XML_SCHEMA_VERSION_PROPERTY ="validation/schema/version";
     
@@ -526,7 +535,9 @@
             ID_IDREF_CHECKING_FEATURE,
             IDC_CHECKING_FEATURE,
             UNPARSED_ENTITY_CHECKING_FEATURE,
-            TYPE_ALTERNATIVES_CHEKING_FEATURE,
+            NAMESPACE_GROWTH_FEATURE,
+            TOLERATE_DUPLICATES_FEATURE,
+            TYPE_ALTERNATIVES_CHEKING_FEATURE
     };
     
     /** Xerces properties. */
@@ -551,7 +562,8 @@
             LOCALE_PROPERTY,
             ROOT_TYPE_DEFINITION_PROPERTY,
             ROOT_ELEMENT_DECLARATION_PROPERTY,
-            XML_SCHEMA_VERSION_PROPERTY,
+            SCHEMA_DV_FACTORY_PROPERTY,
+            XML_SCHEMA_VERSION_PROPERTY
     };
     
     /** Empty enumeration. */

Modified: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/BaseSchemaDVFactory.java
URL: http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/BaseSchemaDVFactory.java?rev=884565&amp;r1=884564&amp;r2=884565&amp;view=diff
==============================================================================
--- xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/BaseSchemaDVFactory.java (original)
+++ xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/BaseSchemaDVFactory.java Thu Nov 26 14:28:33 2009
@@ -318,4 +318,8 @@
         fDeclPool = declPool;
     }
 
+    /** Implementation internal **/
+    public XSSimpleTypeDecl newXSSimpleTypeDecl() {
+        return new XSSimpleTypeDecl();
+    }
 } //BaseSchemaDVFactory

Modified: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/XSSimpleTypeDecl.java
URL: http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/XSSimpleTypeDecl.java?rev=884565&amp;r1=884564&amp;r2=884565&amp;view=diff
==============================================================================
--- xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/XSSimpleTypeDecl.java (original)
+++ xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/XSSimpleTypeDecl.java Thu Nov 26 14:28:33 2009
@@ -60,40 +60,40 @@
  */
 public class XSSimpleTypeDecl implements XSSimpleType, TypeInfo {
 
-    static final short DV_STRING        = PRIMITIVE_STRING;
-    static final short DV_BOOLEAN       = PRIMITIVE_BOOLEAN;
-    static final short DV_DECIMAL       = PRIMITIVE_DECIMAL;
-    static final short DV_FLOAT         = PRIMITIVE_FLOAT;
-    static final short DV_DOUBLE        = PRIMITIVE_DOUBLE;
-    static final short DV_DURATION      = PRIMITIVE_DURATION;
-    static final short DV_DATETIME      = PRIMITIVE_DATETIME;
-    static final short DV_TIME          = PRIMITIVE_TIME;
-    static final short DV_DATE          = PRIMITIVE_DATE;
-    static final short DV_GYEARMONTH    = PRIMITIVE_GYEARMONTH;
-    static final short DV_GYEAR         = PRIMITIVE_GYEAR;
-    static final short DV_GMONTHDAY     = PRIMITIVE_GMONTHDAY;
-    static final short DV_GDAY          = PRIMITIVE_GDAY;
-    static final short DV_GMONTH        = PRIMITIVE_GMONTH;
-    static final short DV_HEXBINARY     = PRIMITIVE_HEXBINARY;
-    static final short DV_BASE64BINARY  = PRIMITIVE_BASE64BINARY;
-    static final short DV_ANYURI        = PRIMITIVE_ANYURI;
-    static final short DV_QNAME         = PRIMITIVE_QNAME;
-    static final short DV_PRECISIONDECIMAL = PRIMITIVE_PRECISIONDECIMAL;
-    static final short DV_NOTATION      = PRIMITIVE_NOTATION;
-
-    static final short DV_ANYSIMPLETYPE = 0;
-    static final short DV_ID            = DV_NOTATION + 1;
-    static final short DV_IDREF         = DV_NOTATION + 2;
-    static final short DV_ENTITY        = DV_NOTATION + 3;
-    static final short DV_INTEGER       = DV_NOTATION + 4;
-    static final short DV_LIST          = DV_NOTATION + 5;
-    static final short DV_UNION         = DV_NOTATION + 6;
-    static final short DV_YEARMONTHDURATION = DV_NOTATION + 7;
-    static final short DV_DAYTIMEDURATION	= DV_NOTATION + 8;
-    static final short DV_ANYATOMICTYPE = DV_NOTATION + 9;
-    static final short DV_ERROR = DV_NOTATION + 10;
+    protected static final short DV_STRING            = PRIMITIVE_STRING;
+    protected static final short DV_BOOLEAN           = PRIMITIVE_BOOLEAN;
+    protected static final short DV_DECIMAL           = PRIMITIVE_DECIMAL;
+    protected static final short DV_FLOAT             = PRIMITIVE_FLOAT;
+    protected static final short DV_DOUBLE            = PRIMITIVE_DOUBLE;
+    protected static final short DV_DURATION          = PRIMITIVE_DURATION;
+    protected static final short DV_DATETIME          = PRIMITIVE_DATETIME;
+    protected static final short DV_TIME              = PRIMITIVE_TIME;
+    protected static final short DV_DATE              = PRIMITIVE_DATE;
+    protected static final short DV_GYEARMONTH        = PRIMITIVE_GYEARMONTH;
+    protected static final short DV_GYEAR             = PRIMITIVE_GYEAR;
+    protected static final short DV_GMONTHDAY         = PRIMITIVE_GMONTHDAY;
+    protected static final short DV_GDAY              = PRIMITIVE_GDAY;
+    protected static final short DV_GMONTH            = PRIMITIVE_GMONTH;
+    protected static final short DV_HEXBINARY         = PRIMITIVE_HEXBINARY;
+    protected static final short DV_BASE64BINARY      = PRIMITIVE_BASE64BINARY;
+    protected static final short DV_ANYURI            = PRIMITIVE_ANYURI;
+    protected static final short DV_QNAME             = PRIMITIVE_QNAME;
+    protected static final short DV_PRECISIONDECIMAL  = PRIMITIVE_PRECISIONDECIMAL;
+    protected static final short DV_NOTATION          = PRIMITIVE_NOTATION;
+
+    protected static final short DV_ANYSIMPLETYPE     = 0;
+    protected static final short DV_ID                = DV_NOTATION + 1;
+    protected static final short DV_IDREF             = DV_NOTATION + 2;
+    protected static final short DV_ENTITY            = DV_NOTATION + 3;
+    protected static final short DV_INTEGER           = DV_NOTATION + 4;
+    protected static final short DV_LIST              = DV_NOTATION + 5;
+    protected static final short DV_UNION             = DV_NOTATION + 6;
+    protected static final short DV_YEARMONTHDURATION = DV_NOTATION + 7;
+    protected static final short DV_DAYTIMEDURATION	  = DV_NOTATION + 8;
+    protected static final short DV_ANYATOMICTYPE     = DV_NOTATION + 9;
+    protected static final short DV_ERROR             = DV_NOTATION + 10;
 
-    static final TypeValidator[] fDVs = {
+    private static final TypeValidator[] gDVs = {
         new AnySimpleDV(),
         new StringDV(),
         new BooleanDV(),
@@ -231,6 +231,14 @@
         }
     };
 
+    protected static TypeValidator[] getGDVs() {
+        return (TypeValidator[])gDVs.clone();
+    }
+    private TypeValidator[] fDVs = gDVs;
+    protected void setDVs(TypeValidator[] dvs) {
+        fDVs = dvs;
+    }
+    
     // this will be true if this is a static XSSimpleTypeDecl
     // and hence must remain immutable (i.e., applyFacets
     // may not be permitted to have any effect).
@@ -473,6 +481,7 @@
         //decline to do anything if the object is immutable.
         if(fIsImmutable) return null;
         fBase = base;
+        fAnonymous = false;
         fTypeName = name;
         fTargetNamespace = uri;
         fFinalSet = finalSet;
@@ -527,6 +536,7 @@
         //decline to do anything if the object is immutable.
         if(fIsImmutable) return null;
         fBase = fAnySimpleType;
+        fAnonymous = false;
         fTypeName = name;
         fTargetNamespace = uri;
         fFinalSet = finalSet;
@@ -554,6 +564,7 @@
         //decline to do anything if the object is immutable.
         if(fIsImmutable) return null;
         fBase = fAnySimpleType;
+        fAnonymous = false;
         fTypeName = name;
         fTargetNamespace = uri;
         fFinalSet = finalSet;
@@ -605,7 +616,7 @@
     public TypeValidator getTypeValidator() {
         return fDVs[fValidationDV];
     }
-
+    
     public boolean isFinal(short derivation) {
         return (fFinalSet &amp; derivation) != 0;
     }
@@ -849,6 +860,18 @@
             }
         }
 
+        // whiteSpace
+        if ((presentFacet &amp; FACET_WHITESPACE) != 0) {
+            if ((allowedFacet &amp; FACET_WHITESPACE) == 0) {
+                reportError("cos-applicable-facets", new Object[]{"whiteSpace", fTypeName});
+            } else {
+                fWhiteSpace = facets.whiteSpace;
+                whiteSpaceAnnotation = facets.whiteSpaceAnnotation;
+                fFacetsDefined |= FACET_WHITESPACE;
+                if ((fixedFacet &amp; FACET_WHITESPACE) != 0)
+                    fFixedFacet |= FACET_WHITESPACE;
+            }
+        }
         // enumeration
         if ((presentFacet &amp; FACET_ENUMERATION) != 0) {
             if ((allowedFacet &amp; FACET_ENUMERATION) == 0) {
@@ -865,7 +888,7 @@
                     if (enumNSDecls != null)
                         ctx.setNSContext((NamespaceContext)enumNSDecls.elementAt(i));
                     try {
-                        ValidatedInfo info = this.fBase.validateWithInfo((String)enumVals.elementAt(i), ctx, tempInfo);
+                        ValidatedInfo info = getActualEnumValue((String)enumVals.elementAt(i), ctx, tempInfo);
                         // check 4.3.5.c0 must: enumeration values from the value space of base
                         fEnumeration.addElement(info.actualValue);
                         fEnumerationType[i] = info.actualValueType;
@@ -892,19 +915,6 @@
                 fFixedFacet |= FACET_ASSERT;
         }
 
-        // whiteSpace
-        if ((presentFacet &amp; FACET_WHITESPACE) != 0) {
-            if ((allowedFacet &amp; FACET_WHITESPACE) == 0) {
-                reportError("cos-applicable-facets", new Object[]{"whiteSpace", fTypeName});
-            } else {
-                fWhiteSpace = facets.whiteSpace;
-                whiteSpaceAnnotation = facets.whiteSpaceAnnotation;
-                fFacetsDefined |= FACET_WHITESPACE;
-                if ((fixedFacet &amp; FACET_WHITESPACE) != 0)
-                    fFixedFacet |= FACET_WHITESPACE;
-            }
-        }
-
         // maxInclusive
         if ((presentFacet &amp; FACET_MAXINCLUSIVE) != 0) {
             if ((allowedFacet &amp; FACET_MAXINCLUSIVE) == 0) {
@@ -1564,6 +1574,11 @@
 
     }
 
+    protected ValidatedInfo getActualEnumValue(String lexical, ValidationContext ctx, ValidatedInfo info)
+    throws InvalidDatatypeValueException {
+        return fBase.validateWithInfo(lexical, ctx, info);
+    }
+
     /**
      * validate a value, and return the compiled form
      */

Modified: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/SchemaGrammar.java
URL: http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/SchemaGrammar.java?rev=884565&amp;r1=884564&amp;r2=884565&amp;view=diff
==============================================================================
--- xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/SchemaGrammar.java (original)
+++ xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/SchemaGrammar.java Thu Nov 26 14:28:33 2009
@@ -27,6 +27,7 @@
 import org.apache.xerces.impl.dv.xs.XSSimpleTypeDecl;
 import org.apache.xerces.impl.xs.alternative.XSTypeAlternativeImpl;
 import org.apache.xerces.impl.xs.identity.IdentityConstraint;
+import org.apache.xerces.impl.xs.util.ObjectListImpl;
 import org.apache.xerces.impl.xs.util.SimpleLocator;
 import org.apache.xerces.impl.xs.util.StringListImpl;
 import org.apache.xerces.impl.xs.util.XSNamedMap4Types;
@@ -55,6 +56,7 @@
 import org.apache.xerces.xs.XSParticle;
 import org.apache.xerces.xs.XSTypeDefinition;
 import org.apache.xerces.xs.XSWildcard;
+import org.apache.xerces.xs.datatypes.ObjectList;
 import org.xml.sax.SAXException;
 
 /**
@@ -88,6 +90,21 @@
     SymbolHash fGlobalIDConstraintDecls;
     SymbolHash fGlobalTypeDecls;
 
+    // extended global decls: map from schema location + decl name to decl object
+    // key is location,name
+    SymbolHash fGlobalAttrDeclsExt;
+    SymbolHash fGlobalAttrGrpDeclsExt;
+    SymbolHash fGlobalElemDeclsExt;
+    SymbolHash fGlobalGroupDeclsExt;
+    SymbolHash fGlobalNotationDeclsExt;
+    SymbolHash fGlobalIDConstraintDeclsExt;
+    SymbolHash fGlobalTypeDeclsExt;
+    
+    // A global map of all global element declarations - used for substitution group computation
+    // (handy when sharing components by reference, since we might end up with duplicate components
+    //  that are not added to either of the global element declarations above)
+    SymbolHash fAllGlobalElemDecls;
+
     // the XMLGrammarDescription member
     XSDDescription fGrammarDescription = null;
 
@@ -151,6 +168,18 @@
         fGlobalNotationDecls = new SymbolHash();
         fGlobalIDConstraintDecls = new SymbolHash();
 
+        // Extended tables
+        fGlobalAttrDeclsExt  = new SymbolHash();
+        fGlobalAttrGrpDeclsExt = new SymbolHash();
+        fGlobalElemDeclsExt = new SymbolHash();
+        fGlobalGroupDeclsExt = new SymbolHash();
+        fGlobalNotationDeclsExt = new SymbolHash();
+        fGlobalIDConstraintDeclsExt = new SymbolHash();
+        fGlobalTypeDeclsExt = new SymbolHash();
+        
+        // All global elements table
+        fAllGlobalElemDecls = new SymbolHash();
+
         // if we are parsing S4S, put built-in types in first
         // they might get overwritten by the types from S4S, but that's
         // considered what the application wants to do.
@@ -160,7 +189,83 @@
         else {
             fGlobalTypeDecls = new SymbolHash();
         }
-    } // &lt;init&gt;(String, XSDDescription)
+    } // &lt;init&gt;(String, XSDDescription, SymbolTable, short)
+
+ // Clone an existing schema grammar
+    public SchemaGrammar(SchemaGrammar grammar) {
+        fTargetNamespace = grammar.fTargetNamespace;
+        fGrammarDescription = grammar.fGrammarDescription.makeClone();
+        //fGrammarDescription.fContextType |= XSDDescription.CONTEXT_COLLISION; // REVISIT
+        fSymbolTable = grammar.fSymbolTable; // REVISIT
+
+        fGlobalAttrDecls  = grammar.fGlobalAttrDecls.makeClone();
+        fGlobalAttrGrpDecls = grammar.fGlobalAttrGrpDecls.makeClone();
+        fGlobalElemDecls = grammar.fGlobalElemDecls.makeClone();
+        fGlobalGroupDecls = grammar.fGlobalGroupDecls.makeClone();
+        fGlobalNotationDecls = grammar.fGlobalNotationDecls.makeClone();
+        fGlobalIDConstraintDecls = grammar.fGlobalIDConstraintDecls.makeClone();
+        fGlobalTypeDecls = grammar.fGlobalTypeDecls.makeClone();
+    
+        // Extended tables
+        fGlobalAttrDeclsExt  = grammar.fGlobalAttrDeclsExt.makeClone();
+        fGlobalAttrGrpDeclsExt = grammar.fGlobalAttrGrpDeclsExt.makeClone();
+        fGlobalElemDeclsExt = grammar.fGlobalElemDeclsExt.makeClone();
+        fGlobalGroupDeclsExt = grammar.fGlobalGroupDeclsExt.makeClone();
+        fGlobalNotationDeclsExt = grammar.fGlobalNotationDeclsExt.makeClone();
+        fGlobalIDConstraintDeclsExt = grammar.fGlobalIDConstraintDeclsExt.makeClone();
+        fGlobalTypeDeclsExt = grammar.fGlobalTypeDeclsExt.makeClone();
+        
+        // All global elements table
+        fAllGlobalElemDecls = grammar.fAllGlobalElemDecls.makeClone();
+
+        // Annotations associated with the "root" schema of this targetNamespace
+        fNumAnnotations = grammar.fNumAnnotations;
+        if (fNumAnnotations &gt; 0) {
+            fAnnotations = new XSAnnotationImpl[grammar.fAnnotations.length];
+            System.arraycopy(grammar.fAnnotations, 0, fAnnotations, 0, fNumAnnotations);
+        }
+        
+        // All substitution group information declared in this namespace
+        fSubGroupCount = grammar.fSubGroupCount;
+        if (fSubGroupCount &gt; 0) {
+            fSubGroups = new XSElementDecl[grammar.fSubGroups.length];
+            System.arraycopy(grammar.fSubGroups, 0, fSubGroups, 0, fSubGroupCount);
+        }
+
+        // Array to store complex type decls for constraint checking
+        fCTCount = grammar.fCTCount;
+        if (fCTCount &gt; 0) {
+            fComplexTypeDecls = new XSComplexTypeDecl[grammar.fComplexTypeDecls.length];
+            fCTLocators = new SimpleLocator[grammar.fCTLocators.length];
+            System.arraycopy(grammar.fComplexTypeDecls, 0, fComplexTypeDecls, 0, fCTCount);
+            System.arraycopy(grammar.fCTLocators, 0, fCTLocators, 0, fCTCount);
+        }
+        
+        // Groups being redefined by restriction
+        fRGCount = grammar.fRGCount;
+        if (fRGCount &gt; 0) {
+            fRedefinedGroupDecls = new XSGroupDecl[grammar.fRedefinedGroupDecls.length];
+            fRGLocators = new SimpleLocator[grammar.fRGLocators.length];
+            System.arraycopy(grammar.fRedefinedGroupDecls, 0, fRedefinedGroupDecls, 0, fRGCount);
+            System.arraycopy(grammar.fRGLocators, 0, fRGLocators, 0, fRGCount);
+        }
+
+        // List of imported grammars
+        if (grammar.fImported != null) {
+            fImported = new Vector();
+            for (int i=0; i&lt;grammar.fImported.size(); i++) {
+                fImported.add(grammar.fImported.elementAt(i));
+            }
+        }
+
+        // Locations
+        if (grammar.fLocations != null) {
+            for (int k=0; k&lt;grammar.fLocations.size(); k++) {
+                addDocument(null, (String)grammar.fLocations.elementAt(k));
+            }
+        }
+
+    } // &lt;init&gt;(SchemaGrammar)
 
     // number of built-in XSTypes we need to create for base and full
     // datatype set
@@ -210,6 +315,18 @@
                 fGlobalGroupDecls = new SymbolHash(1);
                 fGlobalNotationDecls = new SymbolHash(1);
                 fGlobalIDConstraintDecls = new SymbolHash(1);
+                
+                // no extended global decls
+                fGlobalAttrDeclsExt  = new SymbolHash(1);
+                fGlobalAttrGrpDeclsExt = new SymbolHash(1);
+                fGlobalElemDeclsExt = new SymbolHash(1);
+                fGlobalGroupDeclsExt = new SymbolHash(1);
+                fGlobalNotationDeclsExt = new SymbolHash(1);
+                fGlobalIDConstraintDeclsExt = new SymbolHash(1);
+                fGlobalTypeDeclsExt = new SymbolHash(1);
+
+                // all global element decls table
+                fAllGlobalElemDecls = new SymbolHash(1);
         
                 // get all built-in types
                 fGlobalTypeDecls = schemaFactory.getBuiltInTypes();
@@ -245,6 +362,18 @@
                 fGlobalNotationDecls = new SymbolHash(1);
                 fGlobalIDConstraintDecls = new SymbolHash(1);
                 fGlobalTypeDecls = new SymbolHash(1);
+
+                // no extended global decls 
+                fGlobalAttrDeclsExt  = new SymbolHash(1);
+                fGlobalAttrGrpDeclsExt = new SymbolHash(1);
+                fGlobalElemDeclsExt = new SymbolHash(1);
+                fGlobalGroupDeclsExt = new SymbolHash(1);
+                fGlobalNotationDeclsExt = new SymbolHash(1);
+                fGlobalIDConstraintDeclsExt = new SymbolHash(1);
+                fGlobalTypeDeclsExt = new SymbolHash(1);
+                
+                // no all global element decls
+                fAllGlobalElemDecls = new SymbolHash(1);
     
                 // 4 attributes, so initialize the size as 4*2 = 8
                 fGlobalAttrDecls  = new SymbolHash(8);
@@ -298,27 +427,54 @@
         public void addGlobalAttributeDecl(XSAttributeDecl decl) {
             // ignore
         }
+        public void addGlobalAttributeDecl(XSAttributeDecl decl, String location) {
+            // ignore
+        }
         public void addGlobalAttributeGroupDecl(XSAttributeGroupDecl decl) {
             // ignore
         }
+        public void addGlobalAttributeGroupDecl(XSAttributeGroupDecl decl, String location) {
+            // ignore
+        }
         public void addGlobalElementDecl(XSElementDecl decl) {
             // ignore
         }
+        public void addGlobalElementDecl(XSElementDecl decl, String location) {
+            // ignore
+        }
+        public void addGlobalElementDeclAll(XSElementDecl decl) {
+            // ignore
+        }
         public void addGlobalGroupDecl(XSGroupDecl decl) {
             // ignore
         }
+        public void addGlobalGroupDecl(XSGroupDecl decl, String location) {
+            // ignore
+        }
         public void addGlobalNotationDecl(XSNotationDecl decl) {
             // ignore
         }
+        public void addGlobalNotationDecl(XSNotationDecl decl, String location) {
+            // ignore
+        }
         public void addGlobalTypeDecl(XSTypeDefinition decl) {
             // ignore
         }
+        public void addGlobalTypeDecl(XSTypeDefinition decl, String location) {
+            // ignore
+        }
         public void addGlobalComplexTypeDecl(XSComplexTypeDecl decl) {
             // ignore
         }
+        public void addGlobalComplexTypeDecl(XSComplexTypeDecl decl, String location) {
+            // ignore
+        }
         public void addGlobalSimpleTypeDecl(XSSimpleType decl) {
             // ignore
         }
+        public void addGlobalSimpleTypeDecl(XSSimpleType decl, String location) {
+            // ignore
+        }
         public void addComplexTypeDecl(XSComplexTypeDecl decl, SimpleLocator locator) {
             // ignore
         }
@@ -385,6 +541,18 @@
             fGlobalGroupDecls = new SymbolHash(1);
             fGlobalNotationDecls = new SymbolHash(1);
             fGlobalIDConstraintDecls = new SymbolHash(1);
+
+            // no extended global decls
+            fGlobalAttrDeclsExt  = new SymbolHash(1);
+            fGlobalAttrGrpDeclsExt = new SymbolHash(1);
+            fGlobalElemDeclsExt = new SymbolHash(6);
+            fGlobalGroupDeclsExt = new SymbolHash(1);
+            fGlobalNotationDeclsExt = new SymbolHash(1);
+            fGlobalIDConstraintDeclsExt = new SymbolHash(1);
+            fGlobalTypeDeclsExt = new SymbolHash(1);
+            
+            // all global element declarations
+            fAllGlobalElemDecls = new SymbolHash(6);
             
             // get all built-in types
             fGlobalTypeDecls = getS4SGrammar(schemaVersion).fGlobalTypeDecls;
@@ -399,6 +567,14 @@
             fGlobalElemDecls.put(documentationDecl.fName, documentationDecl);
             fGlobalElemDecls.put(appinfoDecl.fName, appinfoDecl);
             
+            fGlobalElemDeclsExt.put(","+annotationDecl.fName, annotationDecl);
+            fGlobalElemDeclsExt.put(","+documentationDecl.fName, documentationDecl);
+            fGlobalElemDeclsExt.put(","+appinfoDecl.fName, appinfoDecl);
+            
+            fAllGlobalElemDecls.put(annotationDecl, annotationDecl);
+            fAllGlobalElemDecls.put(documentationDecl, documentationDecl);
+            fAllGlobalElemDecls.put(appinfoDecl, appinfoDecl);
+            
             // create complex type declarations for &lt;annotation&gt;, &lt;documentation&gt; and &lt;appinfo&gt;
             XSComplexTypeDecl annotationType = new XSComplexTypeDecl();
             XSComplexTypeDecl documentationType = new XSComplexTypeDecl();
@@ -514,27 +690,54 @@
         public void addGlobalAttributeDecl(XSAttributeDecl decl) {
             // ignore
         }
+        public void addGlobalAttributeDecl(XSAttributeGroupDecl decl, String location) {
+            // ignore
+        }
         public void addGlobalAttributeGroupDecl(XSAttributeGroupDecl decl) {
             // ignore
         }
+        public void addGlobalAttributeGroupDecl(XSAttributeGroupDecl decl, String location) {
+            // ignore
+        }
         public void addGlobalElementDecl(XSElementDecl decl) {
             // ignore
         }
+        public void addGlobalElementDecl(XSElementDecl decl, String location) {
+            // ignore
+        }
+        public void addGlobalElementDeclAll(XSElementDecl decl) {
+            // ignore
+        }
         public void addGlobalGroupDecl(XSGroupDecl decl) {
             // ignore
         }
+        public void addGlobalGroupDecl(XSGroupDecl decl, String location) {
+            // ignore
+        }
         public void addGlobalNotationDecl(XSNotationDecl decl) {
             // ignore
         }
+        public void addGlobalNotationDecl(XSNotationDecl decl, String location) {
+            // ignore
+        }
         public void addGlobalTypeDecl(XSTypeDefinition decl) {
             // ignore
         }
+        public void addGlobalTypeDecl(XSTypeDefinition decl, String location) {
+            // ignore
+        }
         public void addGlobalComplexTypeDecl(XSComplexTypeDecl decl) {
             // ignore
         }
+        public void addGlobalComplexTypeDecl(XSComplexTypeDecl decl, String location) {
+            // ignore
+        }
         public void addGlobalSimpleTypeDecl(XSSimpleType decl) {
             // ignore
         }
+        public void addGlobalSimpleTypeDecl(XSSimpleType decl, String location) {
+            // ignore
+        }
         public void addComplexTypeDecl(XSComplexTypeDecl decl, SimpleLocator locator) {
             // ignore
         }
@@ -650,6 +853,13 @@
         decl.setNamespaceItem(this);
     }
 
+    public void addGlobalAttributeDecl(XSAttributeDecl decl, String location) {
+        fGlobalAttrDeclsExt.put(((location!=null) ? location : "") + "," + decl.fName, decl);
+        if (decl.getNamespaceItem() == null) {
+            decl.setNamespaceItem(this);
+        }
+    }
+
     /**
      * register one global attribute group
      */
@@ -658,19 +868,38 @@
         decl.setNamespaceItem(this);
     }
 
+    public void addGlobalAttributeGroupDecl(XSAttributeGroupDecl decl, String location) {
+        fGlobalAttrGrpDeclsExt.put(((location!=null) ? location : "") + "," + decl.fName, decl);
+        if (decl.getNamespaceItem() == null) {
+            decl.setNamespaceItem(this);
+        }
+    }
+
     /**
      * register one global element
      */
+    public void addGlobalElementDeclAll(XSElementDecl decl) {
+        if (fAllGlobalElemDecls.get(decl) == null) {
+            fAllGlobalElemDecls.put(decl, decl);
+            // if there is a substitution group affiliation, store in an array,
+            // for further constraint checking: UPA, PD, EDC
+            if (decl.fSubGroup != null) {
+               if (fSubGroupCount == fSubGroups.length)
+                    fSubGroups = resize(fSubGroups, fSubGroupCount+INC_SIZE);
+                fSubGroups[fSubGroupCount++] = decl;
+            }
+        }
+    }
+
     public void addGlobalElementDecl(XSElementDecl decl) {
         fGlobalElemDecls.put(decl.fName, decl);
         decl.setNamespaceItem(this);
+    }
 
-        // if there is a substitution group affiliation, store in an array,
-        // for further constraint checking: UPA, PD, EDC
-        if (decl.fSubGroup != null) {
-            if (fSubGroupCount == fSubGroups.length)
-                fSubGroups = resize(fSubGroups, fSubGroupCount+INC_SIZE);
-            fSubGroups[fSubGroupCount++] = decl;
+    public void addGlobalElementDecl(XSElementDecl decl, String location) {
+        fGlobalElemDeclsExt.put(((location != null) ? location : "") + "," + decl.fName, decl);
+        if (decl.getNamespaceItem() == null) {
+            decl.setNamespaceItem(this);
         }
     }
 
@@ -682,6 +911,13 @@
         decl.setNamespaceItem(this);
     }
 
+    public void addGlobalGroupDecl(XSGroupDecl decl, String location) {
+        fGlobalGroupDeclsExt.put(((location!=null) ? location : "") + "," + decl.fName, decl);
+        if (decl.getNamespaceItem() == null) {
+            decl.setNamespaceItem(this);
+        }
+    }
+
     /**
      * register one global notation
      */
@@ -690,6 +926,13 @@
         decl.setNamespaceItem(this);
     }
 
+    public void addGlobalNotationDecl(XSNotationDecl decl, String location) {
+        fGlobalNotationDeclsExt.put(((location!=null) ? location : "") + "," +decl.fName, decl);
+        if (decl.getNamespaceItem() == null) {
+            decl.setNamespaceItem(this);
+        }
+    }
+
     /**
      * register one global type
      */
@@ -702,7 +945,19 @@
             ((XSSimpleTypeDecl) decl).setNamespaceItem(this);
         }
     }
-    
+
+    public void addGlobalTypeDecl(XSTypeDefinition decl, String location) {
+        fGlobalTypeDeclsExt.put(((location!=null) ? location : "") + "," + decl.getName(), decl);
+        if (decl.getNamespaceItem() == null) {
+            if (decl instanceof XSComplexTypeDecl) {
+                ((XSComplexTypeDecl) decl).setNamespaceItem(this);
+            }
+            else if (decl instanceof XSSimpleTypeDecl) {
+                ((XSSimpleTypeDecl) decl).setNamespaceItem(this);
+            }
+        }
+    }
+
     /**
      * register one global complex type
      */
@@ -710,6 +965,13 @@
         fGlobalTypeDecls.put(decl.getName(), decl);
         decl.setNamespaceItem(this);
     }
+
+    public void addGlobalComplexTypeDecl(XSComplexTypeDecl decl, String location) {
+        fGlobalTypeDeclsExt.put(((location!=null) ? location : "") + "," + decl.getName(), decl);
+        if (decl.getNamespaceItem() == null) {
+            decl.setNamespaceItem(this);
+        }
+    }
     
     /**
      * register one global simple type
@@ -721,6 +983,13 @@
         }
     }
 
+    public void addGlobalSimpleTypeDecl(XSSimpleType decl, String location) {
+        fGlobalTypeDeclsExt.put(((location != null) ? location : "") + "," + decl.getName(), decl);
+        if (decl.getNamespaceItem() == null &amp;&amp; decl instanceof XSSimpleTypeDecl) {
+            ((XSSimpleTypeDecl) decl).setNamespaceItem(this);
+        }
+    }
+
     /**
      * register one identity constraint
      */
@@ -729,6 +998,10 @@
         fGlobalIDConstraintDecls.put(decl.getIdentityConstraintName(), decl);
     }
 
+    public final void addIDConstraintDecl(XSElementDecl elmDecl, IdentityConstraint decl, String location) {
+        fGlobalIDConstraintDeclsExt.put(((location != null) ? location : "") + "," + decl.getIdentityConstraintName(), decl);
+    }
+
     /**
      * register one type alternative
      */
@@ -743,6 +1016,10 @@
         return(XSAttributeDecl)fGlobalAttrDecls.get(declName);
     }
 
+    public final XSAttributeDecl getGlobalAttributeDecl(String declName, String location) {
+        return(XSAttributeDecl)fGlobalAttrDeclsExt.get(((location != null) ? location : "") + "," + declName);
+    }
+
     /**
      * get one global attribute group
      */
@@ -750,6 +1027,10 @@
         return(XSAttributeGroupDecl)fGlobalAttrGrpDecls.get(declName);
     }
 
+    public final XSAttributeGroupDecl getGlobalAttributeGroupDecl(String declName, String location) {
+        return(XSAttributeGroupDecl)fGlobalAttrGrpDeclsExt.get(((location != null) ? location : "") + "," + declName);
+    }
+
     /**
      * get one global element
      */
@@ -757,6 +1038,10 @@
         return(XSElementDecl)fGlobalElemDecls.get(declName);
     }
 
+    public final XSElementDecl getGlobalElementDecl(String declName, String location) {
+        return(XSElementDecl)fGlobalElemDeclsExt.get(((location != null) ? location : "") + "," + declName);
+    }
+    
     /**
      * get one global group
      */
@@ -764,6 +1049,10 @@
         return(XSGroupDecl)fGlobalGroupDecls.get(declName);
     }
 
+    public final XSGroupDecl getGlobalGroupDecl(String declName, String location) {
+        return(XSGroupDecl)fGlobalGroupDeclsExt.get(((location != null) ? location : "") + "," + declName);
+    }
+
     /**
      * get one global notation
      */
@@ -771,6 +1060,10 @@
         return(XSNotationDecl)fGlobalNotationDecls.get(declName);
     }
 
+    public final XSNotationDecl getGlobalNotationDecl(String declName, String location) {
+        return(XSNotationDecl)fGlobalNotationDeclsExt.get(((location != null) ? location : "") + "," + declName);
+    }
+
     /**
      * get one global type
      */
@@ -778,6 +1071,10 @@
         return(XSTypeDefinition)fGlobalTypeDecls.get(declName);
     }
 
+    public final XSTypeDefinition getGlobalTypeDecl(String declName, String location) {
+        return(XSTypeDefinition)fGlobalTypeDeclsExt.get(((location != null) ? location : "") + "," + declName);
+    }
+
     /**
      * get one identity constraint
      */
@@ -785,6 +1082,10 @@
         return(IdentityConstraint)fGlobalIDConstraintDecls.get(declName);
     }
 
+    public final IdentityConstraint getIDConstraintDecl(String declName, String location) {
+        return(IdentityConstraint)fGlobalIDConstraintDeclsExt.get(((location != null) ? location : "") + "," + declName);
+    }
+
     /**
      * get one identity constraint
      */
@@ -1130,6 +1431,7 @@
                                                  
     // store a certain kind of components from all namespaces
     private XSNamedMap[] fComponents = null;
+    private ObjectList[] fComponentsExt = null;
 
     // store the documents and their locations contributing to this namespace
     // REVISIT: use StringList and XSObjectList for there fields.
@@ -1271,6 +1573,53 @@
         return fComponents[objectType];
     }
 
+    public synchronized ObjectList getComponentsExt(short objectType) {
+        if (objectType &lt;= 0 || objectType &gt; MAX_COMP_IDX ||
+            !GLOBAL_COMP[objectType]) {
+            return ObjectListImpl.EMPTY_LIST;
+        }
+        
+        if (fComponentsExt == null)
+            fComponentsExt = new ObjectList[MAX_COMP_IDX+1];
+
+        // get the hashtable for this type of components
+        if (fComponentsExt[objectType] == null) {
+            SymbolHash table = null;
+            switch (objectType) {
+            case XSConstants.TYPE_DEFINITION:
+            case XSTypeDefinition.COMPLEX_TYPE:
+            case XSTypeDefinition.SIMPLE_TYPE:
+                table = fGlobalTypeDeclsExt;
+                break;
+            case XSConstants.ATTRIBUTE_DECLARATION:
+                table = fGlobalAttrDeclsExt;
+                break;
+            case XSConstants.ELEMENT_DECLARATION:
+                table = fGlobalElemDeclsExt;
+                break;
+            case XSConstants.ATTRIBUTE_GROUP:
+                table = fGlobalAttrGrpDeclsExt;
+                break;
+            case XSConstants.MODEL_GROUP_DEFINITION:
+                table = fGlobalGroupDeclsExt;
+                break;
+            case XSConstants.NOTATION_DECLARATION:
+                table = fGlobalNotationDeclsExt;
+                break;
+            }
+
+            Object[] entries = table.getEntries();
+            fComponentsExt[objectType] = new ObjectListImpl(entries, entries.length);
+        }
+
+        return fComponentsExt[objectType];
+    }
+
+    public synchronized void resetComponents() {
+        fComponents = null;
+        fComponentsExt = null;
+    }
+
     /**
      * Convenience method. Returns a top-level simple or complex type
      * definition.

Modified: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/XMLSchemaLoader.java
URL: http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/XMLSchemaLoader.java?rev=884565&amp;r1=884564&amp;r2=884565&amp;view=diff
==============================================================================
--- xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/XMLSchemaLoader.java (original)
+++ xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/XMLSchemaLoader.java Thu Nov 26 14:28:33 2009
@@ -38,6 +38,8 @@
 import org.apache.xerces.impl.XMLEntityManager;
 import org.apache.xerces.impl.XMLErrorReporter;
 import org.apache.xerces.impl.dv.InvalidDatatypeValueException;
+import org.apache.xerces.impl.dv.SchemaDVFactory;
+import org.apache.xerces.impl.dv.xs.BaseSchemaDVFactory;
 import org.apache.xerces.impl.xs.models.CMBuilder;
 import org.apache.xerces.impl.xs.models.CMNodeFactory;
 import org.apache.xerces.impl.xs.traversers.XSDHandler;
@@ -132,7 +134,19 @@
         Constants.XERCES_FEATURE_PREFIX + Constants.SCHEMA_AUGMENT_PSVI;
     
     protected static final String PARSER_SETTINGS = 
-        Constants.XERCES_FEATURE_PREFIX + Constants.PARSER_SETTINGS;   
+        Constants.XERCES_FEATURE_PREFIX + Constants.PARSER_SETTINGS;
+    
+    /** 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;
+    
+    /** Property identifier: Schema DV Factory */
+    protected static final String SCHEMA_DV_FACTORY = 
+        Constants.XERCES_PROPERTY_PREFIX + Constants.SCHEMA_DV_FACTORY_PROPERTY;
     
     // recognized features:
     private static final String[] RECOGNIZED_FEATURES = {
@@ -144,7 +158,9 @@
         DISALLOW_DOCTYPE,
         GENERATE_SYNTHETIC_ANNOTATIONS,
         VALIDATE_ANNOTATIONS,
-        HONOUR_ALL_SCHEMALOCATIONS
+        HONOUR_ALL_SCHEMALOCATIONS,
+        NAMESPACE_GROWTH,
+        TOLERATE_DUPLICATES
     };
     
     // property identifiers
@@ -182,7 +198,11 @@
         Constants.JAXP_PROPERTY_PREFIX + Constants.SCHEMA_SOURCE;
     
     protected static final String SECURITY_MANAGER =
-        Constants.XERCES_PROPERTY_PREFIX + Constants.SECURITY_MANAGER_PROPERTY;  
+        Constants.XERCES_PROPERTY_PREFIX + Constants.SECURITY_MANAGER_PROPERTY;
+    
+    /** Property identifier: locale. */
+    protected static final String LOCALE =
+        Constants.XERCES_PROPERTY_PREFIX + Constants.LOCALE_PROPERTY;
     
     protected static final String ENTITY_MANAGER =
         Constants.XERCES_PROPERTY_PREFIX + Constants.ENTITY_MANAGER_PROPERTY;   
@@ -202,9 +222,14 @@
         SCHEMA_NONS_LOCATION,
         JAXP_SCHEMA_SOURCE,
         SECURITY_MANAGER,
+        LOCALE,
+        SCHEMA_DV_FACTORY,
         XML_SCHEMA_VERSION
     };
     
+    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";
+    
     // Data
     
     // features and properties
@@ -231,6 +256,7 @@
     private SubstitutionGroupHandler fSubGroupHandler;
     private CMBuilder fCMBuilder;
     private XSDDescription fXSDDescription = new XSDDescription();
+    private SchemaDVFactory fDefaultSchemaDVFactory;
     
     private WeakHashMap fJAXPCache;
     private Locale fLocale = Locale.getDefault();
@@ -325,7 +351,6 @@
         }
         fCMBuilder = builder;
         fSchemaHandler = new XSDHandler(fGrammarBucket, fSchemaVersion, fXSConstraints);
-        fDeclPool = new XSDeclarationPool();
         fJAXPCache = new WeakHashMap();
         
         fSettingsChanged = true;
@@ -420,6 +445,9 @@
         else if (propertyId.equals(SCHEMA_NONS_LOCATION)){
             fExternalNoNSSchema = (String) state;
         }
+        else if (propertyId.equals(LOCALE)) {
+            setLocale((Locale) state);
+        }
         else if (propertyId.equals(ENTITY_RESOLVER)){
             fEntityManager.setProperty(ENTITY_RESOLVER, state);
         }
@@ -979,13 +1007,16 @@
         
         fGrammarBucket.reset();
         
-        fSubGroupHandler.reset();		
+        fSubGroupHandler.reset();
         
         if (!fSettingsChanged || !parserSettingsUpdated(componentManager)) {
             // need to reprocess JAXP schema sources
             fJAXPProcessed = false;
             // reinitialize grammar bucket
             initGrammarBucket();
+            if (fDeclPool != null) {
+                fDeclPool.reset();
+            }
             return;           
         } 
         
@@ -997,22 +1028,20 @@
         // get the error reporter
         fErrorReporter = (XMLErrorReporter)componentManager.getProperty(ERROR_REPORTER);
         
-        boolean psvi = true;
+        // Determine schema dv factory to use
+        SchemaDVFactory dvFactory = null;
         try {
-            psvi = componentManager.getFeature(AUGMENT_PSVI);
+            dvFactory = (SchemaDVFactory)componentManager.getProperty(SCHEMA_DV_FACTORY);
         } catch (XMLConfigurationException e) {
-            psvi = false;
         }
-        
-        if (!psvi) {
-            fDeclPool.reset();
-            fCMBuilder.setDeclPool(fDeclPool);
-            fSchemaHandler.setDeclPool(fDeclPool);
-        } else {
-            fCMBuilder.setDeclPool(null);
-            fSchemaHandler.setDeclPool(null);
+        if (dvFactory == null) {
+            if (fDefaultSchemaDVFactory == null) {
+                fDefaultSchemaDVFactory = getSchemaDVFactory(fSchemaVersion);
+            }
+            dvFactory = fDefaultSchemaDVFactory;
         }
-        
+        fSchemaHandler.setDVFactory(dvFactory);
+
         // get schema location properties
         try {
             fExternalSchemas = (String) componentManager.getProperty(SCHEMA_LOCATION);
@@ -1039,6 +1068,41 @@
             fGrammarPool = null;
         }
         initGrammarBucket();
+
+        boolean psvi = true;
+        try {
+            psvi = componentManager.getFeature(AUGMENT_PSVI);
+        } catch (XMLConfigurationException e) {
+            psvi = false;
+        }
+        
+        // Only use the decl pool when there is no chance that the schema
+        // components will be exposed or cached.
+        // TODO: when someone calls loadGrammar(XMLInputSource), the schema is
+        // always exposed even without the use of a grammar pool.
+        // Disabling the "decl pool" feature for now until we understand when
+        // it can be safely used.
+        if (!psvi &amp;&amp; fGrammarPool == null &amp;&amp; false) {
+            if (fDeclPool != null) {
+                fDeclPool.reset();
+            }
+            else {
+                fDeclPool = new XSDeclarationPool();
+            }
+            fCMBuilder.setDeclPool(fDeclPool);
+            fSchemaHandler.setDeclPool(fDeclPool);
+            if (dvFactory instanceof BaseSchemaDVFactory) {
+                fDeclPool.setDVFactory((BaseSchemaDVFactory)dvFactory);
+                ((BaseSchemaDVFactory)dvFactory).setDeclPool(fDeclPool);
+            }
+        } else {
+            fCMBuilder.setDeclPool(null);
+            fSchemaHandler.setDeclPool(null);
+            if (dvFactory instanceof BaseSchemaDVFactory) {
+                ((BaseSchemaDVFactory)dvFactory).setDeclPool(null);
+            }
+        }
+        
         // get continue-after-fatal-error feature
         try {
             boolean fatalError = componentManager.getFeature(CONTINUE_AFTER_FATAL_ERROR);
@@ -1061,7 +1125,18 @@
         }
         fSchemaHandler.reset(componentManager);		 
     }
-    
+    private SchemaDVFactory getSchemaDVFactory(short schemaVersion) {
+        if (schemaVersion != Constants.SCHEMA_VERSION_1_0) {
+            if (schemaVersion == Constants.SCHEMA_VERSION_1_1) {
+                return SchemaDVFactory.getInstance(SCHEMA11_FACTORY_CLASS);
+            }
+            else {
+                return  SchemaDVFactory.getInstance(EXTENDED_SCHEMA_FACTORY_CLASS);
+            }
+        }
+
+        return SchemaDVFactory.getInstance();
+    }
     private boolean parserSettingsUpdated(XMLComponentManager componentManager) {
         try {
             return componentManager.getFeature(PARSER_SETTINGS);     
@@ -1180,7 +1255,9 @@
                 name.equals(ALLOW_JAVA_ENCODINGS) ||
                 name.equals(STANDARD_URI_CONFORMANT_FEATURE) ||
                 name.equals(GENERATE_SYNTHETIC_ANNOTATIONS) ||
-                name.equals(HONOUR_ALL_SCHEMALOCATIONS)) {
+                name.equals(HONOUR_ALL_SCHEMALOCATIONS) ||
+                name.equals(NAMESPACE_GROWTH) ||
+                name.equals(TOLERATE_DUPLICATES)) {
                 return true;
                 
             }
@@ -1195,7 +1272,8 @@
             name.equals(XMLGRAMMAR_POOL) ||
             name.equals(SCHEMA_LOCATION) ||
             name.equals(SCHEMA_NONS_LOCATION) ||
-            name.equals(JAXP_SCHEMA_SOURCE)) {
+            name.equals(JAXP_SCHEMA_SOURCE) ||
+            name.equals(SCHEMA_DV_FACTORY)) {
             return true;
         }
         return false;
@@ -1256,6 +1334,8 @@
             v.add(VALIDATE_ANNOTATIONS);
             v.add(GENERATE_SYNTHETIC_ANNOTATIONS);
             v.add(HONOUR_ALL_SCHEMALOCATIONS);
+            v.add(NAMESPACE_GROWTH);
+            v.add(TOLERATE_DUPLICATES);
             fRecognizedParameters = new DOMStringListImpl(v);      	
         }
         return fRecognizedParameters;

Modified: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/XMLSchemaValidator.java
URL: http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/XMLSchemaValidator.java?rev=884565&amp;r1=884564&amp;r2=884565&amp;view=diff
==============================================================================
--- xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/XMLSchemaValidator.java (original)
+++ xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/XMLSchemaValidator.java Thu Nov 26 14:28:33 2009
@@ -18,6 +18,7 @@
 package org.apache.xerces.impl.xs;
 
 import java.io.IOException;
+import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.Hashtable;
 import java.util.Iterator;
@@ -29,6 +30,7 @@
 
 import org.apache.xerces.impl.Constants;
 import org.apache.xerces.impl.RevalidationHandler;
+import org.apache.xerces.impl.XMLEntityManager;
 import org.apache.xerces.impl.XMLErrorReporter;
 import org.apache.xerces.impl.dv.DatatypeException;
 import org.apache.xerces.impl.dv.InvalidDatatypeValueException;
@@ -51,6 +53,7 @@
 import org.apache.xerces.impl.xs.identity.XPathMatcher;
 import org.apache.xerces.impl.xs.models.CMBuilder;
 import org.apache.xerces.impl.xs.models.CMNodeFactory;
+import org.apache.xerces.impl.xs.models.XCMValidatorHelper;
 import org.apache.xerces.impl.xs.models.XSCMValidator;
 import org.apache.xerces.impl.xs.util.XSObjectListImpl;
 import org.apache.xerces.util.AugmentationsImpl;
@@ -59,6 +62,7 @@
 import org.apache.xerces.util.XMLAttributesImpl;
 import org.apache.xerces.util.XMLChar;
 import org.apache.xerces.util.XMLSymbols;
+import org.apache.xerces.util.URI.MalformedURIException;
 import org.apache.xerces.xni.Augmentations;
 import org.apache.xerces.xni.NamespaceContext;
 import org.apache.xerces.xni.QName;
@@ -81,6 +85,7 @@
 import org.apache.xerces.xs.AttributePSVI;
 import org.apache.xerces.xs.ElementPSVI;
 import org.apache.xerces.xs.ShortList;
+import org.apache.xerces.xs.StringList;
 import org.apache.xerces.xs.XSAssert;
 import org.apache.xerces.xs.XSAttributeDeclaration;
 import org.apache.xerces.xs.XSComplexTypeDefinition;
@@ -117,7 +122,7 @@
  * @version $Id$
  */
 public class XMLSchemaValidator
-    implements XMLComponent, XMLDocumentFilter, FieldActivator, RevalidationHandler {
+    implements XMLComponent, XMLDocumentFilter, FieldActivator, RevalidationHandler, XCMValidatorHelper {
 
     //
     // Constants
@@ -184,6 +189,14 @@
 
     protected static final String PARSER_SETTINGS =
             Constants.XERCES_FEATURE_PREFIX + Constants.PARSER_SETTINGS;
+    
+    /** 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 =
@@ -253,6 +266,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;
+
     /** Property identifier: xml schema version. */
     protected static final String XML_SCHEMA_VERSION =
         Constants.XERCES_PROPERTY_PREFIX + Constants.XML_SCHEMA_VERSION_PROPERTY;
@@ -277,7 +294,9 @@
             ID_IDREF_CHECKING,
             IDENTITY_CONSTRAINT_CHECKING,
             UNPARSED_ENTITY_CHECKING,
-            TYPE_ALTERNATIVES_CHECKING,
+            NAMESPACE_GROWTH,
+            TOLERATE_DUPLICATES,
+            TYPE_ALTERNATIVES_CHECKING
         };
 
 
@@ -308,6 +327,8 @@
         null,
         null,
         null,
+        null,
+        null
     };
 
     /** Recognized properties. */
@@ -323,12 +344,13 @@
             JAXP_SCHEMA_LANGUAGE,
             ROOT_TYPE_DEF,
             ROOT_ELEMENT_DECL,
+            SCHEMA_DV_FACTORY,
             XML_SCHEMA_VERSION,
         };
 
     /** Property defaults. */
     private static final Object[] PROPERTY_DEFAULTS =
-        { null, null, null, null, null, null, null, null, null, null, null, };
+        { null, null, null, null, null, null, null, null, null, null, null, null};
 
     // this is the number of valuestores of each kind
     // we expect an element to have.  It's almost
@@ -339,7 +361,10 @@
     static final XSAttributeDecl XSI_TYPE = SchemaGrammar.SG_XSI.getGlobalAttributeDecl(SchemaSymbols.XSI_TYPE);
     static final XSAttributeDecl XSI_NIL = SchemaGrammar.SG_XSI.getGlobalAttributeDecl(SchemaSymbols.XSI_NIL);
     static final XSAttributeDecl XSI_SCHEMALOCATION = SchemaGrammar.SG_XSI.getGlobalAttributeDecl(SchemaSymbols.XSI_SCHEMALOCATION);
-    static final XSAttributeDecl XSI_NONAMESPACESCHEMALOCATION = SchemaGrammar.SG_XSI.getGlobalAttributeDecl(SchemaSymbols.XSI_NONAMESPACESCHEMALOCATION);  
+    static final XSAttributeDecl XSI_NONAMESPACESCHEMALOCATION = SchemaGrammar.SG_XSI.getGlobalAttributeDecl(SchemaSymbols.XSI_NONAMESPACESCHEMALOCATION);
+
+    //
+    private static final Hashtable EMPTY_TABLE = new Hashtable();
 
     //
     // Data
@@ -369,6 +394,9 @@
     protected boolean fIdConstraint = false;
     protected boolean fUseGrammarPoolOnly = false;
 
+    // Namespace growth feature
+    protected boolean fNamespaceGrowth = false;
+    
     /** Schema type: None, DTD, Schema */
     private String fSchemaType = null;
 
@@ -526,6 +554,8 @@
     /** Schema Grammar Description passed,  to give a chance to application to supply the Grammar */
     protected final XSDDescription fXSDDescription = new XSDDescription();
     protected final Hashtable fLocationPairs = new Hashtable();
+    protected final Hashtable fExpandedLocationPairs = new Hashtable();
+    protected final ArrayList fUnparsedLocations = new ArrayList();
 
     /** XML Schema 1.1 Support */
     short fSchemaVersion;
@@ -1396,6 +1426,7 @@
         fIdConstraint = false;
         //reset XSDDescription
         fLocationPairs.clear();
+        fExpandedLocationPairs.clear();
 
         // cleanup id table
         fValidationState.resetIDTables();
@@ -1452,6 +1483,12 @@
         if (symbolTable != fSymbolTable) {
             fSymbolTable = symbolTable;
         }
+        
+        try {
+            fNamespaceGrowth = componentManager.getFeature(NAMESPACE_GROWTH);
+        } catch (XMLConfigurationException e) {
+            fNamespaceGrowth = false;
+        }
 
         try {
             fDynamicValidation = componentManager.getFeature(DYNAMIC_VALIDATION);
@@ -1697,6 +1734,21 @@
         matcher.startDocumentFragment();
     }
 
+    // Implements XCMValidatorHelper interface
+    public XSElementDecl getGlobalElementDecl(QName element) {
+        final SchemaGrammar sGrammar =
+            findSchemaGrammar(
+                XSDDescription.CONTEXT_ELEMENT,
+                element.uri,
+                null,
+                element,
+                null);
+        if (sGrammar != null) {
+            return sGrammar.getGlobalElementDecl(element.localpart);
+        }
+        return null;
+    }
+    
     //
     // Protected methods
     //
@@ -1967,7 +2019,7 @@
         storeLocations(sLocation, nsLocation);
 
         // if we are in the content of "skip", then just skip this element
-        // REVISIT:  is this the correct behavior for ID constraints?  -NG
+        // REVISIT:  is this the correct behaviour for ID constraints?  -NG
         if (fSkipValidationDepth &gt;= 0) {
             fElementDepth++;
             if (fAugPSVI)
@@ -1975,15 +2027,6 @@
             return augs;
         }
 
-        //try to find schema grammar by different means..
-        SchemaGrammar sGrammar =
-            findSchemaGrammar(
-                XSDDescription.CONTEXT_ELEMENT,
-                element.uri,
-                null,
-                element,
-                attributes);
-
         // if we are not skipping this element, and there is a content model,
         // we try to find the corresponding decl object for this element.
         // the reason we move this part of code here is to make sure the
@@ -1991,7 +2034,7 @@
         // context, instead of that of the current element.
         Object decl = null;
         if (fCurrentCM != null) {
-            decl = fCurrentCM.oneTransition(element, fCurrCMState, fSubGroupHandler, sGrammar);
+            decl = fCurrentCM.oneTransition(element, fCurrCMState, fSubGroupHandler, this);
             // it could be an element decl or a wildcard decl
             if (fCurrCMState[0] == XSCMValidator.FIRST_ERROR) {
                 XSComplexTypeDecl ctype = (XSComplexTypeDecl) fCurrentType;
@@ -2153,6 +2196,14 @@
             // case 1: find declaration for root element
             // case 2: find declaration for element from another namespace
             if (fCurrentElemDecl == null) {
+                // try to find schema grammar by different means..
+                SchemaGrammar sGrammar =
+                    findSchemaGrammar(
+                        XSDDescription.CONTEXT_ELEMENT,
+                        element.uri,
+                        null,
+                        element,
+                        attributes);
                 if (sGrammar != null) {
                     fCurrentElemDecl = sGrammar.getGlobalElementDecl(element.localpart);
                 }
@@ -2163,7 +2214,7 @@
                 fCurrentType = fCurrentElemDecl.fType;
             }
         }
-               
+
         // check if we should be ignoring xsi:type on this element
         if (fElementDepth == fIgnoreXSITypeDepth &amp;&amp; fCurrentElemDecl == null) {
             fIgnoreXSITypeDepth++;
@@ -2676,6 +2727,10 @@
             grammars = fGrammarBucket.getGrammars();
             // return the final set of grammars validator ended up with
             if (fGrammarPool != null) {
+                // Set grammars as immutable
+                for (int k=0; k &lt; grammars.length; k++) {
+                    grammars[k].setImmutable(true);
+                }
                 fGrammarPool.cacheGrammars(XMLGrammarDescription.XML_SCHEMA, grammars);
             }
             augs = endElementPSVI(true, grammars, augs);
@@ -2834,39 +2889,19 @@
         short contextType,
         String namespace,
         QName enclosingElement,
-        QName triggeringComponet,
+        QName triggeringComponent,
         XMLAttributes attributes) {
         SchemaGrammar grammar = null;
         //get the grammar from local pool...
         grammar = fGrammarBucket.getGrammar(namespace);
         if (grammar == null) {
-            fXSDDescription.reset();
-            fXSDDescription.fContextType = contextType;
             fXSDDescription.setNamespace(namespace);
-            fXSDDescription.fEnclosedElementName = enclosingElement;
-            fXSDDescription.fTriggeringComponent = triggeringComponet;
-            fXSDDescription.fAttributes = attributes;
-            if (fLocator != null) {
-                fXSDDescription.setBaseSystemId(fLocator.getExpandedSystemId());
-            }
-
-            String[] temp = null;
-            Object locationArray =
-                fLocationPairs.get(namespace == null ? XMLSymbols.EMPTY_STRING : namespace);
-            if (locationArray != null)
-                temp = ((XMLSchemaLoader.LocationArray) locationArray).getLocationArray();
-            if (temp != null &amp;&amp; temp.length != 0) {
-                fXSDDescription.fLocationHints = new String[temp.length];
-                System.arraycopy(temp, 0, fXSDDescription.fLocationHints, 0, temp.length);
-            }
-
-            // give a chance to application to be able to retreive the grammar.
             if (fGrammarPool != null) {
                 grammar = (SchemaGrammar) fGrammarPool.retrieveGrammar(fXSDDescription);
                 if (grammar != null) {
                     // put this grammar into the bucket, along with grammars
                     // imported by it (directly or indirectly)
-                    if (!fGrammarBucket.putGrammar(grammar, true)) {
+                    if (!fGrammarBucket.putGrammar(grammar, true, fNamespaceGrowth)) {
                         // REVISIT: a conflict between new grammar(s) and grammars
                         // in the bucket. What to do? A warning? An exception?
                         fXSIErrorReporter.fErrorReporter.reportError(
@@ -2878,15 +2913,58 @@
                     }
                 }
             }
-            if (grammar == null &amp;&amp; !fUseGrammarPoolOnly) {
+        }
+
+        if (!fUseGrammarPoolOnly &amp;&amp; (grammar == null || 
+            (fNamespaceGrowth &amp;&amp; !hasSchemaComponent(grammar, contextType, triggeringComponent)))) {
+            fXSDDescription.reset();
+            fXSDDescription.fContextType = contextType;
+            fXSDDescription.setNamespace(namespace);
+            fXSDDescription.fEnclosedElementName = enclosingElement;
+            fXSDDescription.fTriggeringComponent = triggeringComponent;
+            fXSDDescription.fAttributes = attributes;
+            if (fLocator != null) {
+                fXSDDescription.setBaseSystemId(fLocator.getExpandedSystemId());
+            }
+
+            Hashtable locationPairs = fLocationPairs;
+            Object locationArray =
+                locationPairs.get(namespace == null ? XMLSymbols.EMPTY_STRING : namespace);
+            if (locationArray != null) {
+                String[] temp = ((XMLSchemaLoader.LocationArray) locationArray).getLocationArray();
+                if (temp.length != 0) {
+                    setLocationHints(fXSDDescription, temp, grammar);
+                }
+            }
+
+            if (grammar == null || fXSDDescription.fLocationHints != null) {
+                boolean toParseSchema = true;
+                if (grammar != null) {
+                     // use location hints instead
+                    locationPairs = EMPTY_TABLE;
+                }
+
                 // try to parse the grammar using location hints from that namespace..
                 try {
                     XMLInputSource xis =
                         XMLSchemaLoader.resolveDocument(
                             fXSDDescription,
-                            fLocationPairs,
+                            locationPairs,
                             fEntityResolver);
-                    grammar = fSchemaLoader.loadSchema(fXSDDescription, xis, fLocationPairs);
+                    if (grammar != null &amp;&amp; fNamespaceGrowth) {
+                        try {
+                            // if we are dealing with a different schema location, then include the new schema
+                            // into the existing grammar
+                            if (grammar.getDocumentLocations().contains(XMLEntityManager.expandSystemId(xis.getSystemId(), xis.getBaseSystemId(), false))) {
+                                toParseSchema = false; 
+                            }
+                        }
+                        catch (MalformedURIException e) {
+                        }
+                    }
+                    if (toParseSchema) {
+                        grammar = fSchemaLoader.loadSchema(fXSDDescription, xis, fLocationPairs);
+                    }
                 } catch (IOException ex) {
                     final String [] locationHints = fXSDDescription.getLocationHints();
                     fXSIErrorReporter.fErrorReporter.reportError(
@@ -2902,6 +2980,61 @@
 
     } //findSchemaGrammar
 
+    private boolean hasSchemaComponent(SchemaGrammar grammar, short contextType, QName triggeringComponent) {
+        if (grammar != null &amp;&amp; triggeringComponent != null) {
+            String localName = triggeringComponent.localpart;
+            if (localName != null &amp;&amp; localName.length() &gt; 0) {
+                switch (contextType) {
+                    case XSDDescription.CONTEXT_ELEMENT:
+                        return grammar.getElementDeclaration(localName) != null;
+                    case XSDDescription.CONTEXT_ATTRIBUTE:
+                        return grammar.getAttributeDeclaration(localName) != null;
+                    case XSDDescription.CONTEXT_XSITYPE:
+                        return grammar.getTypeDefinition(localName) != null;
+                }
+            }
+        }
+        return false;
+    }
+
+    private void setLocationHints(XSDDescription desc, String[] locations, SchemaGrammar grammar) {
+        int length = locations.length;
+        if (grammar == null) {
+            fXSDDescription.fLocationHints = new String[length];
+            System.arraycopy(locations, 0, fXSDDescription.fLocationHints, 0, length);
+        }
+        else {
+            setLocationHints(desc, locations, grammar.getDocumentLocations());
+        }
+    }
+    
+    private void setLocationHints(XSDDescription desc, String[] locations, StringList docLocations) {
+        int length = locations.length;
+        String[] hints = new String[length];
+        int counter = 0;
+
+        for (int i=0; i&lt;length; i++) {
+            try {
+                String id = XMLEntityManager.expandSystemId(locations[i], desc.getBaseSystemId(), false);
+                if (!docLocations.contains(id)) {
+                    hints[counter++] = locations[i];
+                }
+            }
+            catch (MalformedURIException e) {
+            }
+        }
+
+        if (counter &gt; 0) {
+            if (counter == length) {
+                fXSDDescription.fLocationHints = hints;
+            }
+            else {
+                fXSDDescription.fLocationHints = new String[counter];
+                System.arraycopy(hints, 0, fXSDDescription.fLocationHints, 0, counter);
+            }
+        }
+    }
+
     private boolean isValidBuiltInTypeName(String localpart) {
         if (fSchemaVersion == Constants.SCHEMA_VERSION_1_0_EXTENDED) {
             if (localpart.equals("duration") ||
@@ -2912,6 +3045,7 @@
         }
         return true;
     }
+
     XSTypeDefinition getAndCheckXsiType(QName element, String xsiType, XMLAttributes attributes) {
         // This method also deals with clause 1.2.1.2 of the constraint
         // Validation Rule: Schema-Validity Assessment (Element)

Modified: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/XSAttributeGroupDecl.java
URL: http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/XSAttributeGroupDecl.java?rev=884565&amp;r1=884564&amp;r2=884565&amp;view=diff
==============================================================================
--- xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/XSAttributeGroupDecl.java (original)
+++ xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/XSAttributeGroupDecl.java Thu Nov 26 14:28:33 2009
@@ -69,26 +69,36 @@
     // otherwise, return null
     public String addAttributeUse(XSAttributeUseImpl attrUse) {
 
-        if (fAttrUseNum == fAttributeUses.length) {
-            fAttributeUses = resize(fAttributeUses, fAttrUseNum*2);
-        }
-        fAttributeUses[fAttrUseNum++] = attrUse;
         // if this attribute use is prohibited, then don't check whether it's
         // of type ID
-        if (attrUse.fUse == SchemaSymbols.USE_PROHIBITED)
-            return null;
+        if (attrUse.fUse != SchemaSymbols.USE_PROHIBITED) {
+            if (attrUse.fAttrDecl.fType.isIDType()) {
+                // if there is already an attribute use of type ID,
+                // return its name (and don't add it to the list, to avoid
+                // interruption to instance validation.
+                if (fIDAttrName == null)
+                    fIDAttrName = attrUse.fAttrDecl.fName;
+                else
+                    return fIDAttrName;
+            }
+        }
 
-        if (attrUse.fAttrDecl.fType.isIDType()) {
-            // if there is already an attribute use of type ID, return it' sname
-            if (fIDAttrName == null)
-                fIDAttrName = attrUse.fAttrDecl.fName;
-            else
-                return fIDAttrName;
+        if (fAttrUseNum == fAttributeUses.length) {
+            fAttributeUses = resize(fAttributeUses, fAttrUseNum*2);
         }
+        fAttributeUses[fAttrUseNum++] = attrUse;
 
         return null;
     }
 
+    public void replaceAttributeUse(XSAttributeUse oldUse, XSAttributeUseImpl newUse) {
+        for (int i=0; i&lt;fAttrUseNum; i++) {
+            if (fAttributeUses[i] == oldUse) {
+                fAttributeUses[i] = newUse;
+            }
+        }
+    }
+
     public XSAttributeUse getAttributeUse(String namespace, String name) {
         for (int i=0; i&lt;fAttrUseNum; i++) {
             if ( (fAttributeUses[i].fAttrDecl.fTargetNamespace == namespace) &amp;&amp;
@@ -99,36 +109,50 @@
         return null;
     }
 
+    public XSAttributeUse getAttributeUseNoProhibited(String namespace, String name) {
+        for (int i=0; i&lt;fAttrUseNum; i++) {
+            if ( (fAttributeUses[i].fAttrDecl.fTargetNamespace == namespace) &amp;&amp;
+                 (fAttributeUses[i].fAttrDecl.fName == name) &amp;&amp;
+                 (fAttributeUses[i].fUse != SchemaSymbols.USE_PROHIBITED))
+                return fAttributeUses[i];
+        }
+
+        return null;
+    }
+
     public void removeProhibitedAttrs() {
         if (fAttrUseNum == 0) return;
-        int pCount = 0;
-        XSAttributeUseImpl[] pUses = new XSAttributeUseImpl[fAttrUseNum];
+        // Remove all prohibited attributes.
+        int count = 0;
+        XSAttributeUseImpl[] uses = new XSAttributeUseImpl[fAttrUseNum];
         for (int i = 0; i &lt; fAttrUseNum; i++) {
-            if (fAttributeUses[i].fUse == SchemaSymbols.USE_PROHIBITED) {
-                pCount++;
-                // we use the entries at the end, so that we can use the
-                // first entries to store non-prohibited attribute uses,
-                // hence avoid creating a new array.
-                pUses[fAttrUseNum-pCount] = fAttributeUses[i];
+            if (fAttributeUses[i].fUse != SchemaSymbols.USE_PROHIBITED) {
+                uses[count++] = fAttributeUses[i];
             }
         }
+        fAttributeUses = uses;
+        fAttrUseNum = count;
 
-        int newCount = 0;
-        if (pCount &gt; 0) {
-            OUTER: for (int i = 0; i &lt; fAttrUseNum; i++) {
-                if (fAttributeUses[i].fUse == SchemaSymbols.USE_PROHIBITED)
-                    continue;
-                for (int j = 1; j &lt;= pCount; j++) {
-                    if (fAttributeUses[i].fAttrDecl.fName == pUses[fAttrUseNum-pCount].fAttrDecl.fName &amp;&amp;
-                        fAttributeUses[i].fAttrDecl.fTargetNamespace == pUses[fAttrUseNum-pCount].fAttrDecl.fTargetNamespace) {
-                        continue OUTER;
-                    }
-                }
-                pUses[newCount++] = fAttributeUses[i];
-            }
-            fAttributeUses = pUses;
-            fAttrUseNum = newCount;
-        }
+        // Do not remove attributes that have the same name as the prohibited
+        // ones, because they are specified at the same level. Prohibited
+        // attributes are only to remove attributes from the base type in a
+        // restriction.
+//        int newCount = 0;
+//        if (pCount &gt; 0) {
+//            OUTER: for (int i = 0; i &lt; fAttrUseNum; i++) {
+//                if (fAttributeUses[i].fUse == SchemaSymbols.USE_PROHIBITED)
+//                    continue;
+//                for (int j = 1; j &lt;= pCount; j++) {
+//                    if (fAttributeUses[i].fAttrDecl.fName == pUses[fAttrUseNum-pCount].fAttrDecl.fName &amp;&amp;
+//                        fAttributeUses[i].fAttrDecl.fTargetNamespace == pUses[fAttrUseNum-pCount].fAttrDecl.fTargetNamespace) {
+//                        continue OUTER;
+//                    }
+//                }
+//                pUses[newCount++] = fAttributeUses[i];
+//            }
+//            fAttributeUses = pUses;
+//            fAttrUseNum = newCount;
+//        }
     }
 
     /**

Modified: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/XSConstraints.java
URL: http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/XSConstraints.java?rev=884565&amp;r1=884564&amp;r2=884565&amp;view=diff
==============================================================================
--- xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/XSConstraints.java (original)
+++ xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/XSConstraints.java Thu Nov 26 14:28:33 2009
@@ -30,6 +30,7 @@
 import org.apache.xerces.impl.xs.models.CMBuilder;
 import org.apache.xerces.impl.xs.models.XSCMValidator;
 import org.apache.xerces.impl.xs.util.SimpleLocator;
+import org.apache.xerces.impl.xs.util.XSObjectListImpl;
 import org.apache.xerces.util.SymbolHash;
 import org.apache.xerces.xs.XSConstants;
 import org.apache.xerces.xs.XSObjectList;
@@ -55,6 +56,23 @@
     // TODO: using 1.0 xs:string
     static final XSSimpleType STRING_TYPE = (XSSimpleType)SchemaGrammar.getS4SGrammar(Constants.SCHEMA_VERSION_1_0).getGlobalTypeDecl(SchemaSymbols.ATTVAL_STRING);
 
+    private static XSParticleDecl fEmptyParticle = null;
+    public static XSParticleDecl getEmptySequence() {
+        if (fEmptyParticle == null) {
+            XSModelGroupImpl group = new XSModelGroupImpl();
+            group.fCompositor = XSModelGroupImpl.MODELGROUP_SEQUENCE;
+            group.fParticleCount = 0;
+            group.fParticles = null;
+            group.fAnnotations = XSObjectListImpl.EMPTY_LIST;
+            XSParticleDecl particle = new XSParticleDecl();
+            particle.fType = XSParticleDecl.PARTICLE_MODELGROUP;
+            particle.fValue = group;
+            particle.fAnnotations = XSObjectListImpl.EMPTY_LIST;
+            fEmptyParticle = particle;
+       }
+        return fEmptyParticle;
+    }
+
     static final XSConstraints XS_1_0_CONSTRAINTS = new XS10Constraints(Constants.SCHEMA_VERSION_1_0);
     static final XSConstraints XS_1_0_CONSTRAINTS_EXTENDED = new XS10Constraints(Constants.SCHEMA_VERSION_1_0_EXTENDED);
     static final XSConstraints XS_1_1_CONSTRAINTS = new XS11Constraints();

Modified: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/XSDeclarationPool.java
URL: http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/XSDeclarationPool.java?rev=884565&amp;r1=884564&amp;r2=884565&amp;view=diff
==============================================================================
--- xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/XSDeclarationPool.java (original)
+++ xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/XSDeclarationPool.java Thu Nov 26 14:28:33 2009
@@ -17,6 +17,7 @@
 
 package org.apache.xerces.impl.xs;
 
+import org.apache.xerces.impl.dv.xs.BaseSchemaDVFactory;
 import org.apache.xerces.impl.dv.xs.XSSimpleTypeDecl;
 
 /**
@@ -71,6 +72,11 @@
     /** AttributeUse declaration pool */
     private XSAttributeUseImpl fAttributeUse[][] = new XSAttributeUseImpl[INITIAL_CHUNK_COUNT][];
     private int fAttributeUseIndex = 0;
+    
+    private BaseSchemaDVFactory dvFactory;
+    public void setDVFactory(BaseSchemaDVFactory dvFactory) {
+        this.dvFactory = dvFactory;
+    }
 
     public final  XSElementDecl getElementDecl(){
         int     chunk       = fElementDeclIndex &gt;&gt; CHUNK_SHIFT;
@@ -132,7 +138,7 @@
         int     index       = fSTDeclIndex &amp;  CHUNK_MASK;
         ensureSTDeclCapacity(chunk);
         if (fSTDecl[chunk][index] == null) {
-            fSTDecl[chunk][index] = new XSSimpleTypeDecl();
+            fSTDecl[chunk][index] = dvFactory.newXSSimpleTypeDecl();
         } else {
             fSTDecl[chunk][index].reset();
         }

Modified: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/XSGrammarBucket.java
URL: http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/XSGrammarBucket.java?rev=884565&amp;r1=884564&amp;r2=884565&amp;view=diff
==============================================================================
--- xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/XSGrammarBucket.java (original)
+++ xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/XSGrammarBucket.java Thu Nov 26 14:28:33 2009
@@ -134,6 +134,77 @@
     }
 
     /**
+     * put a schema grammar and any grammars imported by it (directly or
+     * inderectly) into the registry. when a grammar with the same target
+     * namespace is already in the bucket, and different from the one being
+     * added, no grammar will be added into the bucket.
+     *
+     * @param grammar        the grammar to put in the registry
+     * @param deep           whether to add imported grammars
+     * @param ignoreConflict whether to ignore grammars that already exist in the grammar
+     *                       bucket or not - including 'grammar' parameter. 
+     * @return               whether the process succeeded
+     */
+    public boolean putGrammar(SchemaGrammar grammar, boolean deep, boolean ignoreConflict) {
+        if (!ignoreConflict) {
+            return putGrammar(grammar, deep);
+        }
+
+        // if grammar already exist in the bucket, we ignore the request
+        SchemaGrammar sg = getGrammar(grammar.fTargetNamespace);
+        if (sg == null) {
+            putGrammar(grammar);
+        }
+        
+        // not adding the imported grammars
+        if (!deep) {
+            return true;
+        }
+
+        // get all imported grammars, and make a copy of the Vector, so that
+        // we can recursively process the grammars, and add distinct ones
+        // to the same vector
+        Vector currGrammars = (Vector)grammar.getImportedGrammars();
+        if (currGrammars == null) {
+            return true;
+        }
+        
+        Vector grammars = ((Vector)currGrammars.clone());
+        SchemaGrammar sg1, sg2;
+        Vector gs;
+        // for all (recursively) imported grammars
+        for (int i = 0; i &lt; grammars.size(); i++) {
+            // get the grammar
+            sg1 = (SchemaGrammar)grammars.elementAt(i);
+            // check whether the bucket has one with the same tns
+            sg2 = getGrammar(sg1.fTargetNamespace);
+            if (sg2 == null) {
+                // we need to add grammars imported by sg1 too
+                gs = sg1.getImportedGrammars();
+                // for all grammars imported by sg2, but not in the vector
+                // we add them to the vector
+                if(gs == null) continue;
+                for (int j = gs.size() - 1; j &gt;= 0; j--) {
+                    sg2 = (SchemaGrammar)gs.elementAt(j);
+                    if (!grammars.contains(sg2))
+                        grammars.addElement(sg2);
+                }
+            }
+            // we found one with the same target namespace, ignore it
+            else  {
+                grammars.remove(sg1);
+            }
+        }
+
+        // now we have all imported grammars stored in the vector. add them
+        for (int i = grammars.size() - 1; i &gt;= 0; i--) {
+            putGrammar((SchemaGrammar)grammars.elementAt(i));
+        }
+
+        return true;
+    }
+
+    /**
      * get all grammars in the registry
      *
      * @return an array of SchemaGrammars.



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



</pre>
</div>
</content>
</entry>
<entry>
<title>svn commit: r883990 - /xerces/java/trunk/src/org/apache/xerces/impl/xs/XMLSchemaValidator.java</title>
<author><name>mrglavas@apache.org</name></author>
<link rel="alternate" href="http://mail-archives.apache.org/mod_mbox/xerces-commits/200911.mbox/%3c20091125062714.A853A2388996@eris.apache.org%3e"/>
<id>urn:uuid:%3c20091125062714-A853A2388996@eris-apache-org%3e</id>
<updated>2009-11-25T06:27:14Z</updated>
<content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml">
<pre>
Author: mrglavas
Date: Wed Nov 25 06:27:14 2009
New Revision: 883990

URL: http://svn.apache.org/viewvc?rev=883990&amp;view=rev
Log:
If the value of "use-grammar-pool-only" is true do not allow any mutations to the existing
grammars or any new grammars to be loaded, even if the "namespace-growth" feature has been
enabled. This is the behaviour required by JAXP when an application loads the schemas up front
from a SchemaFactory.

Modified:
    xerces/java/trunk/src/org/apache/xerces/impl/xs/XMLSchemaValidator.java

Modified: xerces/java/trunk/src/org/apache/xerces/impl/xs/XMLSchemaValidator.java
URL: http://svn.apache.org/viewvc/xerces/java/trunk/src/org/apache/xerces/impl/xs/XMLSchemaValidator.java?rev=883990&amp;r1=883989&amp;r2=883990&amp;view=diff
==============================================================================
--- xerces/java/trunk/src/org/apache/xerces/impl/xs/XMLSchemaValidator.java (original)
+++ xerces/java/trunk/src/org/apache/xerces/impl/xs/XMLSchemaValidator.java Wed Nov 25 06:27:14
2009
@@ -2645,8 +2645,8 @@
             }
         }
 
-        if ((grammar == null &amp;&amp; !fUseGrammarPoolOnly) || 
-            (fNamespaceGrowth &amp;&amp; !hasSchemaComponent(grammar, contextType, triggeringComponent)))
{
+        if (!fUseGrammarPoolOnly &amp;&amp; (grammar == null || 
+            (fNamespaceGrowth &amp;&amp; !hasSchemaComponent(grammar, contextType, triggeringComponent))))
{
             fXSDDescription.reset();
             fXSDDescription.fContextType = contextType;
             fXSDDescription.setNamespace(namespace);



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



</pre>
</div>
</content>
</entry>
<entry>
<title>svn commit: r883971 - /xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/AbstractPsychoPathImpl.java</title>
<author><name>mukulg@apache.org</name></author>
<link rel="alternate" href="http://mail-archives.apache.org/mod_mbox/xerces-commits/200911.mbox/%3c20091125033109.6A82A23888C5@eris.apache.org%3e"/>
<id>urn:uuid:%3c20091125033109-6A82A23888C5@eris-apache-org%3e</id>
<updated>2009-11-25T03:31:09Z</updated>
<content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml">
<pre>
Author: mukulg
Date: Wed Nov 25 03:31:08 2009
New Revision: 883971

URL: http://svn.apache.org/viewvc?rev=883971&amp;view=rev
Log:
committing some minor improvements (improving duplicate code issues).

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

Modified: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/AbstractPsychoPathImpl.java
URL: http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/AbstractPsychoPathImpl.java?rev=883971&amp;r1=883970&amp;r2=883971&amp;view=diff
==============================================================================
--- xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/AbstractPsychoPathImpl.java
(original)
+++ xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/AbstractPsychoPathImpl.java
Wed Nov 25 03:31:08 2009
@@ -206,9 +206,6 @@
         else if ("time".equals(xsdTypeName)) {
            psychoPathType = XSTime.parse_time(value);
         }
-        else if ("date".equals(xsdTypeName)) {
-           psychoPathType = XSDate.parse_date(value);
-        }
         else if ("boolean".equals(xsdTypeName)) {
            psychoPathType = new XSBoolean(Boolean.valueOf(value).booleanValue());
         }



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



</pre>
</div>
</content>
</entry>
<entry>
<title>svn commit: r883954 - in /xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs: AbstractPsychoPathImpl.java XMLAssertPsychopathImpl.java</title>
<author><name>mukulg@apache.org</name></author>
<link rel="alternate" href="http://mail-archives.apache.org/mod_mbox/xerces-commits/200911.mbox/%3c20091125014518.BF0532388996@eris.apache.org%3e"/>
<id>urn:uuid:%3c20091125014518-BF0532388996@eris-apache-org%3e</id>
<updated>2009-11-25T01:45:18Z</updated>
<content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml">
<pre>
Author: mukulg
Date: Wed Nov 25 01:45:17 2009
New Revision: 883954

URL: http://svn.apache.org/viewvc?rev=883954&amp;view=rev
Log:
improvements to assertions implementation. this fix provides, better assert XDM tree construction,
and improves typing support for assertions xpath2 "dynamic context" variable, $value.

Modified:
    xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/AbstractPsychoPathImpl.java
    xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/XMLAssertPsychopathImpl.java

Modified: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/AbstractPsychoPathImpl.java
URL: http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/AbstractPsychoPathImpl.java?rev=883954&amp;r1=883953&amp;r2=883954&amp;view=diff
==============================================================================
--- xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/AbstractPsychoPathImpl.java
(original)
+++ xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/AbstractPsychoPathImpl.java
Wed Nov 25 01:45:17 2009
@@ -17,6 +17,8 @@
 
 package org.apache.xerces.impl.xs;
 
+import java.math.BigDecimal;
+import java.math.BigInteger;
 import java.util.Enumeration;
 import java.util.Map;
 
@@ -45,6 +47,16 @@
 import org.eclipse.wst.xml.xpath2.processor.internal.types.AnyType;
 import org.eclipse.wst.xml.xpath2.processor.internal.types.ElementType;
 import org.eclipse.wst.xml.xpath2.processor.internal.types.XSBoolean;
+import org.eclipse.wst.xml.xpath2.processor.internal.types.XSDate;
+import org.eclipse.wst.xml.xpath2.processor.internal.types.XSDateTime;
+import org.eclipse.wst.xml.xpath2.processor.internal.types.XSDecimal;
+import org.eclipse.wst.xml.xpath2.processor.internal.types.XSDouble;
+import org.eclipse.wst.xml.xpath2.processor.internal.types.XSFloat;
+import org.eclipse.wst.xml.xpath2.processor.internal.types.XSInt;
+import org.eclipse.wst.xml.xpath2.processor.internal.types.XSInteger;
+import org.eclipse.wst.xml.xpath2.processor.internal.types.XSLong;
+import org.eclipse.wst.xml.xpath2.processor.internal.types.XSString;
+import org.eclipse.wst.xml.xpath2.processor.internal.types.XSTime;
 import org.w3c.dom.Document;
 import org.w3c.dom.Element;
 
@@ -153,6 +165,65 @@
     }
     
     /*
+     * Get psychopath xpath2 typed value, corresponding to the XSD language
+     * type.
+     * 
+     * @param xsdTypeName a XSD built in type name, like "string", "date" etc.
+     * @param value a "string value", that need to be converted to, the
+     *        psychopath xpath2 XSD typed value.  
+     */
+    protected Object getPsychoPathTypeForXSDType(String xsdTypeName,
+                                                 String value) {
+        Object psychoPathType = null;
+        
+        if ("string".equals(xsdTypeName)) {
+            psychoPathType = new XSString(value);   
+        }
+        else if ("date".equals(xsdTypeName)) {       
+            psychoPathType = XSDate.parse_date(value);
+        }
+        else if ("int".equals(xsdTypeName)) {      
+            psychoPathType = new XSInt(new BigInteger(value));
+        }
+        else if ("long".equals(xsdTypeName)) {     
+           psychoPathType = new XSLong(new BigInteger(value));
+        }
+        else if ("integer".equals(xsdTypeName)) {      
+           psychoPathType = new XSInteger(new BigInteger(value));
+        }
+        else if ("double".equals(xsdTypeName)) {       
+           psychoPathType = new XSDouble(Double.parseDouble(value));
+        }
+        else if ("float".equals(xsdTypeName)) {        
+           psychoPathType = new XSFloat(Float.parseFloat(value));
+        }
+        else if ("decimal".equals(xsdTypeName)) {      
+           psychoPathType = new XSDecimal(new BigDecimal(value));
+        }
+        else if ("dateTime".equals(xsdTypeName)) {
+           psychoPathType = XSDateTime.parseDateTime(value);
+        }
+        else if ("time".equals(xsdTypeName)) {
+           psychoPathType = XSTime.parse_time(value);
+        }
+        else if ("date".equals(xsdTypeName)) {
+           psychoPathType = XSDate.parse_date(value);
+        }
+        else if ("boolean".equals(xsdTypeName)) {
+           psychoPathType = new XSBoolean(Boolean.valueOf(value).booleanValue());
+        }
+        else if ("NOTATION".equals(xsdTypeName)) {
+           psychoPathType = new XSString(value);
+        }
+        else {
+           // create a XSString value, as fallback option 
+           psychoPathType = new XSString(value);
+        } 
+        
+        return psychoPathType;
+    }
+    
+    /*
      * Method to report error messages
      */
     private void reportError(String key, XSAssertImpl assertImpl,

Modified: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/XMLAssertPsychopathImpl.java
URL: http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/XMLAssertPsychopathImpl.java?rev=883954&amp;r1=883953&amp;r2=883954&amp;view=diff
==============================================================================
--- xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/XMLAssertPsychopathImpl.java
(original)
+++ xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/XMLAssertPsychopathImpl.java
Wed Nov 25 01:45:17 2009
@@ -21,6 +21,7 @@
 import java.util.Stack;
 import java.util.Vector;
 
+import org.apache.xerces.dom.CoreDocumentImpl;
 import org.apache.xerces.dom.PSVIAttrNSImpl;
 import org.apache.xerces.dom.PSVIDocumentImpl;
 import org.apache.xerces.dom.PSVIElementNSImpl;
@@ -37,7 +38,7 @@
 import org.apache.xerces.xs.XSTypeDefinition;
 import org.eclipse.wst.xml.xpath2.processor.DynamicContext;
 import org.eclipse.wst.xml.xpath2.processor.ast.XPath;
-import org.eclipse.wst.xml.xpath2.processor.internal.types.XSString;
+import org.eclipse.wst.xml.xpath2.processor.internal.types.AnyType;
 import org.w3c.dom.Document;
 import org.w3c.dom.Element;
 import org.w3c.dom.Node;
@@ -105,20 +106,9 @@
                                                       assertDocument,
                                                       assertParams);
         
-        // assign value to variable, "value" in XPath context
+        // create variable, $value in XPath dynamic context
         fDynamicContext.add_variable(new org.eclipse.wst.xml.xpath2.processor.internal.types.QName(
                                          "value"));
-        String value = "";
-        NodeList childList = currentAssertDomNode.getChildNodes();
-        if (childList.getLength() == 1) {
-            Node node = childList.item(0);
-            if (node.getNodeType() == Node.TEXT_NODE) {
-                value = node.getNodeValue();
-            }
-        }
-        fDynamicContext.set_variable(
-                new org.eclipse.wst.xml.xpath2.processor.internal.types.QName(
-                        "value"), new XSString(value));
     }
 
     /*
@@ -126,13 +116,12 @@
      * @see org.apache.xerces.xni.parser.XMLAssertAdapter#startElement(org.apache.xerces.xni.QName,
org.apache.xerces.xni.XMLAttributes, org.apache.xerces.xni.Augmentations)
      */
     public void startElement(QName element, XMLAttributes attributes,
-                                               Augmentations augs) {
+                                              Augmentations augs) {
         if (currentAssertDomNode == null) {
-           currentAssertDomNode = assertDocument.createElementNS(
-                                              element.uri, element.rawname);
+           currentAssertDomNode = new PSVIElementNSImpl((CoreDocumentImpl) assertDocument,
element.uri, element.rawname);
            assertDocument.appendChild(currentAssertDomNode);
         } else {
-            Element elem = assertDocument.createElementNS(element.uri, element.rawname);
+            Element elem = new PSVIElementNSImpl((CoreDocumentImpl) assertDocument, element.uri,
element.rawname);
             currentAssertDomNode.appendChild(elem);
             currentAssertDomNode = elem;
         }
@@ -143,20 +132,20 @@
             String attQName = attributes.getQName(attIndex);
             String attValue = attributes.getValue(attIndex);
             
-            PSVIAttrNSImpl attrNode = new PSVIAttrNSImpl((PSVIDocumentImpl)assertDocument,
attrUri, attQName);
+            PSVIAttrNSImpl attrNode = new PSVIAttrNSImpl((PSVIDocumentImpl) assertDocument,
attrUri, attQName);
             attrNode.setNodeValue(attValue);
             
             // set PSVI information for the attribute
             Augmentations attrAugs = attributes.getAugmentations(attIndex);
-            AttributePSVImpl attrPSVI = (AttributePSVImpl)attrAugs.getItem(Constants.ATTRIBUTE_PSVI);
+            AttributePSVImpl attrPSVI = (AttributePSVImpl) attrAugs.getItem(Constants.ATTRIBUTE_PSVI);
             attrNode.setPSVI(attrPSVI);
             
             currentAssertDomNode.setAttributeNode(attrNode);
         }
 
         Object assertion = augs.getItem("ASSERT");
-        // if we have assertion on this element, store the element reference
-        // and the assertions on it, on the stack objects
+        // if we have assertion applicable to this element, store the element
+        // reference and the assertions on it, on the runtime stacks
         if (assertion != null) {
             assertRootStack.push(currentAssertDomNode);
             assertListStack.push(assertion);
@@ -170,37 +159,19 @@
     public void endElement(QName element, Augmentations augs) throws Exception {
         if (currentAssertDomNode != null) {
             // set PSVI information on the element
-            ElementPSVI elemPSVI = (ElementPSVI)augs.getItem(Constants.ELEMENT_PSVI);
+            ElementPSVI elemPSVI = (ElementPSVI) augs.getItem(Constants.ELEMENT_PSVI);
             ((PSVIElementNSImpl)currentAssertDomNode).setPSVI(elemPSVI);
             
             if (!assertRootStack.empty() &amp;&amp; (currentAssertDomNode == assertRootStack.peek()))
{               
                  // get XSModel                
-                 fSchema =  ((PSVIElementNSImpl)currentAssertDomNode).getSchemaInformation();
+                 fSchema =  ((PSVIElementNSImpl) currentAssertDomNode).getSchemaInformation();
                  
                  // pop the stack, to go one level up
                  assertRootStack.pop();
                  // get assertions, and go one level up
                  Object assertions = assertListStack.pop(); 
-                
-                 // initialize the XPath engine
-                 initXPathProcessor();
                  
-                 // evaluate assertions
-                 if (assertions instanceof XSObjectList) {
-                    // assertions from a complex type definition
-                    XSObjectList assertList = (XSObjectList) assertions;
-                    for (int i = 0; i &lt; assertList.size(); i++) {
-                        XSAssertImpl assertImpl = (XSAssertImpl) assertList.get(i);
-                        evaluateAssertion(element, assertImpl);
-                    }
-                } else if (assertions instanceof Vector) {
-                    // assertions from a simple type definition
-                    Vector assertList = (Vector) assertions;                    
-                    for (int i = 0; i &lt; assertList.size(); i++) {
-                        XSAssertImpl assertImpl = (XSAssertImpl) assertList.get(i);
-                        evaluateAssertion(element, assertImpl);
-                    }
-                }
+                 processAllAssertionsOnElement(element, assertions);
             }
 
             if (currentAssertDomNode.getParentNode() instanceof Element) {
@@ -210,20 +181,63 @@
     }
 
     /*
+     * Method to evaluate all assertions for the element tree
+     */
+    private void processAllAssertionsOnElement(QName element, Object assertions)
+            throws Exception {
+         // initialize the XPath engine
+         initXPathProcessor();
+         
+         // determine value of variable, $value
+         String value = null;
+         NodeList childList = currentAssertDomNode.getChildNodes();
+         if (childList.getLength() == 1) {
+             Node node = childList.item(0);
+             if (node.getNodeType() == Node.TEXT_NODE) {
+                 value = node.getNodeValue();
+             }
+         }
+         
+         // evaluate assertions
+         if (assertions instanceof XSObjectList) {
+            // assertions from a complex type definition
+            if (value != null) {
+              // complex type with simple content
+              setValueOf$value(value);
+            } else {
+              // complex type with complex content                
+              // $value should be, the XPath2 "empty sequence" ... TO DO 
+            }
+            XSObjectList assertList = (XSObjectList) assertions;
+            for (int i = 0; i &lt; assertList.size(); i++) {
+               XSAssertImpl assertImpl = (XSAssertImpl) assertList.get(i);
+               evaluateAssertion(element, assertImpl);
+            }
+        } else if (assertions instanceof Vector) {
+            // assertions from a simple type definition
+            setValueOf$value(value);
+            Vector assertList = (Vector) assertions;                    
+            for (int i = 0; i &lt; assertList.size(); i++) {
+                XSAssertImpl assertImpl = (XSAssertImpl) assertList.get(i);
+                evaluateAssertion(element, assertImpl);
+            }
+        }
+    }
+
+    /*
      * (non-Javadoc)
      * @see org.apache.xerces.xni.parser.XMLAssertAdapter#characters(org.apache.xerces.xni.XMLString)
      */
     public void characters(XMLString text) {
         // add a child text node to the assertions, DOM tree
         if (currentAssertDomNode != null) {
-            currentAssertDomNode.appendChild(assertDocument
-                    .createTextNode(new String(text.ch, text.offset,
-                            text.length)));
+            currentAssertDomNode.appendChild(assertDocument.createTextNode(new 
+                                   String(text.ch, text.offset, text.length)));
         }
     }
 
     /*
-     * Method to evaluate an assertions, XPath expression
+     * Method to evaluate an assertion for the element
      */
     private void evaluateAssertion(QName element, XSAssertImpl assertImpl) {
         try {  
@@ -259,4 +273,26 @@
                                assertImpl.getTest().getXPath().toString(),
                                typeString } );
     }
+    
+    // assign value to the XPath2 "dynamic context" variable, $value
+    private void setValueOf$value(String value) {
+       PSVIElementNSImpl currentAssertPSVINode = (PSVIElementNSImpl) currentAssertDomNode;
+       
+       String typeName = "";
+       if (Constants.NS_XMLSCHEMA.equals(currentAssertPSVINode.getTypeNamespace())) {
+           typeName = currentAssertPSVINode.getTypeDefinition().getName();    
+       } else if (Constants.NS_XMLSCHEMA.equals(currentAssertPSVINode.
+                                         getTypeDefinition().
+                                         getBaseType().getNamespace())) {
+           typeName = currentAssertPSVINode.getTypeDefinition().getBaseType().
+                                         getName();
+       }
+       
+       Object psychoPathType = abstrPsychopathImpl.getPsychoPathTypeForXSDType
+                                                             (typeName, value);
+       
+       fDynamicContext.set_variable(
+               new org.eclipse.wst.xml.xpath2.processor.internal.types.QName(
+                       "value"), (AnyType) psychoPathType);
+    }
 }



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



</pre>
</div>
</content>
</entry>
<entry>
<title>svn commit: r883677 - /xerces/c/tags/Xerces-C_3_1_0_rc1/</title>
<author><name>borisk@apache.org</name></author>
<link rel="alternate" href="http://mail-archives.apache.org/mod_mbox/xerces-commits/200911.mbox/%3c20091124130254.5312C238888F@eris.apache.org%3e"/>
<id>urn:uuid:%3c20091124130254-5312C238888F@eris-apache-org%3e</id>
<updated>2009-11-24T13:02:54Z</updated>
<content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml">
<pre>
Author: borisk
Date: Tue Nov 24 13:02:53 2009
New Revision: 883677

URL: http://svn.apache.org/viewvc?rev=883677&amp;view=rev
Log:
Tagging Xerces-C++ 3.1.0.rc1

Added:
    xerces/c/tags/Xerces-C_3_1_0_rc1/
      - copied from r883676, xerces/c/trunk/


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



</pre>
</div>
</content>
</entry>
<entry>
<title>=?utf-8?q?=5BXerces_Wiki=5D_Update_of_=22XercescBuildStatus=22_by_Alberto?= =?utf-8?q?Massari?=</title>
<author><name>Apache Wiki &lt;wikidiffs@apache.org&gt;</name></author>
<link rel="alternate" href="http://mail-archives.apache.org/mod_mbox/xerces-commits/200911.mbox/%3c20091124121156.3083.56798@eos.apache.org%3e"/>
<id>urn:uuid:%3c20091124121156-3083-56798@eos-apache-org%3e</id>
<updated>2009-11-24T12:11:56Z</updated>
<content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml">
<pre>
Dear Wiki user,

You have subscribed to a wiki page or wiki category on "Xerces Wiki" for change notification.

The "XercescBuildStatus" page has been changed by AlbertoMassari.
http://wiki.apache.org/xerces/XercescBuildStatus?action=diff&amp;rev1=47&amp;rev2=48

--------------------------------------------------

  
  Platform-specific configurations that should be tested are listed in the Configuration cells.
  ||'''Platform''' ||'''Compiler''' ||'''SVN id''' ||'''Build Date''' ||'''Configuration'''
||'''Build''' ||'''Test''' ||'''Install''' ||'''Comments''' ||'''Builder''' ||
- ||Windows x86 ||VS 2003 ||883299||11/23/2009||32-bit ||Unknown ||Unknown ||Unknown ||tested
with ICU 3.8.1|| ||
+ ||Windows x86 ||VS 2003 ||883299 ||11/23/2009 ||32-bit ||Unknown ||Unknown ||Unknown ||tested
with ICU 3.8.1 || ||
- ||Windows x86 ||VS 2005 ||883299||11/23/2009||32-bit ||Unknown ||Unknown ||Unknown ||tested
with ICU 3.8.1|| ||
+ ||Windows x86 ||VS 2005 ||883299 ||11/23/2009 ||32-bit ||Unknown ||Unknown ||Unknown ||tested
with ICU 3.8.1 || ||
  ||Windows x86-64 ||VS 2005 || || ||64-bit ||Unknown ||Unknown ||Unknown || || ||
- ||Windows x86 ||VS 2008 ||883299||11/23/2009||32-bit ||Unknown ||Unknown ||Unknown ||tested
with ICU 3.8.1|| ||
+ ||Windows x86 ||VS 2008 ||883299 ||11/23/2009 ||32-bit ||Unknown ||Unknown ||Unknown ||tested
with ICU 3.8.1 || ||
  ||Windows x86-64 ||VS 2008 || || ||64-bit ||Unknown ||Unknown ||Unknown || || ||
  ||GNU/Linux x86 ||GCC 3.3.x || || ||32-bit ||Unknown ||Unknown ||Unknown || || ||
  ||GNU/Linux x86-64 ||GCC 3.3.x || || ||64-bit ||Unknown ||Unknown ||Unknown || || ||
@@ -51, +51 @@

  ||Mac OS X PowerPC ||GCC 4.0.x || || ||32-bit ||Unknown ||Unknown ||Unknown ||{{{./configure
CFLAGS='-arch ppc' CXXFLAGS='-arch ppc'}}} || ||
  ||Mac OS X PowerPC-64 ||GCC 4.0.x || || ||64-bit ||Unknown ||Unknown ||Unknown ||{{{./configure
CFLAGS='-arch ppc64' CXXFLAGS='-arch ppc64'}}} || ||
  ||Mac OS X x86/PowerPC 32/64 ||GCC 4.0.x || || ||32-bit &amp; 64-bit ||Unknown ||Unknown
||Unknown ||{{{./configure --disable-dependency-tracking CFLAGS='-arch i386 -arch x86_64 -arch
ppc -arch ppc64' CXXFLAGS='-arch i386 -arch x86_64 -arch ppc -arch ppc64'}}} || ||
- ||Mingw x86 ||GCC 3.4.x || || ||32-bit ||Unknown ||Unknown ||Unknown ||{{{./configure LDFLAGS=-no-undefined}}}
|| ||
+ ||Mingw x86 ||GCC 3.4.x ||RC1||11/24/2009||32-bit ||Unknown ||Unknown ||Unknown ||{{{./configure
LDFLAGS=-no-undefined}}} || ||
- ||Cygwin x86 ||GCC 3.4.x || || ||32-bit ||Unknown ||Unknown ||Unknown ||{{{./configure LDFLAGS=-no-undefined}}}
|| ||
+ ||Cygwin x86 ||GCC 3.4.x ||RC1||11/24/2009||32-bit ||Unknown ||Unknown ||Unknown ||{{{./configure
LDFLAGS=-no-undefined}}} || ||
  
  
  

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



</pre>
</div>
</content>
</entry>
<entry>
<title>svn commit: r883665 - in /xerces/c/trunk/src/xercesc: dom/DOMLSSerializer.hpp framework/psvi/XSParticle.hpp</title>
<author><name>borisk@apache.org</name></author>
<link rel="alternate" href="http://mail-archives.apache.org/mod_mbox/xerces-commits/200911.mbox/%3c20091124114154.48B7A23888DC@eris.apache.org%3e"/>
<id>urn:uuid:%3c20091124114154-48B7A23888DC@eris-apache-org%3e</id>
<updated>2009-11-24T11:41:45Z</updated>
<content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml">
<pre>
Author: borisk
Date: Tue Nov 24 11:41:38 2009
New Revision: 883665

URL: http://svn.apache.org/viewvc?rev=883665&amp;view=rev
Log:
Doxygen documentation fixes.

Modified:
    xerces/c/trunk/src/xercesc/dom/DOMLSSerializer.hpp
    xerces/c/trunk/src/xercesc/framework/psvi/XSParticle.hpp

Modified: xerces/c/trunk/src/xercesc/dom/DOMLSSerializer.hpp
URL: http://svn.apache.org/viewvc/xerces/c/trunk/src/xercesc/dom/DOMLSSerializer.hpp?rev=883665&amp;r1=883664&amp;r2=883665&amp;view=diff
==============================================================================
--- xerces/c/trunk/src/xercesc/dom/DOMLSSerializer.hpp (original)
+++ xerces/c/trunk/src/xercesc/dom/DOMLSSerializer.hpp Tue Nov 24 11:41:38 2009
@@ -403,10 +403,10 @@
      * the default to match the usual convention for text files in the
      * environment being used. Implementations must choose a default
      * sequence that matches one of those allowed by  2.11 "End-of-Line
-     * Handling". However, Xerces-C++ always uses LF ('\n') when this
+     * Handling". However, Xerces-C++ always uses LF when this
      * property is set to &lt;code&gt;null&lt;/code&gt; since otherwise automatic
-     * translation of '\n' to '\r\n' on Windows for text files would
-     * result in such files containing '\r\r\n'. If you need Windows-style
+     * translation of LF to CR-LF on Windows for text files would
+     * result in such files containing CR-CR-LF. If you need Windows-style
      * end of line sequences in your output, consider writing to a file
      * opened in text mode or explicitly set this property to CR-LF.&lt;/dd&gt;
      * &lt;dt&gt;CR&lt;/dt&gt;

Modified: xerces/c/trunk/src/xercesc/framework/psvi/XSParticle.hpp
URL: http://svn.apache.org/viewvc/xerces/c/trunk/src/xercesc/framework/psvi/XSParticle.hpp?rev=883665&amp;r1=883664&amp;r2=883665&amp;view=diff
==============================================================================
--- xerces/c/trunk/src/xercesc/framework/psvi/XSParticle.hpp (original)
+++ xerces/c/trunk/src/xercesc/framework/psvi/XSParticle.hpp Tue Nov 24 11:41:38 2009
@@ -75,6 +75,7 @@
       * @param  particleTerm
       * @param  minOccurs
       * @param  maxOccurs
+      * @param  unbounded
       * @param  manager     The configurable memory manager
       */
     XSParticle



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



</pre>
</div>
</content>
</entry>
<entry>
<title>svn commit: r883655 - /xerces/c/trunk/doc/Doxyfile</title>
<author><name>borisk@apache.org</name></author>
<link rel="alternate" href="http://mail-archives.apache.org/mod_mbox/xerces-commits/200911.mbox/%3c20091124112024.771AB23888D6@eris.apache.org%3e"/>
<id>urn:uuid:%3c20091124112024-771AB23888D6@eris-apache-org%3e</id>
<updated>2009-11-24T11:20:24Z</updated>
<content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml">
<pre>
Author: borisk
Date: Tue Nov 24 11:20:22 2009
New Revision: 883655

URL: http://svn.apache.org/viewvc?rev=883655&amp;view=rev
Log:
Update version information.

Modified:
    xerces/c/trunk/doc/Doxyfile

Modified: xerces/c/trunk/doc/Doxyfile
URL: http://svn.apache.org/viewvc/xerces/c/trunk/doc/Doxyfile?rev=883655&amp;r1=883654&amp;r2=883655&amp;view=diff
==============================================================================
--- xerces/c/trunk/doc/Doxyfile (original)
+++ xerces/c/trunk/doc/Doxyfile Tue Nov 24 11:20:22 2009
@@ -23,7 +23,7 @@
 # This could be handy for archiving the generated documentation or 
 # if some version control system is used.
 
-PROJECT_NUMBER         = 3.0.0
+PROJECT_NUMBER         = 3.1.0
 
 # The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) 
 # base path where the generated documentation will be put. 



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



</pre>
</div>
</content>
</entry>
<entry>
<title>svn commit: r883612 - in /xerces/c/trunk/src/xercesc/util: MsgLoaders/ICU/ICUMsgLoader.cpp Transcoders/ICU/ICUTransService.cpp</title>
<author><name>borisk@apache.org</name></author>
<link rel="alternate" href="http://mail-archives.apache.org/mod_mbox/xerces-commits/200911.mbox/%3c20091124072454.6B53223888D6@eris.apache.org%3e"/>
<id>urn:uuid:%3c20091124072454-6B53223888D6@eris-apache-org%3e</id>
<updated>2009-11-24T07:24:54Z</updated>
<content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml">
<pre>
Author: borisk
Date: Tue Nov 24 07:24:53 2009
New Revision: 883612

URL: http://svn.apache.org/viewvc?rev=883612&amp;view=rev
Log:
We don't need to call u_init in ICU 3.6 and later.

Modified:
    xerces/c/trunk/src/xercesc/util/MsgLoaders/ICU/ICUMsgLoader.cpp
    xerces/c/trunk/src/xercesc/util/Transcoders/ICU/ICUTransService.cpp

Modified: xerces/c/trunk/src/xercesc/util/MsgLoaders/ICU/ICUMsgLoader.cpp
URL: http://svn.apache.org/viewvc/xerces/c/trunk/src/xercesc/util/MsgLoaders/ICU/ICUMsgLoader.cpp?rev=883612&amp;r1=883611&amp;r2=883612&amp;view=diff
==============================================================================
--- xerces/c/trunk/src/xercesc/util/MsgLoaders/ICU/ICUMsgLoader.cpp (original)
+++ xerces/c/trunk/src/xercesc/util/MsgLoaders/ICU/ICUMsgLoader.cpp Tue Nov 24 07:24:53 2009
@@ -199,7 +199,6 @@
     {
         XMLPlatformUtils::panic(PanicHandler::Panic_CantLoadMsgDomain);
     }
-
 }
 
 ICUMsgLoader::~ICUMsgLoader()

Modified: xerces/c/trunk/src/xercesc/util/Transcoders/ICU/ICUTransService.cpp
URL: http://svn.apache.org/viewvc/xerces/c/trunk/src/xercesc/util/Transcoders/ICU/ICUTransService.cpp?rev=883612&amp;r1=883611&amp;r2=883612&amp;view=diff
==============================================================================
--- xerces/c/trunk/src/xercesc/util/Transcoders/ICU/ICUTransService.cpp (original)
+++ xerces/c/trunk/src/xercesc/util/Transcoders/ICU/ICUTransService.cpp Tue Nov 24 07:24:53
2009
@@ -5,9 +5,9 @@
  * 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.
@@ -138,12 +138,15 @@
 // ---------------------------------------------------------------------------
 ICUTransService::ICUTransService(MemoryManager* manager)
 {
-#if (U_ICU_VERSION_MAJOR_NUM &gt; 2 || (U_ICU_VERSION_MAJOR_NUM == 2 &amp;&amp; U_ICU_VERSION_MINOR_NUM
&gt;= 6))
+  // Starting with ICU 3.4 we don't need to call init anymore.
+  //
+#if (U_ICU_VERSION_MAJOR_NUM &gt; 2 || (U_ICU_VERSION_MAJOR_NUM == 2 &amp;&amp; U_ICU_VERSION_MINOR_NUM
&gt;= 6)) &amp;&amp; \
+  (U_ICU_VERSION_MAJOR_NUM &lt; 3 || (U_ICU_VERSION_MAJOR_NUM == 3 &amp;&amp; U_ICU_VERSION_MINOR_NUM
&lt; 4))
     UErrorCode errorCode=U_ZERO_ERROR;
     u_init(&amp;errorCode);
     if(U_FAILURE(errorCode)) {
         XMLPlatformUtils::panic(PanicHandler::Panic_NoTransService);
-    }    
+    }
 #endif
 
 #if !defined(XML_OS390) &amp;&amp; !defined(XML_AS400) &amp;&amp; !defined(XML_HPUX) &amp;&amp;
!defined(XML_PTX)
@@ -368,11 +371,11 @@
                     , const XMLSize_t               blockSize
                     ,       MemoryManager* const    manager)
 {
-    //  
-    //  For encodings that end with "s390" we need to strip off the "s390" 
-    //  from the encoding name and add ",swaplfnl" to the encoding name	
-    //  that we pass into ICU on the ucnv_openU.  
-    //  
+    //
+    //  For encodings that end with "s390" we need to strip off the "s390"
+    //  from the encoding name and add ",swaplfnl" to the encoding name
+    //  that we pass into ICU on the ucnv_openU.
+    //
     XMLCh* encodingNameToUse = (XMLCh*) encodingName;
     XMLCh* workBuffer = 0;
 



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



</pre>
</div>
</content>
</entry>
<entry>
<title>svn commit: r883581 - /xerces/java/trunk/src/org/apache/xerces/impl/xs/XMLSchemaValidator.java</title>
<author><name>mrglavas@apache.org</name></author>
<link rel="alternate" href="http://mail-archives.apache.org/mod_mbox/xerces-commits/200911.mbox/%3c20091124045510.394842388A2D@eris.apache.org%3e"/>
<id>urn:uuid:%3c20091124045510-394842388A2D@eris-apache-org%3e</id>
<updated>2009-11-24T04:55:09Z</updated>
<content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml">
<pre>
Author: mrglavas
Date: Tue Nov 24 04:55:09 2009
New Revision: 883581

URL: http://svn.apache.org/viewvc?rev=883581&amp;view=rev
Log:
JIRA Issue #1406: https://issues.apache.org/jira/browse/XERCESJ-1406. Eliminate redundant
and unnecessary calls to findSchemaGrammar(). If namespace growth has been enabled only attempt
to load more components if the triggering component was not already loaded.

Modified:
    xerces/java/trunk/src/org/apache/xerces/impl/xs/XMLSchemaValidator.java

Modified: xerces/java/trunk/src/org/apache/xerces/impl/xs/XMLSchemaValidator.java
URL: http://svn.apache.org/viewvc/xerces/java/trunk/src/org/apache/xerces/impl/xs/XMLSchemaValidator.java?rev=883581&amp;r1=883580&amp;r2=883581&amp;view=diff
==============================================================================
--- xerces/java/trunk/src/org/apache/xerces/impl/xs/XMLSchemaValidator.java (original)
+++ xerces/java/trunk/src/org/apache/xerces/impl/xs/XMLSchemaValidator.java Tue Nov 24 04:55:09
2009
@@ -1918,15 +1918,6 @@
             return augs;
         }
 
-        //try to find schema grammar by different means..
-        SchemaGrammar sGrammar =
-            findSchemaGrammar(
-                XSDDescription.CONTEXT_ELEMENT,
-                element.uri,
-                null,
-                element,
-                attributes);
-
         // if we are not skipping this element, and there is a content model,
         // we try to find the corresponding decl object for this element.
         // the reason we move this part of code here is to make sure the
@@ -2066,6 +2057,14 @@
             // case 1: find declaration for root element
             // case 2: find declaration for element from another namespace
             if (fCurrentElemDecl == null) {
+                // try to find schema grammar by different means..
+                SchemaGrammar sGrammar =
+                    findSchemaGrammar(
+                        XSDDescription.CONTEXT_ELEMENT,
+                        element.uri,
+                        null,
+                        element,
+                        attributes);
                 if (sGrammar != null) {
                     fCurrentElemDecl = sGrammar.getGlobalElementDecl(element.localpart);
                 }
@@ -2619,7 +2618,7 @@
         short contextType,
         String namespace,
         QName enclosingElement,
-        QName triggeringComponet,
+        QName triggeringComponent,
         XMLAttributes attributes) {
         SchemaGrammar grammar = null;
         //get the grammar from local pool...
@@ -2646,12 +2645,13 @@
             }
         }
 
-        if ((grammar == null &amp;&amp; !fUseGrammarPoolOnly) || fNamespaceGrowth) {
+        if ((grammar == null &amp;&amp; !fUseGrammarPoolOnly) || 
+            (fNamespaceGrowth &amp;&amp; !hasSchemaComponent(grammar, contextType, triggeringComponent)))
{
             fXSDDescription.reset();
             fXSDDescription.fContextType = contextType;
             fXSDDescription.setNamespace(namespace);
             fXSDDescription.fEnclosedElementName = enclosingElement;
-            fXSDDescription.fTriggeringComponent = triggeringComponet;
+            fXSDDescription.fTriggeringComponent = triggeringComponent;
             fXSDDescription.fAttributes = attributes;
             if (fLocator != null) {
                 fXSDDescription.setBaseSystemId(fLocator.getExpandedSystemId());
@@ -2709,6 +2709,23 @@
         return grammar;
 
     } //findSchemaGrammar
+    
+    private boolean hasSchemaComponent(SchemaGrammar grammar, short contextType, QName triggeringComponent)
{
+        if (grammar != null &amp;&amp; triggeringComponent != null) {
+            String localName = triggeringComponent.localpart;
+            if (localName != null &amp;&amp; localName.length() &gt; 0) {
+                switch (contextType) {
+                    case XSDDescription.CONTEXT_ELEMENT:
+                        return grammar.getElementDeclaration(localName) != null;
+                    case XSDDescription.CONTEXT_ATTRIBUTE:
+                        return grammar.getAttributeDeclaration(localName) != null;
+                    case XSDDescription.CONTEXT_XSITYPE:
+                        return grammar.getTypeDefinition(localName) != null;
+                }
+            }
+        }
+        return false;
+    }
 
     private void setLocationHints(XSDDescription desc, String[] locations, SchemaGrammar
grammar) {
         int length = locations.length;



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



</pre>
</div>
</content>
</entry>
<entry>
<title>svn propchange: r883496 - svn:log</title>
<author><name>knoaman@apache.org</name></author>
<link rel="alternate" href="http://mail-archives.apache.org/mod_mbox/xerces-commits/200911.mbox/%3c20091123205307.613CE23888D0@eris.apache.org%3e"/>
<id>urn:uuid:%3c20091123205307-613CE23888D0@eris-apache-org%3e</id>
<updated>2009-11-23T20:53:07Z</updated>
<content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml">
<pre>
Author: knoaman
Revision: 883496
Modified property: svn:log

Modified: svn:log at Mon Nov 23 20:53:07 2009
------------------------------------------------------------------------------
--- svn:log (original)
+++ svn:log Mon Nov 23 20:53:07 2009
@@ -1 +1 @@
-Use ArrayList of Vector - Keep 1.1 branch up to date with Xerces-J trunk
+Use ArrayList instead of Vector - Keep 1.1 branch up to date with Xerces-J trunk


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



</pre>
</div>
</content>
</entry>
<entry>
<title>svn commit: r883497 - /xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/util/SymbolHash.java</title>
<author><name>knoaman@apache.org</name></author>
<link rel="alternate" href="http://mail-archives.apache.org/mod_mbox/xerces-commits/200911.mbox/%3c20091123204954.61E5E23889D0@eris.apache.org%3e"/>
<id>urn:uuid:%3c20091123204954-61E5E23889D0@eris-apache-org%3e</id>
<updated>2009-11-23T20:49:54Z</updated>
<content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml">
<pre>
Author: knoaman
Date: Mon Nov 23 20:49:53 2009
New Revision: 883497

URL: http://svn.apache.org/viewvc?rev=883497&amp;view=rev
Log:
Return key/value pairs of all entries in the map - Keep 1.1 branch up to date with Xerces-J
trunk

Modified:
    xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/util/SymbolHash.java

Modified: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/util/SymbolHash.java
URL: http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/util/SymbolHash.java?rev=883497&amp;r1=883496&amp;r2=883497&amp;view=diff
==============================================================================
--- xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/util/SymbolHash.java (original)
+++ xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/util/SymbolHash.java Mon
Nov 23 20:49:53 2009
@@ -133,7 +133,22 @@
         }
         return fNum;
     }
-    
+
+    /**
+     * Return key/value pairs of all entries in the map
+     */
+    public Object[] getEntries() {
+        Object[] entries = new Object[fNum &lt;&lt; 1];
+        for (int i=0, j=0; i&lt;fTableSize &amp;&amp; j&lt;fNum &lt;&lt; 1; i++) {
+            for (Entry entry = fBuckets[i]; entry != null; entry = entry.next) {
+                entries[j] = entry.key;
+                entries[++j] = entry.value; 
+                j++;
+            }
+        }
+        return entries;
+    }
+
     /**
      * Make a clone of this object.
      */



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



</pre>
</div>
</content>
</entry>
<entry>
<title>svn commit: r883496 - /xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/validation/ValidationManager.java</title>
<author><name>knoaman@apache.org</name></author>
<link rel="alternate" href="http://mail-archives.apache.org/mod_mbox/xerces-commits/200911.mbox/%3c20091123204602.93A0F23889B5@eris.apache.org%3e"/>
<id>urn:uuid:%3c20091123204602-93A0F23889B5@eris-apache-org%3e</id>
<updated>2009-11-23T20:46:02Z</updated>
<content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml">
<pre>
Author: knoaman
Date: Mon Nov 23 20:46:00 2009
New Revision: 883496

URL: http://svn.apache.org/viewvc?rev=883496&amp;view=rev
Log:
Use ArrayList of Vector - Keep 1.1 branch up to date with Xerces-J trunk

Modified:
    xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/validation/ValidationManager.java

Modified: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/validation/ValidationManager.java
URL: http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/validation/ValidationManager.java?rev=883496&amp;r1=883495&amp;r2=883496&amp;view=diff
==============================================================================
--- xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/validation/ValidationManager.java
(original)
+++ xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/validation/ValidationManager.java
Mon Nov 23 20:46:00 2009
@@ -17,7 +17,7 @@
 
 package org.apache.xerces.impl.validation;
 
-import java.util.Vector;
+import java.util.ArrayList;
 
 /**
  * ValidationManager is a coordinator property for validators in the 
@@ -33,7 +33,7 @@
  */
 public class ValidationManager {
 
-    protected final Vector fVSs = new Vector();
+    protected final ArrayList fVSs = new ArrayList();
     protected boolean fGrammarFound = false;
 
     // used by the DTD validator to tell other components that it has a
@@ -46,7 +46,7 @@
      * the validation manager.
      */
     public final void addValidationState(ValidationState vs) {
-        fVSs.addElement(vs);
+        fVSs.add(vs);
     }
 
     /**
@@ -54,7 +54,7 @@
      */
     public final void setEntityState(EntityState state) {
         for (int i = fVSs.size()-1; i &gt;= 0; i--) {
-            ((ValidationState)fVSs.elementAt(i)).setEntityState(state);
+            ((ValidationState)fVSs.get(i)).setEntityState(state);
         }
     }
     
@@ -75,8 +75,8 @@
     } // isCachedDTD():  boolean
     
         
-    public final void reset (){
-        fVSs.removeAllElements();
+    public final void reset () {
+        fVSs.clear();
         fGrammarFound = false;
         fCachedDTD = false;
     }



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



</pre>
</div>
</content>
</entry>
<entry>
<title>svn commit: r883493 - in /xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces: util/ xpointer/</title>
<author><name>knoaman@apache.org</name></author>
<link rel="alternate" href="http://mail-archives.apache.org/mod_mbox/xerces-commits/200911.mbox/%3c20091123203929.D8BF223889D0@eris.apache.org%3e"/>
<id>urn:uuid:%3c20091123203929-D8BF223889D0@eris-apache-org%3e</id>
<updated>2009-11-23T20:39:24Z</updated>
<content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml">
<pre>
Author: knoaman
Date: Mon Nov 23 20:39:18 2009
New Revision: 883493

URL: http://svn.apache.org/viewvc?rev=883493&amp;view=rev
Log:
Make some classes final and use some different data structures - Keep 1.1 branch up to date
with Xerces-J trunk

Modified:
    xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/util/AugmentationsImpl.java
    xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/xpointer/ElementSchemePointer.java
    xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/xpointer/ShortHandPointer.java
    xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/xpointer/XPointerErrorHandler.java
    xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/xpointer/XPointerHandler.java
    xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/xpointer/XPointerMessageFormatter.java

Modified: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/util/AugmentationsImpl.java
URL: http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/util/AugmentationsImpl.java?rev=883493&amp;r1=883492&amp;r2=883493&amp;view=diff
==============================================================================
--- xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/util/AugmentationsImpl.java
(original)
+++ xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/util/AugmentationsImpl.java
Mon Nov 23 20:39:18 2009
@@ -17,8 +17,11 @@
 
 package org.apache.xerces.util;
 
+import java.util.Collections;
 import java.util.Enumeration;
-import java.util.Hashtable;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
 
 import org.apache.xerces.xni.Augmentations;
 
@@ -57,7 +60,6 @@
         return oldValue;
     }
 
-
     /**
      * Get information identified by a key from the Augmentations structure
      * 
@@ -70,7 +72,6 @@
         return fAugmentationsContainer.getItem(key);
     }
     
-    
     /**
      * Remove additional info from the Augmentations structure
      * 
@@ -99,7 +100,7 @@
         return fAugmentationsContainer.toString();
     }
 
-    abstract class AugmentationsItemsContainer {
+    static abstract class AugmentationsItemsContainer {
         abstract public Object putItem(Object key, Object item);
         abstract public Object getItem(Object key);
         abstract public Object removeItem(Object key);
@@ -109,7 +110,8 @@
         abstract public AugmentationsItemsContainer expand();
     }
 
-    class SmallContainer extends AugmentationsItemsContainer {
+    final static class SmallContainer extends AugmentationsItemsContainer {
+        
         final static int SIZE_LIMIT = 10;
         final Object[] fAugmentations = new Object[SIZE_LIMIT*2];
         int fNumEntries = 0;
@@ -209,7 +211,8 @@
             return buff.toString();
         }
 
-        class SmallContainerKeyEnumeration implements Enumeration {
+        final class SmallContainerKeyEnumeration implements Enumeration {
+            
             Object [] enumArray = new Object[fNumEntries];
             int next = 0;
 
@@ -237,8 +240,9 @@
         }
     }
 
-    class LargeContainer extends AugmentationsItemsContainer {
-        final Hashtable fAugmentations = new Hashtable();
+    final static class LargeContainer extends AugmentationsItemsContainer {
+        
+        private final HashMap fAugmentations = new HashMap();
 
         public Object getItem(Object key) {
             return fAugmentations.get(key);
@@ -253,7 +257,7 @@
         }
 
         public Enumeration keys() {
-            return fAugmentations.keys();
+            return Collections.enumeration(fAugmentations.keySet());
         }
 
         public void clear() {
@@ -271,16 +275,14 @@
         public String toString() {
             StringBuffer buff = new StringBuffer();
             buff.append("LargeContainer");
-            Enumeration keys = fAugmentations.keys();
-
-            while (keys.hasMoreElements()) {
-                Object key = keys.nextElement();
+            Iterator entries = fAugmentations.entrySet().iterator();
+            while (entries.hasNext()) {
+                Map.Entry entry = (Map.Entry) entries.next();
                 buff.append("\nkey == ");
-                buff.append(key);
+                buff.append(entry.getKey());
                 buff.append("; value == ");
-                buff.append(fAugmentations.get(key));
+                buff.append(entry.getValue());
             }
-
             return buff.toString();
         }
     }

Modified: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/xpointer/ElementSchemePointer.java
URL: http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/xpointer/ElementSchemePointer.java?rev=883493&amp;r1=883492&amp;r2=883493&amp;view=diff
==============================================================================
--- xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/xpointer/ElementSchemePointer.java
(original)
+++ xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/xpointer/ElementSchemePointer.java
Mon Nov 23 20:39:18 2009
@@ -14,9 +14,10 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
+
 package org.apache.xerces.xpointer;
 
-import java.util.Hashtable;
+import java.util.HashMap;
 
 import org.apache.xerces.impl.XMLErrorReporter;
 import org.apache.xerces.util.SymbolTable;
@@ -35,9 +36,8 @@
  * @xerces.internal
  * 
  * @version $Id$
- *
  */
-class ElementSchemePointer implements XPointerPart {
+final class ElementSchemePointer implements XPointerPart {
 
     // Fields
 
@@ -524,7 +524,7 @@
 
         private SymbolTable fSymbolTable;
 
-        private Hashtable fTokenNames = new Hashtable();
+        private HashMap fTokenNames = new HashMap();
 
         /**
          * Constructor 

Modified: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/xpointer/ShortHandPointer.java
URL: http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/xpointer/ShortHandPointer.java?rev=883493&amp;r1=883492&amp;r2=883493&amp;view=diff
==============================================================================
--- xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/xpointer/ShortHandPointer.java
(original)
+++ xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/xpointer/ShortHandPointer.java
Mon Nov 23 20:39:18 2009
@@ -14,6 +14,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
+
 package org.apache.xerces.xpointer;
 
 import org.apache.xerces.impl.Constants;
@@ -35,9 +36,8 @@
  * &lt;/p&gt;
  *
  * @version $Id$
- *
  */
-class ShortHandPointer implements XPointerPart {
+final class ShortHandPointer implements XPointerPart {
     
     // The name of the ShortHand pointer
     private String fShortHandPointer;

Modified: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/xpointer/XPointerErrorHandler.java
URL: http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/xpointer/XPointerErrorHandler.java?rev=883493&amp;r1=883492&amp;r2=883493&amp;view=diff
==============================================================================
--- xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/xpointer/XPointerErrorHandler.java
(original)
+++ xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/xpointer/XPointerErrorHandler.java
Mon Nov 23 20:39:18 2009
@@ -14,6 +14,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
+
 package org.apache.xerces.xpointer;
 
 import java.io.PrintWriter;
@@ -29,7 +30,7 @@
  *
  * @version $Id$
  */
-class XPointerErrorHandler implements XMLErrorHandler {
+final class XPointerErrorHandler implements XMLErrorHandler {
 
     //
     // Data

Modified: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/xpointer/XPointerHandler.java
URL: http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/xpointer/XPointerHandler.java?rev=883493&amp;r1=883492&amp;r2=883493&amp;view=diff
==============================================================================
--- xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/xpointer/XPointerHandler.java
(original)
+++ xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/xpointer/XPointerHandler.java
Mon Nov 23 20:39:18 2009
@@ -14,10 +14,11 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
+
 package org.apache.xerces.xpointer;
 
-import java.util.Hashtable;
-import java.util.Vector;
+import java.util.ArrayList;
+import java.util.HashMap;
 
 import org.apache.xerces.impl.Constants;
 import org.apache.xerces.impl.XMLErrorReporter;
@@ -63,8 +64,8 @@
         XPointerProcessor {
 
     // Fields
-    // A Vector of XPointerParts  
-    protected Vector fXPointerParts = null;
+    // An ArrayList of XPointerParts  
+    protected ArrayList fXPointerParts = null;
 
     // The current XPointerPart  
     protected XPointerPart fXPointerPart = null;
@@ -101,7 +102,7 @@
     public XPointerHandler() {
         super();
 
-        fXPointerParts = new Vector();
+        fXPointerParts = new ArrayList();
         fSymbolTable = new SymbolTable();
     }
 
@@ -109,7 +110,7 @@
             XMLErrorHandler errorHandler, XMLErrorReporter errorReporter) {
         super();
 
-        fXPointerParts = new Vector();
+        fXPointerParts = new ArrayList();
         fSymbolTable = symbolTable;
         fErrorHandler = errorHandler;
         fXPointerErrorReporter = errorReporter;
@@ -433,11 +434,11 @@
     }
 
     /**
-     * Returns a Vector of XPointerPart objects
+     * Returns an ArrayList of XPointerPart objects
      * 
-     * @return A Vector of XPointerPart objects.
+     * @return An ArrayList of XPointerPart objects.
      */
-    public Vector getPointerParts() {
+    public ArrayList getPointerParts() {
         return fXPointerParts;
     }
 
@@ -483,7 +484,7 @@
 
         private SymbolTable fSymbolTable;
 
-        private Hashtable fTokenNames = new Hashtable();
+        private HashMap fTokenNames = new HashMap();
 
         /**
          * Constructor 

Modified: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/xpointer/XPointerMessageFormatter.java
URL: http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/xpointer/XPointerMessageFormatter.java?rev=883493&amp;r1=883492&amp;r2=883493&amp;view=diff
==============================================================================
--- xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/xpointer/XPointerMessageFormatter.java
(original)
+++ xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/xpointer/XPointerMessageFormatter.java
Mon Nov 23 20:39:18 2009
@@ -14,6 +14,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
+
 package org.apache.xerces.xpointer;
 
 import java.util.Locale;
@@ -30,7 +31,7 @@
  * 
  * @version $Id$
  */
-class XPointerMessageFormatter implements MessageFormatter {
+final class XPointerMessageFormatter implements MessageFormatter {
 
     public static final String XPOINTER_DOMAIN = "http://www.w3.org/TR/XPTR";
 



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



</pre>
</div>
</content>
</entry>
<entry>
<title>svn commit: r883491 - in /xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dtd: DTDGrammar.java XMLDTDDescription.java XMLDTDProcessor.java</title>
<author><name>knoaman@apache.org</name></author>
<link rel="alternate" href="http://mail-archives.apache.org/mod_mbox/xerces-commits/200911.mbox/%3c20091123203216.8511F23888C5@eris.apache.org%3e"/>
<id>urn:uuid:%3c20091123203216-8511F23888C5@eris-apache-org%3e</id>
<updated>2009-11-23T20:32:15Z</updated>
<content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml">
<pre>
Author: knoaman
Date: Mon Nov 23 20:32:14 2009
New Revision: 883491

URL: http://svn.apache.org/viewvc?rev=883491&amp;view=rev
Log:
Use ArrayList and HashMap instead of Vector and HashTable - Keep 1.1 branch up to date with
Xerces-J trunk

Modified:
    xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dtd/DTDGrammar.java
    xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dtd/XMLDTDDescription.java
    xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dtd/XMLDTDProcessor.java

Modified: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dtd/DTDGrammar.java
URL: http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dtd/DTDGrammar.java?rev=883491&amp;r1=883490&amp;r2=883491&amp;view=diff
==============================================================================
--- xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dtd/DTDGrammar.java
(original)
+++ xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dtd/DTDGrammar.java
Mon Nov 23 20:32:14 2009
@@ -17,8 +17,8 @@
 
 package org.apache.xerces.impl.dtd;
 
+import java.util.ArrayList;
 import java.util.Hashtable;
-import java.util.Vector;
 
 import org.apache.xerces.impl.dtd.models.CMAny;
 import org.apache.xerces.impl.dtd.models.CMBinOp;
@@ -790,16 +790,17 @@
     public void endDTD(Augmentations augs) throws XNIException {
         fIsImmutable = true;
         // make sure our description contains useful stuff...
-        if(fGrammarDescription.getRootName() == null) {
+        if (fGrammarDescription.getRootName() == null) {
             // we don't know what the root is; so use possibleRoots...
             int chunk, index = 0;
             String currName = null;
-            Vector elements = new Vector();
-            for (int i=0; i &lt; fElementDeclCount; i++) {
+            final int size = fElementDeclCount;
+            ArrayList elements = new ArrayList(size);
+            for (int i = 0; i &lt; size; ++i) {
                 chunk = i &gt;&gt; CHUNK_SHIFT;
                 index = i &amp; CHUNK_MASK;
                 currName = fElementDeclName[chunk][index].rawname;
-                elements.addElement(currName);
+                elements.add(currName);
             }
             fGrammarDescription.setPossibleRoots(elements);
         }

Modified: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dtd/XMLDTDDescription.java
URL: http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dtd/XMLDTDDescription.java?rev=883491&amp;r1=883490&amp;r2=883491&amp;view=diff
==============================================================================
--- xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dtd/XMLDTDDescription.java
(original)
+++ xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dtd/XMLDTDDescription.java
Mon Nov 23 20:32:14 2009
@@ -17,6 +17,7 @@
 
 package org.apache.xerces.impl.dtd;
 
+import java.util.ArrayList;
 import java.util.Vector;
 
 import org.apache.xerces.util.XMLResourceIdentifierImpl;
@@ -43,7 +44,7 @@
 
     // if we don't know the root name, this stores all elements that
     // could serve; fPossibleRoots and fRootName cannot both be non-null
-    protected Vector fPossibleRoots = null;
+    protected ArrayList fPossibleRoots = null;
 
     // Constructors:
     public XMLDTDDescription(XMLResourceIdentifier id, String rootName) {
@@ -85,11 +86,16 @@
         fRootName = rootName;
         fPossibleRoots = null;
     }
+    
+    /** Set possible roots **/
+    public void setPossibleRoots(ArrayList possibleRoots) {
+        fPossibleRoots = possibleRoots;
+    }
 
     /** Set possible roots **/
     public void setPossibleRoots(Vector possibleRoots) {
-        fPossibleRoots = possibleRoots;
-    } 
+        fPossibleRoots = (possibleRoots != null) ? new ArrayList(possibleRoots) : null;
+    }
 
     /**
      * Compares this grammar with the given grammar. Currently, we compare 
@@ -105,49 +111,58 @@
      * @return     True if they are equal, else false
      */
     public boolean equals(Object desc) {
-        if(!(desc instanceof XMLGrammarDescription)) return false;
+        if (!(desc instanceof XMLGrammarDescription)) return false;
     	if (!getGrammarType().equals(((XMLGrammarDescription)desc).getGrammarType())) {
     	    return false;
     	}
         // assume it's a DTDDescription
         XMLDTDDescription dtdDesc = (XMLDTDDescription)desc;
-        if(fRootName != null) {
-            if((dtdDesc.fRootName) != null &amp;&amp; !dtdDesc.fRootName.equals(fRootName))
{
+        if (fRootName != null) {
+            if ((dtdDesc.fRootName) != null &amp;&amp; !dtdDesc.fRootName.equals(fRootName))
{
                 return false;
-            } else if(dtdDesc.fPossibleRoots != null &amp;&amp; !dtdDesc.fPossibleRoots.contains(fRootName))
{
+            } 
+            else if (dtdDesc.fPossibleRoots != null &amp;&amp; !dtdDesc.fPossibleRoots.contains(fRootName))
{
                 return false;
             }
-        } else if(fPossibleRoots != null) {
-            if(dtdDesc.fRootName != null) {
-                if(!fPossibleRoots.contains(dtdDesc.fRootName)) { 
+        } 
+        else if (fPossibleRoots != null) {
+            if (dtdDesc.fRootName != null) {
+                if (!fPossibleRoots.contains(dtdDesc.fRootName)) { 
                     return false;
                 }
-            } else if(dtdDesc.fPossibleRoots == null) {
+            } 
+            else if (dtdDesc.fPossibleRoots == null) {
                 return false;
-            } else {
+            } 
+            else {
                 boolean found = false;
-                for(int i = 0; i&lt;fPossibleRoots.size(); i++) {
-                    String root = (String)fPossibleRoots.elementAt(i);
+                final int size = fPossibleRoots.size();
+                for (int i = 0; i &lt; size; ++i) {
+                    String root = (String) fPossibleRoots.get(i);
                     found = dtdDesc.fPossibleRoots.contains(root);
-                    if(found) break;
+                    if (found) break;
                 }
-                if(!found) return false;
+                if (!found) return false;
             }
         }
         // if we got this far we've got a root match... try other two fields,
         // since so many different DTD's have roots in common:
-        if(fExpandedSystemId != null) {
-            if(!fExpandedSystemId.equals(dtdDesc.fExpandedSystemId)) 
+        if (fExpandedSystemId != null) {
+            if (!fExpandedSystemId.equals(dtdDesc.fExpandedSystemId)) {
                 return false;
+            }
         } 
-        else if(dtdDesc.fExpandedSystemId != null)
+        else if (dtdDesc.fExpandedSystemId != null) {
             return false;
-        if(fPublicId != null) {
-            if(!fPublicId.equals(dtdDesc.fPublicId)) 
+        }
+        if (fPublicId != null) {
+            if (!fPublicId.equals(dtdDesc.fPublicId)) {
                 return false;
+            }
         } 
-        else if(dtdDesc.fPublicId != null)
+        else if (dtdDesc.fPublicId != null) {
             return false;
+        }
     	return true;
     }
     
@@ -158,10 +173,12 @@
      * @return The hash code
      */
     public int hashCode() {
-        if(fExpandedSystemId != null)
+        if (fExpandedSystemId != null) {
             return fExpandedSystemId.hashCode();
-        if(fPublicId != null)
+        }
+        if (fPublicId != null) {
             return fPublicId.hashCode();
+        }
         // give up; hope .equals can handle it:
         return 0;
     }

Modified: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dtd/XMLDTDProcessor.java
URL: http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dtd/XMLDTDProcessor.java?rev=883491&amp;r1=883490&amp;r2=883491&amp;view=diff
==============================================================================
--- xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dtd/XMLDTDProcessor.java
(original)
+++ xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dtd/XMLDTDProcessor.java
Mon Nov 23 20:32:14 2009
@@ -17,11 +17,12 @@
 
 package org.apache.xerces.impl.dtd;
 
-import java.util.Enumeration;
-import java.util.Hashtable;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
 import java.util.Locale;
+import java.util.Map;
 import java.util.StringTokenizer;
-import java.util.Vector;
 
 import org.apache.xerces.impl.Constants;
 import org.apache.xerces.impl.XMLErrorReporter;
@@ -235,28 +236,28 @@
     private final XMLEntityDecl fEntityDecl = new XMLEntityDecl();
 
     /** Notation declaration hash. */
-    private final Hashtable fNDataDeclNotations = new Hashtable();
+    private final HashMap fNDataDeclNotations = new HashMap();
 
     /** DTD element declaration name. */
     private String fDTDElementDeclName = null;
 
     /** Mixed element type "hash". */
-    private final Vector fMixedElementTypes = new Vector();
+    private final ArrayList fMixedElementTypes = new ArrayList();
 
     /** Element declarations in DTD. */
-    private final Vector fDTDElementDecls = new Vector();
+    private final ArrayList fDTDElementDecls = new ArrayList();
 
     // to check for duplicate ID or ANNOTATION attribute declare in
     // ATTLIST, and misc VCs
 
     /** ID attribute names. */
-    private Hashtable fTableOfIDAttributeNames;
+    private HashMap fTableOfIDAttributeNames;
 
     /** NOTATION attribute names. */
-    private Hashtable fTableOfNOTATIONAttributeNames;
+    private HashMap fTableOfNOTATIONAttributeNames;
 
     /** NOTATION enumeration values. */
-    private Hashtable fNotationEnumVals;
+    private HashMap fNotationEnumVals;
 
     //
     // Constructors
@@ -374,12 +375,12 @@
         if (fValidation) {
 
             if (fNotationEnumVals == null) {
-                fNotationEnumVals = new Hashtable();
+                fNotationEnumVals = new HashMap();
             }
             fNotationEnumVals.clear();
 
-            fTableOfIDAttributeNames = new Hashtable();
-            fTableOfNOTATIONAttributeNames = new Hashtable();
+            fTableOfIDAttributeNames = new HashMap();
+            fTableOfNOTATIONAttributeNames = new HashMap();
         }
 
     }
@@ -652,7 +653,7 @@
 
         // initialize state
         fNDataDeclNotations.clear();
-        fDTDElementDecls.removeAllElements();
+        fDTDElementDecls.clear();
 
         // the grammar bucket's DTDGrammar will now be the
         // one we want, whether we're constructing it or not.
@@ -788,7 +789,7 @@
                                            XMLErrorReporter.SEVERITY_ERROR);
             }
             else {
-                fDTDElementDecls.addElement(name);
+                fDTDElementDecls.add(name);
             }
         }
 
@@ -938,7 +939,7 @@
                         //we should not report an error, when there is duplicate attribute
definition for given element type
                         //according to XML 1.0 spec, When more than one definition is provided
for the same attribute of a given
                         //element type, the first declaration is binding and later declaration
are *ignored*. So processor should 
-                        //ignore the second declarations, however an application would be
warned of the duplicate attribute defintion 
+                        //ignore the second declarations, however an application would be
warned of the duplicate attribute definition 
                         // if http://apache.org/xml/features/validation/warn-on-duplicate-attdef
feature is set to true, Application behavior may differ on the basis of error or 
                         //warning thrown. - nb.
 
@@ -1298,11 +1299,12 @@
             DTDGrammar grammar = (fDTDGrammar != null? fDTDGrammar: fGrammarBucket.getActiveGrammar());
 
             // VC : Notation Declared. for external entity declaration [Production 76].
-            Enumeration entities = fNDataDeclNotations.keys();
-            while (entities.hasMoreElements()) {
-                String entity = (String) entities.nextElement();
-                String notation = (String) fNDataDeclNotations.get(entity);
+            Iterator entities = fNDataDeclNotations.entrySet().iterator();
+            while (entities.hasNext()) {
+                Map.Entry entry = (Map.Entry) entities.next();
+                String notation = (String) entry.getValue();
                 if (grammar.getNotationDeclIndex(notation) == -1) {
+                    String entity = (String) entry.getKey();
                     fErrorReporter.reportError(XMLMessageFormatter.XML_DOMAIN,
                                                "MSG_NOTATION_NOT_DECLARED_FOR_UNPARSED_ENTITYDECL",
                                                new Object[]{entity, notation},
@@ -1312,11 +1314,12 @@
 
             // VC: Notation Attributes:
             //     all notation names in the (attribute) declaration must be declared.
-            Enumeration notationVals = fNotationEnumVals.keys();
-            while (notationVals.hasMoreElements()) {
-                String notation = (String) notationVals.nextElement();
-                String attributeName = (String) fNotationEnumVals.get(notation);
+            Iterator notationVals = fNotationEnumVals.entrySet().iterator();
+            while (notationVals.hasNext()) {
+                Map.Entry entry = (Map.Entry) notationVals.next();
+                String notation = (String) entry.getKey();
                 if (grammar.getNotationDeclIndex(notation) == -1) {
+                    String attributeName = (String) entry.getValue();
                     fErrorReporter.reportError(XMLMessageFormatter.XML_DOMAIN,
                                                "MSG_NOTATION_NOT_DECLARED_FOR_NOTATIONTYPE_ATTRIBUTE",
                                                new Object[]{attributeName, notation},
@@ -1326,12 +1329,13 @@
             
             // VC: No Notation on Empty Element
             // An attribute of type NOTATION must not be declared on an element declared
EMPTY.
-            Enumeration elementsWithNotations = fTableOfNOTATIONAttributeNames.keys();
-            while (elementsWithNotations.hasMoreElements()) {
-                String elementName = (String) elementsWithNotations.nextElement();
+            Iterator elementsWithNotations = fTableOfNOTATIONAttributeNames.entrySet().iterator();
+            while (elementsWithNotations.hasNext()) {
+                Map.Entry entry = (Map.Entry) elementsWithNotations.next();
+                String elementName = (String) entry.getKey();
                 int elementIndex = grammar.getElementDeclIndex(elementName);
                 if (grammar.getContentSpecType(elementIndex) == XMLElementDecl.TYPE_EMPTY)
{
-                    String attributeName = (String) fTableOfNOTATIONAttributeNames.get(elementName);
+                    String attributeName = (String) entry.getValue();
                     fErrorReporter.reportError(XMLMessageFormatter.XML_DOMAIN,
                                                "NoNotationOnEmptyElement",
                                                new Object[]{elementName, attributeName},
@@ -1397,7 +1401,7 @@
 
         if (fValidation) {
             fDTDElementDeclName = elementName;
-            fMixedElementTypes.removeAllElements();
+            fMixedElementTypes.clear();
         }
 
         // call handlers
@@ -1514,7 +1518,7 @@
                                            XMLErrorReporter.SEVERITY_ERROR);
             }
             else {
-                fMixedElementTypes.addElement(elementName);
+                fMixedElementTypes.add(elementName);
             }
         }
 



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



</pre>
</div>
</content>
</entry>
<entry>
<title>svn commit: r883487 - /xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/dom/</title>
<author><name>knoaman@apache.org</name></author>
<link rel="alternate" href="http://mail-archives.apache.org/mod_mbox/xerces-commits/200911.mbox/%3c20091123202900.9C90323888D0@eris.apache.org%3e"/>
<id>urn:uuid:%3c20091123202900-9C90323888D0@eris-apache-org%3e</id>
<updated>2009-11-23T20:28:30Z</updated>
<content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml">
<pre>
Author: knoaman
Date: Mon Nov 23 20:28:10 2009
New Revision: 883487

URL: http://svn.apache.org/viewvc?rev=883487&amp;view=rev
Log:
Various DOM changes - Keep 1.1 branch up to date with Xerces-J trunk

Modified:
    xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/dom/AttributeMap.java
    xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/dom/DOMImplementationListImpl.java
    xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/dom/DOMImplementationSourceImpl.java
    xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/dom/DOMNormalizer.java
    xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/dom/DOMXSImplementationSourceImpl.java
    xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/dom/DeepNodeListImpl.java
    xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/dom/DeferredDocumentImpl.java
    xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/dom/NamedNodeMapImpl.java

Modified: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/dom/AttributeMap.java
URL: http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/dom/AttributeMap.java?rev=883487&amp;r1=883486&amp;r2=883487&amp;view=diff
==============================================================================
--- xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/dom/AttributeMap.java (original)
+++ xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/dom/AttributeMap.java Mon
Nov 23 20:28:10 2009
@@ -17,7 +17,8 @@
 
 package org.apache.xerces.dom;
 
-import java.util.Vector;
+import java.util.ArrayList;
+import java.util.List;
 
 import org.w3c.dom.DOMException;
 import org.w3c.dom.Node;
@@ -105,8 +106,8 @@
         int i = findNamePoint(argn.getNodeName(),0);
         AttrImpl previous = null;
         if (i &gt;= 0) {
-            previous = (AttrImpl) nodes.elementAt(i);
-            nodes.setElementAt(arg,i);
+            previous = (AttrImpl) nodes.get(i);
+            nodes.set(i, arg);
             previous.ownerNode = ownerNode.ownerDocument();
             previous.isOwned(false);
             // make sure it won't be mistaken with defaults in case it's reused
@@ -114,9 +115,9 @@
         } else {
             i = -1 - i; // Insert point (may be end of list)
             if (null == nodes) {
-                nodes = new Vector(5, 10);
+                nodes = new ArrayList(5);
             }
-            nodes.insertElementAt(arg, i);
+            nodes.add(i, arg);
         }
         
         // notify document
@@ -174,8 +175,8 @@
         int i = findNamePoint(argn.getNamespaceURI(), argn.getLocalName());
         AttrImpl previous = null;
         if (i &gt;= 0) {
-            previous = (AttrImpl) nodes.elementAt(i);
-            nodes.setElementAt(arg,i);
+            previous = (AttrImpl) nodes.get(i);
+            nodes.set(i, arg);
             previous.ownerNode = ownerNode.ownerDocument();
             previous.isOwned(false);
             // make sure it won't be mistaken with defaults in case it's reused
@@ -185,14 +186,14 @@
             // nodeName so we know where to insert.
             i = findNamePoint(arg.getNodeName(),0);
             if (i &gt;=0) {
-                previous = (AttrImpl) nodes.elementAt(i);
-                nodes.insertElementAt(arg,i);
+                previous = (AttrImpl) nodes.get(i);
+                nodes.add(i, arg);
             } else {
                 i = -1 - i; // Insert point (may be end of list)
                 if (null == nodes) {
-                    nodes = new Vector(5, 10);
+                    nodes = new ArrayList(5);
                 }
-                nodes.insertElementAt(arg, i);
+                nodes.add(i, arg);
             }
         }
         //    	changed(true);
@@ -253,8 +254,9 @@
 
         int index = -1;
         if (nodes != null) {
-            for (int i = 0; i &lt; nodes.size(); i++) {
-                if (nodes.elementAt(i) == item) {
+            final int size = nodes.size();
+            for (int i = 0; i &lt; size; ++i) {
+                if (nodes.get(i) == item) {
                     index = i;
                     break;
                 }
@@ -287,7 +289,7 @@
             }
         }
 
-        return remove((AttrImpl)nodes.elementAt(i), i, true);
+        return remove((AttrImpl)nodes.get(i), i, true);
 
     } // internalRemoveNamedItem(String,boolean):Node
 
@@ -321,16 +323,16 @@
                     clone.isOwned(true);
                     clone.isSpecified(false);
                 
-                    nodes.setElementAt(clone, index);
+                    nodes.set(index, clone);
                     if (attr.isIdAttribute()) {
                         ownerDocument.putIdentifier(clone.getNodeValue(),
                                                 (ElementImpl)ownerNode);
                     }
             } else {
-                nodes.removeElementAt(index);
+                nodes.remove(index);
             }
         } else {
-            nodes.removeElementAt(index);
+            nodes.remove(index);
         }
 
         //        changed(true);
@@ -403,7 +405,7 @@
             }
         }
         
-        AttrImpl n = (AttrImpl)nodes.elementAt(i);
+        AttrImpl n = (AttrImpl)nodes.get(i);
         
         if (n.isIdAttribute()) {
             ownerDocument.removeIdentifier(n.getValue());
@@ -429,19 +431,19 @@
                     }
                     clone.isOwned(true);
                     clone.isSpecified(false);
-                    nodes.setElementAt(clone, i);
+                    nodes.set(i, clone);
                     if (clone.isIdAttribute()) {
                         ownerDocument.putIdentifier(clone.getNodeValue(), 
                                 (ElementImpl)ownerNode);
                     }
                 } else {
-                    nodes.removeElementAt(i);
+                    nodes.remove(i);
                 }
             } else {
-                nodes.removeElementAt(i);
+                nodes.remove(i);
             }
         } else {
-            nodes.removeElementAt(i);
+            nodes.remove(i);
         }
         
         //        changed(true);
@@ -483,19 +485,21 @@
      * Override parent's method to set the ownerNode correctly
      */
     protected void cloneContent(NamedNodeMapImpl srcmap) {
-        Vector srcnodes = srcmap.nodes;
+        List srcnodes = srcmap.nodes;
         if (srcnodes != null) {
             int size = srcnodes.size();
             if (size != 0) {
                 if (nodes == null) {
-                    nodes = new Vector(size);
+                    nodes = new ArrayList(size);
+                }
+                else {
+                    nodes.clear();
                 }
-                nodes.setSize(size);
                 for (int i = 0; i &lt; size; ++i) {
-                    NodeImpl n = (NodeImpl) srcnodes.elementAt(i);
+                    NodeImpl n = (NodeImpl) srcnodes.get(i);
                     NodeImpl clone = (NodeImpl) n.cloneNode(true);
                     clone.isSpecified(n.isSpecified());
-                    nodes.setElementAt(clone, i);
+                    nodes.add(clone);
                     clone.ownerNode = ownerNode;
                     clone.isOwned(true);
                 }
@@ -510,7 +514,7 @@
     void moveSpecifiedAttributes(AttributeMap srcmap) {
         int nsize = (srcmap.nodes != null) ? srcmap.nodes.size() : 0;
         for (int i = nsize - 1; i &gt;= 0; i--) {
-            AttrImpl attr = (AttrImpl) srcmap.nodes.elementAt(i);
+            AttrImpl attr = (AttrImpl) srcmap.nodes.get(i);
             if (attr.isSpecified()) {
                 srcmap.remove(attr, i, false);
                 if (attr.getLocalName() != null) {
@@ -532,8 +536,8 @@
 
         // remove any existing default
         int nsize = (nodes != null) ? nodes.size() : 0;
-        for (int i = nsize - 1; i &gt;= 0; i--) {
-            AttrImpl attr = (AttrImpl) nodes.elementAt(i);
+        for (int i = nsize - 1; i &gt;= 0; --i) {
+            AttrImpl attr = (AttrImpl) nodes.get(i);
             if (!attr.isSpecified()) {
                 remove(attr, i, false);
             }
@@ -547,8 +551,8 @@
         }
         else {
             int dsize = defaults.nodes.size();
-            for (int n = 0; n &lt; dsize; n++) {
-                AttrImpl d = (AttrImpl) defaults.nodes.elementAt(n);
+            for (int n = 0; n &lt; dsize; ++n) {
+                AttrImpl d = (AttrImpl) defaults.nodes.get(n);
                 int i = findNamePoint(d.getNodeName(), 0); 
                 if (i &lt; 0) {
             		i = -1 - i; 
@@ -556,7 +560,7 @@
                     clone.ownerNode = ownerNode;
                     clone.isOwned(true);
                     clone.isSpecified(false);
-            		nodes.insertElementAt(clone, i);
+            		nodes.add(i, clone);
                 }
             }
         }
@@ -573,21 +577,21 @@
         
         int i = findNamePoint(argn.getNamespaceURI(), argn.getLocalName());
         if (i &gt;= 0) {
-            nodes.setElementAt(arg,i);
+            nodes.set(i, arg);
         } 
         else {
             // If we can't find by namespaceURI, localName, then we find by
             // nodeName so we know where to insert.
             i = findNamePoint(argn.getNodeName(),0);
             if (i &gt;= 0) {
-                nodes.insertElementAt(arg,i);
+                nodes.add(i, arg);
             } 
             else {
                 i = -1 - i; // Insert point (may be end of list)
                 if (null == nodes) {
-                    nodes = new Vector(5, 10);
+                    nodes = new ArrayList(5);
                 }
-                nodes.insertElementAt(arg, i);
+                nodes.add(i, arg);
             }
         }
         

Modified: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/dom/DOMImplementationListImpl.java
URL: http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/dom/DOMImplementationListImpl.java?rev=883487&amp;r1=883486&amp;r2=883487&amp;view=diff
==============================================================================
--- xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/dom/DOMImplementationListImpl.java
(original)
+++ xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/dom/DOMImplementationListImpl.java
Mon Nov 23 20:28:10 2009
@@ -17,6 +17,7 @@
 
 package org.apache.xerces.dom;
 
+import java.util.ArrayList;
 import java.util.Vector;
 
 import org.w3c.dom.DOMImplementation;
@@ -32,21 +33,28 @@
  */
 public class DOMImplementationListImpl implements DOMImplementationList {
 
-    //A collection of DOMImplementations
-    private Vector fImplementations;
+    // A collection of DOMImplementations
+    private final ArrayList fImplementations;
 
     /**
      * Construct an empty list of DOMImplementations
      */
     public DOMImplementationListImpl() {
-        fImplementations = new Vector();
+        fImplementations = new ArrayList();
+    }
+    
+    /** 
+     * Construct a list of DOMImplementations from an ArrayList
+     */ 
+    public DOMImplementationListImpl(ArrayList params) {
+        fImplementations = params;    
     }
 
-    /**
-     * Construct an empty list of DOMImplementations
-     */
+    /** 
+     * Construct a list of DOMImplementations from a Vector
+     */ 
     public DOMImplementationListImpl(Vector params) {
-        fImplementations = params;
+        fImplementations = new ArrayList(params);
     }
 
     /**
@@ -55,11 +63,11 @@
      * @param index The index of the DOMImplemetation from the list to return.
      */
     public DOMImplementation item(int index) {
-        try {
-            return (DOMImplementation) fImplementations.elementAt(index);
-        } catch (ArrayIndexOutOfBoundsException e) {
-            return null;
+        final int length = getLength();
+        if (index &gt;= 0 &amp;&amp; index &lt; length) {
+            return (DOMImplementation) fImplementations.get(index);
         }
+        return null;
     }
     
     /**

Modified: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/dom/DOMImplementationSourceImpl.java
URL: http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/dom/DOMImplementationSourceImpl.java?rev=883487&amp;r1=883486&amp;r2=883487&amp;view=diff
==============================================================================
--- xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/dom/DOMImplementationSourceImpl.java
(original)
+++ xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/dom/DOMImplementationSourceImpl.java
Mon Nov 23 20:28:10 2009
@@ -17,8 +17,8 @@
 
 package org.apache.xerces.dom;
 
+import java.util.ArrayList;
 import java.util.StringTokenizer;
-import java.util.Vector;
 
 import org.w3c.dom.DOMImplementation;
 import org.w3c.dom.DOMImplementationList;
@@ -78,13 +78,13 @@
     public DOMImplementationList getDOMImplementationList(String features) {
         // first check whether the CoreDOMImplementation would do
         DOMImplementation impl = CoreDOMImplementationImpl.getDOMImplementation();
-		final Vector implementations = new Vector();
+        final ArrayList implementations = new ArrayList();
         if (testImpl(impl, features)) {
-			implementations.addElement(impl);
+            implementations.add(impl);
         }
         impl = DOMImplementationImpl.getDOMImplementation();
         if (testImpl(impl, features)) {
-			implementations.addElement(impl);
+            implementations.add(impl);
         }
 
         return new DOMImplementationListImpl(implementations);

Modified: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/dom/DOMNormalizer.java
URL: http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/dom/DOMNormalizer.java?rev=883487&amp;r1=883486&amp;r2=883487&amp;view=diff
==============================================================================
--- xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/dom/DOMNormalizer.java (original)
+++ xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/dom/DOMNormalizer.java Mon
Nov 23 20:28:10 2009
@@ -18,6 +18,7 @@
 package org.apache.xerces.dom;
 
 import java.io.IOException;
+import java.util.ArrayList;
 import java.util.Vector;
 
 import org.apache.xerces.impl.Constants;
@@ -136,8 +137,7 @@
     protected final NamespaceContext fLocalNSBinder = new NamespaceSupport();
 
     /** list of attributes */
-    protected final Vector fAttributeList = new Vector(5,10);
-
+    protected final ArrayList fAttributeList = new ArrayList(5);
 
     /** DOM Locator -  for namespace fixup algorithm */
     protected final DOMLocatorImpl fLocator = new DOMLocatorImpl();
@@ -877,7 +877,7 @@
             // clone content of the attributes
             attributes.cloneMap(fAttributeList);
             for (int i = 0; i &lt; fAttributeList.size(); i++) {
-                Attr attr = (Attr) fAttributeList.elementAt(i);
+                Attr attr = (Attr) fAttributeList.get(i);
                 fLocator.fRelatedNode = attr;
 
                 if (DEBUG) {

Modified: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/dom/DOMXSImplementationSourceImpl.java
URL: http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/dom/DOMXSImplementationSourceImpl.java?rev=883487&amp;r1=883486&amp;r2=883487&amp;view=diff
==============================================================================
--- xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/dom/DOMXSImplementationSourceImpl.java
(original)
+++ xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/dom/DOMXSImplementationSourceImpl.java
Mon Nov 23 20:28:10 2009
@@ -17,7 +17,7 @@
 
 package org.apache.xerces.dom;
 
-import java.util.Vector;
+import java.util.ArrayList;
 
 import org.apache.xerces.impl.xs.XSImplementationImpl;
 import org.w3c.dom.DOMImplementation;
@@ -76,23 +76,23 @@
      *   features.
      */
     public DOMImplementationList getDOMImplementationList(String features) {
-        final Vector implementations = new Vector();
-        
+        final ArrayList implementations = new ArrayList();
+
         // first check whether the CoreDOMImplementation would do
         DOMImplementationList list = super.getDOMImplementationList(features);
-        //Add core DOMImplementations
-        for (int i=0; i &lt; list.getLength(); i++ ) {
-            implementations.addElement(list.item(i));
+        // Add core DOMImplementations
+        for (int i = 0; i &lt; list.getLength(); ++i) {
+            implementations.add(list.item(i));
         }
-        
+
         DOMImplementation impl = PSVIDOMImplementationImpl.getDOMImplementation();
         if (testImpl(impl, features)) {
-            implementations.addElement(impl);
+            implementations.add(impl);
         }
-        
+
         impl = XSImplementationImpl.getDOMImplementation();
         if (testImpl(impl, features)) {
-            implementations.addElement(impl);
+            implementations.add(impl);
         }
         return new DOMImplementationListImpl(implementations); 
     }

Modified: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/dom/DeepNodeListImpl.java
URL: http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/dom/DeepNodeListImpl.java?rev=883487&amp;r1=883486&amp;r2=883487&amp;view=diff
==============================================================================
--- xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/dom/DeepNodeListImpl.java
(original)
+++ xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/dom/DeepNodeListImpl.java
Mon Nov 23 20:28:10 2009
@@ -17,7 +17,7 @@
 
 package org.apache.xerces.dom;
 
-import java.util.Vector;
+import java.util.ArrayList;
 
 import org.w3c.dom.Node;
 import org.w3c.dom.NodeList;
@@ -58,7 +58,7 @@
  * it is being extended. That requires knowing which subtrees have
  * changed, which can become an arbitrarily complex problem.
  * &lt;P&gt;
- * We save some work by filling the vector only as we access the
+ * We save some work by filling the ArrayList only as we access the
  * item()s... but I suspect the same users who demanded index-based
  * access will also start by doing a getLength() to control their loop,
  * blowing this optimization out of the water.
@@ -81,7 +81,7 @@
     protected NodeImpl rootNode; // Where the search started
     protected String tagName;   // Or "*" to mean all-tags-acceptable
     protected int changes=0;
-    protected Vector nodes;
+    protected ArrayList nodes;
     
     protected String nsName;
     protected boolean enableNS = false;
@@ -94,7 +94,7 @@
     public DeepNodeListImpl(NodeImpl rootNode, String tagName) {
         this.rootNode = rootNode;
         this.tagName  = tagName;
-        nodes = new Vector();
+        nodes = new ArrayList();
     }  
 
     /** Constructor for Namespace support. */
@@ -121,30 +121,34 @@
     	Node thisNode;
 
         // Tree changed. Do it all from scratch!
-    	if(rootNode.changes() != changes) {
-            nodes   = new Vector();     
+    	if (rootNode.changes() != changes) {
+            nodes   = new ArrayList();     
             changes = rootNode.changes();
     	}
     
         // In the cache
-    	if (index &lt; nodes.size())      
-    	    return (Node)nodes.elementAt(index);
-    
+    	final int currentSize = nodes.size();
+    	if (index &lt; currentSize) {
+    	    return (Node)nodes.get(index);
+    	}
         // Not yet seen
     	else {
     
             // Pick up where we left off (Which may be the beginning)
-    		if (nodes.size() == 0)     
+    		if (currentSize == 0) { 
     		    thisNode = rootNode;
-    		else
-    		    thisNode=(NodeImpl)(nodes.lastElement());
+    		}
+    		else {
+    		    thisNode = (NodeImpl)(nodes.get(currentSize - 1));
+    		}
     
     		// Add nodes up to the one we're looking for
-    		while(thisNode != null &amp;&amp; index &gt;= nodes.size()) {
-    			thisNode=nextMatchingElementAfter(thisNode);
-    			if (thisNode != null)
-    			    nodes.addElement(thisNode);
+    		while (thisNode != null &amp;&amp; index &gt;= nodes.size()) {
+    		    thisNode = nextMatchingElementAfter(thisNode);
+    		    if (thisNode != null) {
+    		        nodes.add(thisNode);
     		    }
+    		}
 
             // Either what we want, or null (not avail.)
 		    return thisNode;           

Modified: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/dom/DeferredDocumentImpl.java
URL: http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/dom/DeferredDocumentImpl.java?rev=883487&amp;r1=883486&amp;r2=883487&amp;view=diff
==============================================================================
--- xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/dom/DeferredDocumentImpl.java
(original)
+++ xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/dom/DeferredDocumentImpl.java
Mon Nov 23 20:28:10 2009
@@ -17,7 +17,7 @@
 
 package org.apache.xerces.dom;
 
-import java.util.Vector;
+import java.util.ArrayList;
 
 import org.w3c.dom.DOMImplementation;
 import org.w3c.dom.Element;
@@ -130,7 +130,7 @@
     // private data
     //
     private transient final StringBuffer fBufferStr = new StringBuffer();
-    private transient final Vector fStrChunks = new Vector();
+    private transient final ArrayList fStrChunks = new ArrayList();
 
     //
     // Constructors
@@ -1157,14 +1157,14 @@
                 // append data that is stored in fNodeValue
                 // REVISIT: for text nodes it works differently than for CDATA
                 //          nodes.
-                fStrChunks.addElement(value);
+                fStrChunks.add(value);
                 do {
                     // go in reverse order: find last child, then
                     // its previous sibling, etc
                     chunk = prevSib &gt;&gt; CHUNK_SHIFT;
                     index = prevSib &amp; CHUNK_MASK;
                     value = getChunkValue(fNodeValue, chunk, index);
-                    fStrChunks.addElement(value);
+                    fStrChunks.add(value);
                     prevSib = getChunkIndex(fNodePrevSib, chunk, index);
                     if (prevSib == -1) {
                         break;
@@ -1175,11 +1175,11 @@
 
                 // add to the buffer in the correct order.
                 for (int i = chunkCount - 1; i &gt;= 0; i--) {                          
                                    
-                    fBufferStr.append((String)fStrChunks.elementAt(i));
+                    fBufferStr.append((String)fStrChunks.get(i));
                 }
                 
                 value = fBufferStr.toString();
-                fStrChunks.removeAllElements();
+                fStrChunks.clear();
                 fBufferStr.setLength(0);
                 return value;
             }
@@ -1196,16 +1196,16 @@
                    chunk = child &gt;&gt; CHUNK_SHIFT;
                     index = child &amp; CHUNK_MASK;
                     value = getChunkValue(fNodeValue, chunk, index);
-                    fStrChunks.addElement(value);
+                    fStrChunks.add(value);
                     child = getChunkIndex(fNodePrevSib, chunk, index);
                 }
                 // add to the buffer in the correct order.
                 for (int i=fStrChunks.size()-1; i&gt;=0; i--) {                         
                                     
-                     fBufferStr.append((String)fStrChunks.elementAt(i));
+                     fBufferStr.append((String)fStrChunks.get(i));
                 }
                                                          
                 value = fBufferStr.toString();
-                fStrChunks.setSize(0);
+                fStrChunks.clear();
                 fBufferStr.setLength(0);
                 return value;
             }

Modified: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/dom/NamedNodeMapImpl.java
URL: http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/dom/NamedNodeMapImpl.java?rev=883487&amp;r1=883486&amp;r2=883487&amp;view=diff
==============================================================================
--- xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/dom/NamedNodeMapImpl.java
(original)
+++ xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/dom/NamedNodeMapImpl.java
Mon Nov 23 20:28:10 2009
@@ -17,7 +17,12 @@
 
 package org.apache.xerces.dom;
 
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
 import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.List;
 import java.util.Vector;
 
 import org.w3c.dom.DOMException;
@@ -38,7 +43,7 @@
  * NOTE: The "primary" storage key is taken from the NodeName attribute of the
  * node. The "secondary" storage key is the namespaceURI and localName, when
  * accessed by DOM level 2 nodes. All nodes, even DOM Level 2 nodes are stored
- * in a single Vector sorted by the primary "nodename" key.
+ * in a single ArrayList sorted by the primary "nodename" key.
  * &lt;P&gt;
  * NOTE: item()'s integer index does _not_ imply that the named nodes
  * must be stored in an array; that's only an access method. Note too
@@ -72,7 +77,7 @@
     protected final static short HASDEFAULTS  = 0x1&lt;&lt;2;
 
     /** Nodes. */
-    protected Vector nodes;
+    protected List nodes;
 
     protected NodeImpl ownerNode; // the node this map belongs to
 
@@ -115,7 +120,7 @@
      */
     public Node item(int index) {
     	return (nodes != null &amp;&amp; index &lt; nodes.size()) ?
-                    (Node)(nodes.elementAt(index)) : null;
+                    (Node)(nodes.get(index)) : null;
     }
 
     /**
@@ -128,7 +133,7 @@
     public Node getNamedItem(String name) {
 
     	int i = findNamePoint(name,0);
-        return (i &lt; 0) ? null : (Node)(nodes.elementAt(i));
+        return (i &lt; 0) ? null : (Node)(nodes.get(i));
 
     } // getNamedItem(String):Node
 
@@ -146,7 +151,7 @@
     public Node getNamedItemNS(String namespaceURI, String localName) {
 
     	int i = findNamePoint(namespaceURI, localName);
-        return (i &lt; 0) ? null : (Node)(nodes.elementAt(i));
+        return (i &lt; 0) ? null : (Node)(nodes.get(i));
 
     } // getNamedItemNS(String,String):Node
 
@@ -185,14 +190,14 @@
         int i = findNamePoint(arg.getNodeName(),0);
         NodeImpl previous = null;
         if (i &gt;= 0) {
-            previous = (NodeImpl) nodes.elementAt(i);
-            nodes.setElementAt(arg,i);
+            previous = (NodeImpl) nodes.get(i);
+            nodes.set(i, arg);
         } else {
             i = -1 - i; // Insert point (may be end of list)
             if (null == nodes) {
-                nodes = new Vector(5, 10);
+                nodes = new ArrayList(5);
             }
-            nodes.insertElementAt(arg, i);
+            nodes.add(i, arg);
         }
         return previous;
         
@@ -228,21 +233,21 @@
         int i = findNamePoint(arg.getNamespaceURI(), arg.getLocalName());
         NodeImpl previous = null;
         if (i &gt;= 0) {
-            previous = (NodeImpl) nodes.elementAt(i);
-            nodes.setElementAt(arg,i);
+            previous = (NodeImpl) nodes.get(i);
+            nodes.set(i, arg);
         } else {
             // If we can't find by namespaceURI, localName, then we find by
             // nodeName so we know where to insert.
             i = findNamePoint(arg.getNodeName(),0);
             if (i &gt;= 0) {
-                previous = (NodeImpl) nodes.elementAt(i);
-                nodes.insertElementAt(arg,i);
+                previous = (NodeImpl) nodes.get(i);
+                nodes.add(i, arg);
             } else {
                 i = -1 - i; // Insert point (may be end of list)
                 if (null == nodes) {
-                    nodes = new Vector(5, 10);
+                    nodes = new ArrayList(5);
                 }
-                nodes.insertElementAt(arg, i);
+                nodes.add(i, arg);
             }
         }
         return previous;
@@ -270,8 +275,8 @@
             throw new DOMException(DOMException.NOT_FOUND_ERR, msg);
         }
 
-        NodeImpl n = (NodeImpl)nodes.elementAt(i);
-        nodes.removeElementAt(i);
+        NodeImpl n = (NodeImpl)nodes.get(i);
+        nodes.remove(i);
 
         return n;
 
@@ -306,8 +311,8 @@
             throw new DOMException(DOMException.NOT_FOUND_ERR, msg);
         }
 
-        NodeImpl n = (NodeImpl)nodes.elementAt(i);
-        nodes.removeElementAt(i);
+        NodeImpl n = (NodeImpl)nodes.get(i);
+        nodes.remove(i);
 
         return n;
 
@@ -329,19 +334,21 @@
     }
 
     protected void cloneContent(NamedNodeMapImpl srcmap) {
-        Vector srcnodes = srcmap.nodes;
+        List srcnodes = srcmap.nodes;
         if (srcnodes != null) {
             int size = srcnodes.size();
             if (size != 0) {
                 if (nodes == null) {
-                    nodes = new Vector(size);
+                    nodes = new ArrayList(size);
+                }
+                else {
+                    nodes.clear();
                 }
-                nodes.setSize(size);
                 for (int i = 0; i &lt; size; ++i) {
-                    NodeImpl n = (NodeImpl) srcmap.nodes.elementAt(i);
+                    NodeImpl n = (NodeImpl) srcmap.nodes.get(i);
                     NodeImpl clone = (NodeImpl) n.cloneNode(true);
                     clone.isSpecified(n.isSpecified());
-                    nodes.setElementAt(clone, i);
+                    nodes.add(clone);
                 }
             }
         }
@@ -366,7 +373,7 @@
         isReadOnly(readOnly);
     	if (deep &amp;&amp; nodes != null) {
             for (int i = nodes.size() - 1; i &gt;= 0; i--) {
-                ((NodeImpl) nodes.elementAt(i)).setReadOnly(readOnly,deep);
+                ((NodeImpl) nodes.get(i)).setReadOnly(readOnly,deep);
             }
     	}
     } // setReadOnly(boolean,boolean)
@@ -390,7 +397,8 @@
      */
     protected void setOwnerDocument(CoreDocumentImpl doc) {
         if (nodes != null) {
-            for (int i = 0; i &lt; nodes.size(); i++) {
+            final int size = nodes.size();
+            for (int i = 0; i &lt; size; ++i) {
                 ((NodeImpl)item(i)).setOwnerDocument(doc);
             }
         }
@@ -446,7 +454,7 @@
 
             while (first &lt;= last) {
                 i = (first + last) / 2;
-                int test = name.compareTo(((Node)(nodes.elementAt(i))).getNodeName());
+                int test = name.compareTo(((Node)(nodes.get(i))).getNodeName());
                 if (test == 0) {
                     return i; // Name found
                 }
@@ -475,15 +483,16 @@
         if (nodes == null) return -1;
         if (name == null) return -1;
         
-        // This is a linear search through the same nodes Vector.
-        // The Vector is sorted on the DOM Level 1 nodename.
+        // This is a linear search through the same nodes ArrayList.
+        // The ArrayList is sorted on the DOM Level 1 nodename.
         // The DOM Level 2 NS keys are namespaceURI and Localname, 
         // so we must linear search thru it.
         // In addition, to get this to work with nodes without any namespace
         // (namespaceURI and localNames are both null) we then use the nodeName
-        // as a seconday key.
-        for (int i = 0; i &lt; nodes.size(); i++) {
-            NodeImpl a = (NodeImpl)nodes.elementAt(i);
+        // as a secondary key.
+        final int size = nodes.size();
+        for (int i = 0; i &lt; size; ++i) {
+            NodeImpl a = (NodeImpl)nodes.get(i);
             String aNamespaceURI = a.getNamespaceURI();
             String aLocalName = a.getLocalName();
             if (namespaceURI == null) {
@@ -507,15 +516,15 @@
     // return false
     protected boolean precedes(Node a, Node b) {
 
-       if (nodes != null) {
-          for (int i = 0; i &lt; nodes.size(); i++) {
-              Node n = (Node)nodes.elementAt(i);
-              if (n==a) return true;
-              if (n==b) return false;
-          }
-       }
-
-       return false;
+        if (nodes != null) {
+            final int size = nodes.size();
+            for (int i = 0; i &lt; size; ++i) {
+                Node n = (Node)nodes.get(i);
+                if (n==a) return true;
+                if (n==b) return false;
+            }
+        }
+        return false;
     }
 
 
@@ -524,14 +533,14 @@
       */
     protected void removeItem(int index) {
        if (nodes != null &amp;&amp; index &lt; nodes.size()){
-           nodes.removeElementAt(index);
+           nodes.remove(index);
        }
     }
 
 
     protected Object getItem (int index){
-        if (nodes !=null) {
-            return nodes.elementAt(index);
+        if (nodes != null) {
+            return nodes.get(index);
         }
         return null;
     }
@@ -539,43 +548,43 @@
     protected int addItem (Node arg) {
     	int i = findNamePoint(arg.getNamespaceURI(), arg.getLocalName());
     	if (i &gt;= 0) {
-            nodes.setElementAt(arg,i);
+            nodes.set(i, arg);
     	} 
         else {
     	    // If we can't find by namespaceURI, localName, then we find by
     	    // nodeName so we know where to insert.
     	    i = findNamePoint(arg.getNodeName(),0);
             if (i &gt;= 0) {
-                nodes.insertElementAt(arg,i);
+                nodes.add(i, arg);
             } 
             else {
                 i = -1 - i; // Insert point (may be end of list)
                 if (null == nodes) {
-                    nodes = new Vector(5, 10);
+                    nodes = new ArrayList(5);
                 }
-                nodes.insertElementAt(arg, i);
+                nodes.add(i, arg);
             }
         }
         return i;        
     }
 
     /**
-     * NON-DOM: copy content of this map into the specified vector
+     * NON-DOM: copy content of this map into the specified ArrayList
      * 
-     * @param list   Vector to copy information into.
+     * @param list   ArrayList to copy information into.
      * @return A copy of this node named map
      */
-    protected Vector cloneMap(Vector list){
+    protected ArrayList cloneMap(ArrayList list) {
         if (list == null) {
-            list = new Vector(5, 10);
+            list = new ArrayList(5);
         }
-        list.setSize(0);
+        list.clear();
         if (nodes != null) {
-            for (int i=0; i&lt;nodes.size(); i++) {
-                list.insertElementAt(nodes.elementAt(i), i);
+            final int size = nodes.size();
+            for (int i = 0; i &lt; size; ++i) {
+                list.add(nodes.get(i));
             }
         }
-        
         return list;
     }
     
@@ -588,9 +597,31 @@
       */
     public void removeAll (){
         if (nodes != null) {
-            nodes.removeAllElements();
+            nodes.clear();
         }
     }
     
+    private void readObject(ObjectInputStream in)
+        throws IOException, ClassNotFoundException {
+        in.defaultReadObject();
+        if (nodes != null) {
+            nodes = new ArrayList(nodes);
+        }
+    }
 
+    private void writeObject(ObjectOutputStream out) throws IOException {
+        List oldNodes = this.nodes;
+        try {
+            if (oldNodes != null) {
+                this.nodes = new Vector(oldNodes);
+            }
+            out.defaultWriteObject();
+        }
+        // If the write fails for some reason ensure 
+        // that we restore the original object.
+        finally {
+            this.nodes = oldNodes;
+        }
+    }
+    
 } // class NamedNodeMapImpl



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



</pre>
</div>
</content>
</entry>
<entry>
<title>svn commit: r883376 - in /xerces/c/trunk/src/xercesc/validators/schema: SchemaGrammar.cpp SchemaGrammar.hpp TraverseSchema.cpp</title>
<author><name>borisk@apache.org</name></author>
<link rel="alternate" href="http://mail-archives.apache.org/mod_mbox/xerces-commits/200911.mbox/%3c20091123154523.768A323889B8@eris.apache.org%3e"/>
<id>urn:uuid:%3c20091123154523-768A323889B8@eris-apache-org%3e</id>
<updated>2009-11-23T15:45:23Z</updated>
<content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml">
<pre>
Author: borisk
Date: Mon Nov 23 15:45:23 2009
New Revision: 883376

URL: http://svn.apache.org/viewvc?rev=883376&amp;view=rev
Log:
Store the anonymous type count in the SchemaGrammar object.

Modified:
    xerces/c/trunk/src/xercesc/validators/schema/SchemaGrammar.cpp
    xerces/c/trunk/src/xercesc/validators/schema/SchemaGrammar.hpp
    xerces/c/trunk/src/xercesc/validators/schema/TraverseSchema.cpp

Modified: xerces/c/trunk/src/xercesc/validators/schema/SchemaGrammar.cpp
URL: http://svn.apache.org/viewvc/xerces/c/trunk/src/xercesc/validators/schema/SchemaGrammar.cpp?rev=883376&amp;r1=883375&amp;r2=883376&amp;view=diff
==============================================================================
--- xerces/c/trunk/src/xercesc/validators/schema/SchemaGrammar.cpp (original)
+++ xerces/c/trunk/src/xercesc/validators/schema/SchemaGrammar.cpp Mon Nov 23 15:45:23 2009
@@ -59,6 +59,7 @@
     , fValidated(false)
     , fDatatypeRegistry(manager)
     , fScopeCount (0)
+    , fAnonTypeCount (0)
 {
     CleanupType cleanup(this, &amp;SchemaGrammar::cleanUp);
 

Modified: xerces/c/trunk/src/xercesc/validators/schema/SchemaGrammar.hpp
URL: http://svn.apache.org/viewvc/xerces/c/trunk/src/xercesc/validators/schema/SchemaGrammar.hpp?rev=883376&amp;r1=883375&amp;r2=883376&amp;view=diff
==============================================================================
--- xerces/c/trunk/src/xercesc/validators/schema/SchemaGrammar.hpp (original)
+++ xerces/c/trunk/src/xercesc/validators/schema/SchemaGrammar.hpp Mon Nov 23 15:45:23 2009
@@ -243,6 +243,12 @@
     unsigned int getScopeCount () const;
     void setScopeCount (unsigned int);
 
+    /**
+     * Get/set anonymous type count.
+     */
+    unsigned int getAnonTypeCount () const;
+    void setAnonTypeCount (unsigned int);
+
     /***
      * Support for Serialization/De-serialization
      ***/
@@ -334,6 +340,7 @@
     DatatypeValidatorFactory               fDatatypeRegistry;
 
     unsigned int                             fScopeCount;
+    unsigned int                             fAnonTypeCount;
 };
 
 
@@ -614,6 +621,18 @@
   fScopeCount = scopeCount;
 }
 
+inline unsigned int
+SchemaGrammar::getAnonTypeCount () const
+{
+  return fAnonTypeCount;
+}
+
+inline void
+SchemaGrammar::setAnonTypeCount (unsigned int count)
+{
+  fAnonTypeCount = count;
+}
+
 XERCES_CPP_NAMESPACE_END
 
 #endif

Modified: xerces/c/trunk/src/xercesc/validators/schema/TraverseSchema.cpp
URL: http://svn.apache.org/viewvc/xerces/c/trunk/src/xercesc/validators/schema/TraverseSchema.cpp?rev=883376&amp;r1=883375&amp;r2=883376&amp;view=diff
==============================================================================
--- xerces/c/trunk/src/xercesc/validators/schema/TraverseSchema.cpp (original)
+++ xerces/c/trunk/src/xercesc/validators/schema/TraverseSchema.cpp Mon Nov 23 15:45:23 2009
@@ -169,7 +169,7 @@
     , fEmptyNamespaceURI(-1)
     , fCurrentScope(Grammar::TOP_LEVEL_SCOPE)
     , fScopeCount(schemaGrammar-&gt;getScopeCount ())
-    , fAnonXSTypeCount(0)
+    , fAnonXSTypeCount(schemaGrammar-&gt;getAnonTypeCount ())
     , fCircularCheckIndex(0)
     , fTargetNSURIString(0)
     , fDatatypeRegistry(0)
@@ -235,11 +235,12 @@
             preprocessSchema(schemaRoot, schemaURL, multipleImport);
             doTraverseSchema(schemaRoot);
 
-            // Store the scope count in case we need to add more to this
-            // grammar (multi-import case). schemaGrammar and fSchemaGrammar
-            // should be the same here.
+            // Store the scope and anon type counts in case we need to add
+            // more to this grammar (multi-import case). schemaGrammar and
+            // fSchemaGrammar should be the same here.
             //
             fSchemaGrammar-&gt;setScopeCount (fScopeCount);
+            fSchemaGrammar-&gt;setAnonTypeCount (fAnonXSTypeCount);
         }
 
     }
@@ -885,6 +886,7 @@
             // --------------------------------------------------------
             SchemaInfo* saveInfo = fSchemaInfo;
             fSchemaGrammar-&gt;setScopeCount (fScopeCount);
+            fSchemaGrammar-&gt;setAnonTypeCount (fAnonXSTypeCount);
             if (grammarFound) {
                 fSchemaGrammar = (SchemaGrammar*) aGrammar;
             }
@@ -892,6 +894,8 @@
                 fSchemaGrammar = new (fGrammarPoolMemoryManager) SchemaGrammar(fGrammarPoolMemoryManager);
             }
             fScopeCount = fSchemaGrammar-&gt;getScopeCount ();
+            fAnonXSTypeCount = fSchemaGrammar-&gt;getAnonTypeCount ();
+
             XMLSchemaDescription* gramDesc = (XMLSchemaDescription*) fSchemaGrammar-&gt;getGrammarDescription();
             gramDesc-&gt;setContextType(XMLSchemaDescription::CONTEXT_IMPORT);
             gramDesc-&gt;setLocationHints(importURL);
@@ -6940,8 +6944,11 @@
         int targetNSURI = toRestore-&gt;getTargetNSURI();
 
         fSchemaGrammar-&gt;setScopeCount (fScopeCount);
+        fSchemaGrammar-&gt;setAnonTypeCount (fAnonXSTypeCount);
+
         fSchemaGrammar = (SchemaGrammar*) fGrammarResolver-&gt;getGrammar(toRestore-&gt;getTargetNSURIString());
         fScopeCount = fSchemaGrammar-&gt;getScopeCount ();
+        fAnonXSTypeCount = fSchemaGrammar-&gt;getAnonTypeCount ();
 
         fTargetNSURI = targetNSURI;
         fCurrentScope = saveScope;



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



</pre>
</div>
</content>
</entry>
<entry>
<title>=?utf-8?q?=5BXerces_Wiki=5D_Update_of_=22XercescBuildStatus=22_by_Alberto?= =?utf-8?q?Massari?=</title>
<author><name>Apache Wiki &lt;wikidiffs@apache.org&gt;</name></author>
<link rel="alternate" href="http://mail-archives.apache.org/mod_mbox/xerces-commits/200911.mbox/%3c20091123153321.28376.40553@eos.apache.org%3e"/>
<id>urn:uuid:%3c20091123153321-28376-40553@eos-apache-org%3e</id>
<updated>2009-11-23T15:33:21Z</updated>
<content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml">
<pre>
Dear Wiki user,

You have subscribed to a wiki page or wiki category on "Xerces Wiki" for change notification.

The "XercescBuildStatus" page has been changed by AlbertoMassari.
http://wiki.apache.org/xerces/XercescBuildStatus?action=diff&amp;rev1=46&amp;rev2=47

--------------------------------------------------

   * debug/release
  
  Platform-specific configurations that should be tested are listed in the Configuration cells.
+ ||'''Platform''' ||'''Compiler''' ||'''SVN id''' ||'''Build Date''' ||'''Configuration'''
||'''Build''' ||'''Test''' ||'''Install''' ||'''Comments''' ||'''Builder''' ||
+ ||Windows x86 ||VS 2003 ||883299||11/23/2009||32-bit ||Unknown ||Unknown ||Unknown ||tested
with ICU 3.8.1|| ||
+ ||Windows x86 ||VS 2005 ||883299||11/23/2009||32-bit ||Unknown ||Unknown ||Unknown ||tested
with ICU 3.8.1|| ||
+ ||Windows x86-64 ||VS 2005 || || ||64-bit ||Unknown ||Unknown ||Unknown || || ||
+ ||Windows x86 ||VS 2008 ||883299||11/23/2009||32-bit ||Unknown ||Unknown ||Unknown ||tested
with ICU 3.8.1|| ||
+ ||Windows x86-64 ||VS 2008 || || ||64-bit ||Unknown ||Unknown ||Unknown || || ||
+ ||GNU/Linux x86 ||GCC 3.3.x || || ||32-bit ||Unknown ||Unknown ||Unknown || || ||
+ ||GNU/Linux x86-64 ||GCC 3.3.x || || ||64-bit ||Unknown ||Unknown ||Unknown || || ||
+ ||GNU/Linux x86 ||GCC 3.4.x || || ||32-bit, iconv, ICU, gnuiconv, socket, curl, libwww ||Unknown
||Unknown ||Unknown || || ||
+ ||GNU/Linux x86-64 ||GCC 3.4.x || || ||64-bit ||Unknown ||Unknown ||Unknown || || ||
+ ||GNU/Linux x86 ||GCC 4.0.x || || ||32-bit, iconv, ICU, gnuiconv, socket, curl ||Unknown
||Unknown ||Unknown || || ||
+ ||GNU/Linux x86-64 ||GCC 4.0.x || || ||64-bit ||Unknown ||Unknown ||Unknown || || ||
+ ||GNU/Linux x86 ||GCC 4.1.x || || ||32-bit, iconv, ICU, gnuiconv, socket, curl, libwww ||Unknown
||Unknown ||Unknown || || ||
+ ||GNU/Linux x86-64 ||GCC 4.1.x || || ||64-bit ||Unknown ||Unknown ||Unknown || || ||
+ ||GNU/Linux x86 ||GCC 4.2.x || || ||32-bit ||Unknown ||Unknown ||Unknown || || ||
+ ||GNU/Linux x86-64 ||GCC 4.2.x || || ||64-bit ||Unknown ||Unknown ||Unknown || || ||
+ ||Solaris x86 ||Studio 10 (5.7) || || ||32-bit ||Unknown ||Unknown ||Unknown ||{{{./configure
CXX=CC CC=cc}}} || ||
+ ||Solaris x86-64 ||Studio 10 (5.7) || || ||64-bit ||Unknown ||Unknown ||Unknown ||{{{./configure
CXX=CC CC=cc CFLAGS=-xarch=amd64 CXXFLAGS=-xarch=amd64}}} || ||
+ ||Solaris x86 ||GCC 3.4.x || || ||32-bit ||Unknown ||Unknown ||Unknown || || ||
+ ||Solaris x86-64 ||GCC 3.4.x || || ||64-bit ||Unknown ||Unknown ||Unknown || || ||
+ ||Solaris SPARC ||Studio 10 (5.7) || || ||32-bit ||Unknown ||Unknown ||Unknown ||{{{./configure
CXX=CC CC=cc}}} || ||
+ ||Solaris SPARCv9 ||Studio 10 (5.7) || || ||64-bit ||Unknown ||Unknown ||Unknown ||{{{./configure
CXX=CC CC=cc CFLAGS=-xarch=v9 CXXFLAGS=-xarch=v9}}} || ||
+ ||Solaris SPARC ||GCC 3.4.x || || ||32-bit ||Unknown ||Unknown ||Unknown || || ||
+ ||Solaris SPARCv9 ||GCC 3.4.x || || ||64-bit ||Unknown ||Unknown ||Unknown || || ||
+ ||AIX PowerPC ||XL C++ 7.0 || || ||32-bit ||Unknown ||Unknown ||Unknown ||{{{./configure
CXX=xlC_r CC=xlc_r}}} {{{gmake libxerces_c_la_LDFLAGS=-qmkshrobj}}} || ||
+ ||AIX PowerPC-64 ||XL C++ 7.0 || || ||64-bit ||Unknown ||Unknown ||Unknown ||{{{export OBJECT_MODE=64}}}
{{{./configure CXX=xlC_r CC=xlc_r CXXFLAGS=-q64 CFLAGS=-q64}}} &lt;&lt;BR&gt;&gt; {{{gmake
libxerces_c_la_LDFLAGS=-qmkshrobj}}} || ||
+ ||AIX PowerPC ||GCC 3.4.x || || ||32-bit ||Unknown ||Unknown ||Unknown || || ||
+ ||AIX PowerPC-64 ||GCC 3.4.x || || ||64-bit ||Unknown ||Unknown ||Unknown || || ||
+ ||HP-UX PA-RISC ||aCC A.03.x || || ||32-bit ||Unknown ||Unknown ||Unknown || || ||
+ ||HP-UX PA-RISC-64 ||aCC A.03.x || || ||64-bit ||Unknown ||Unknown ||Unknown || || ||
+ ||HP-UX PA-RISC ||GCC 3.4.x || || ||32-bit ||Unknown ||Unknown ||Unknown || || ||
+ ||HP-UX PA-RISC-64 ||GCC 3.4.x || || ||64-bit ||Unknown ||Unknown ||Unknown || || ||
+ ||HP-UX IA-64-32 ||aCC A.06.x || || ||32-bit ||Unknown ||Unknown ||Unknown ||{{{./configure
CXX=aCC CC=aCC CFLAGS=-mt CXXFLAGS=-mt LDFLAGS=-mt}}} || ||
+ ||HP-UX IA-64 ||aCC A.06.x || || ||64-bit ||Unknown ||Unknown ||Unknown ||{{{./configure
CXX=aCC CC=aCC CFLAGS="-mt +DD64" CXXFLAGS="-mt +DD64" LDFLAGS="-mt +DD64"}}} || ||
+ ||HP-UX IA-64-32 ||GCC 3.4.x || || ||32-bit ||Unknown ||Unknown ||Unknown || || ||
+ ||HP-UX IA-64 ||GCC 3.4.x || || ||64-bit ||Unknown ||Unknown ||Unknown || || ||
+ ||Mac OS X x86 ||GCC 3.3.x || || ||32-bit ||Unknown ||Unknown ||Unknown || || ||
+ ||Mac OS X x86 ||GCC 4.0.x || || ||32-bit ||Unknown ||Unknown ||Unknown ||{{{./configure}}}
|| ||
+ ||Mac OS X x86-64 ||GCC 4.0.x || || ||64-bit ||Unknown ||Unknown ||Unknown ||{{{./configure
CFLAGS='-arch x86_64' CXXFLAGS='-arch x86_64' }}} || ||
+ ||Mac OS X PowerPC ||GCC 3.3.x || || ||32-bit ||Unknown ||Unknown ||Unknown || || ||
+ ||Mac OS X PowerPC ||GCC 4.0.x || || ||32-bit ||Unknown ||Unknown ||Unknown ||{{{./configure
CFLAGS='-arch ppc' CXXFLAGS='-arch ppc'}}} || ||
+ ||Mac OS X PowerPC-64 ||GCC 4.0.x || || ||64-bit ||Unknown ||Unknown ||Unknown ||{{{./configure
CFLAGS='-arch ppc64' CXXFLAGS='-arch ppc64'}}} || ||
+ ||Mac OS X x86/PowerPC 32/64 ||GCC 4.0.x || || ||32-bit &amp; 64-bit ||Unknown ||Unknown
||Unknown ||{{{./configure --disable-dependency-tracking CFLAGS='-arch i386 -arch x86_64 -arch
ppc -arch ppc64' CXXFLAGS='-arch i386 -arch x86_64 -arch ppc -arch ppc64'}}} || ||
+ ||Mingw x86 ||GCC 3.4.x || || ||32-bit ||Unknown ||Unknown ||Unknown ||{{{./configure LDFLAGS=-no-undefined}}}
|| ||
+ ||Cygwin x86 ||GCC 3.4.x || || ||32-bit ||Unknown ||Unknown ||Unknown ||{{{./configure LDFLAGS=-no-undefined}}}
|| ||
  
- || '''Platform''' || '''Compiler''' || '''SVN id''' || '''Build Date''' || '''Configuration'''
|| '''Build''' || '''Test''' || '''Install''' || '''Comments''' || '''Builder''' ||
- || Windows x86    || VS 2003 || || || 32-bit ||Unknown ||Unknown|| Unknown || || ||
- || Windows x86    || VS 2005 || || || 32-bit ||Unknown ||Unknown|| Unknown || || ||
- || Windows x86-64 || VS 2005 || || || 64-bit ||Unknown || Unknown           || Unknown ||
|| ||
- || Windows x86    || VS 2008 || || || 32-bit ||Unknown ||Unknown  || Unknown || || ||
- || Windows x86-64 || VS 2008 || || || 64-bit ||Unknown || Unknown           || Unknown ||
|| ||
- || GNU/Linux x86    || GCC 3.3.x || || || 32-bit ||Unknown ||Unknown || Unknown || || ||
- || GNU/Linux x86-64 || GCC 3.3.x || || || 64-bit ||Unknown ||Unknown || Unknown || || ||
- || GNU/Linux x86    || GCC 3.4.x || || || 32-bit, iconv, ICU, gnuiconv, socket, curl, libwww
||Unknown ||Unknown || Unknown || || ||
- || GNU/Linux x86-64 || GCC 3.4.x ||  ||  || 64-bit|| Unknown  || Unknown || Unknown || ||
 ||
- || GNU/Linux x86    || GCC 4.0.x || || || 32-bit, iconv, ICU, gnuiconv, socket, curl ||Unknown
||Unknown || Unknown || || ||
- || GNU/Linux x86-64 || GCC 4.0.x ||  ||  || 64-bit|| Unknown  || Unknown || Unknown || ||
 ||
- || GNU/Linux x86    || GCC 4.1.x || || || 32-bit, iconv, ICU, gnuiconv, socket, curl, libwww
||Unknown ||Unknown || Unknown || || ||
- || GNU/Linux x86-64 || GCC 4.1.x || || || 64-bit ||Unknown ||Unknown || Unknown || || ||
- || GNU/Linux x86 || GCC 4.2.x ||  ||  || 32-bit|| Unknown  || Unknown || Unknown || || 
||
- || GNU/Linux x86-64 || GCC 4.2.x ||  ||  || 64-bit|| Unknown  || Unknown || Unknown || ||
 ||
- || Solaris x86 || Studio 10 (5.7) || || || 32-bit ||Unknown ||Unknown || Unknown || {{{./configure
CXX=CC CC=cc}}} || ||
- || Solaris x86-64 || Studio 10 (5.7) || || || 64-bit ||Unknown ||Unknown || Unknown || {{{./configure
CXX=CC CC=cc CFLAGS=-xarch=amd64 CXXFLAGS=-xarch=amd64}}} || ||
- || Solaris x86 || GCC 3.4.x || || || 32-bit ||Unknown ||Unknown || Unknown || || ||
- || Solaris x86-64 || GCC 3.4.x ||  ||  || 64-bit|| Unknown  || Unknown || Unknown || ||
 ||
- || Solaris SPARC || Studio 10 (5.7) || || || 32-bit ||Unknown ||Unknown || Unknown || {{{./configure
CXX=CC CC=cc}}} || ||
- || Solaris SPARCv9 || Studio 10 (5.7) || || || 64-bit ||Unknown ||Unknown || Unknown ||
{{{./configure CXX=CC CC=cc CFLAGS=-xarch=v9 CXXFLAGS=-xarch=v9}}} || ||
- || Solaris SPARC || GCC 3.4.x ||  ||  || 32-bit|| Unknown  || Unknown || Unknown || || 
||
- || Solaris SPARCv9 || GCC 3.4.x ||  ||  || 64-bit|| Unknown  || Unknown || Unknown || ||
 ||
- || AIX PowerPC || XL C++ 7.0 || || || 32-bit ||Unknown ||Unknown || Unknown || {{{./configure
CXX=xlC_r CC=xlc_r}}} &lt;&lt;BR&gt;&gt; {{{gmake libxerces_c_la_LDFLAGS=-qmkshrobj}}} ||
||
- || AIX PowerPC-64 || XL C++ 7.0 || || || 64-bit ||Unknown ||Unknown || Unknown || {{{export
OBJECT_MODE=64}}} &lt;&lt;BR&gt;&gt; {{{./configure CXX=xlC_r CC=xlc_r CXXFLAGS=-q64 CFLAGS=-q64}}}
&lt;&lt;BR&gt;&gt; {{{gmake libxerces_c_la_LDFLAGS=-qmkshrobj}}} || ||
- || AIX PowerPC || GCC 3.4.x ||  ||  || 32-bit|| Unknown  || Unknown || Unknown || ||  ||
- || AIX PowerPC-64 || GCC 3.4.x ||  ||  || 64-bit|| Unknown  || Unknown || Unknown || ||
 ||
- || HP-UX PA-RISC || aCC A.03.x || || || 32-bit ||Unknown ||Unknown || Unknown || || ||
- || HP-UX PA-RISC-64 || aCC A.03.x || || || 64-bit ||Unknown ||Unknown || Unknown || || ||
- || HP-UX PA-RISC || GCC 3.4.x || || || 32-bit||Unknown ||Unknown || Unknown || || ||
- || HP-UX PA-RISC-64 || GCC 3.4.x || ||  || 64-bit|| Unknown  || Unknown || Unknown || ||
 ||
- || HP-UX IA-64-32 || aCC A.06.x ||  ||  || 32-bit|| Unknown  || Unknown || Unknown || {{{./configure
CXX=aCC CC=aCC CFLAGS=-mt CXXFLAGS=-mt LDFLAGS=-mt}}} ||  ||
- || HP-UX IA-64 || aCC A.06.x ||  ||  || 64-bit|| Unknown  || Unknown || Unknown || {{{./configure
CXX=aCC CC=aCC CFLAGS="-mt +DD64" CXXFLAGS="-mt +DD64" LDFLAGS="-mt +DD64"}}} || ||
- || HP-UX IA-64-32 || GCC 3.4.x ||  ||  || 32-bit|| Unknown  || Unknown || Unknown || ||
 ||
- || HP-UX IA-64 || GCC 3.4.x ||  ||  || 64-bit|| Unknown  || Unknown || Unknown || ||  ||
- || Mac OS X x86 || GCC 3.3.x ||  ||  || 32-bit|| Unknown  || Unknown || Unknown || ||  ||
- || Mac OS X x86 || GCC 4.0.x || || || 32-bit ||Unknown ||Unknown || Unknown || {{{./configure}}}
|| ||
- || Mac OS X x86-64 || GCC 4.0.x || || || 64-bit||Unknown ||Unknown || Unknown || {{{./configure
CFLAGS='-arch x86_64' CXXFLAGS='-arch x86_64' }}} || ||
- || Mac OS X PowerPC || GCC 3.3.x ||  ||  || 32-bit|| Unknown  || Unknown || Unknown || ||
 ||
- || Mac OS X PowerPC || GCC 4.0.x || || || 32-bit||Unknown  ||Unknown || Unknown || {{{./configure
CFLAGS='-arch ppc' CXXFLAGS='-arch ppc'}}} || ||
- || Mac OS X PowerPC-64 || GCC 4.0.x ||  ||  || 64-bit|| Unknown  || Unknown || Unknown ||
 {{{./configure CFLAGS='-arch ppc64' CXXFLAGS='-arch ppc64'}}} ||  ||
- || Mac OS X x86/PowerPC 32/64 || GCC 4.0.x || || || 32-bit &amp; 64-bit||Unknown  ||Unknown
|| Unknown ||  {{{./configure --disable-dependency-tracking CFLAGS='-arch i386 -arch x86_64
-arch ppc -arch ppc64' CXXFLAGS='-arch i386 -arch x86_64 -arch ppc -arch ppc64'}}} || ||
- || Mingw x86 || GCC 3.4.x || || || 32-bit ||Unknown ||Unknown ||Unknown || {{{./configure
LDFLAGS=-no-undefined}}} || ||
- || Cygwin x86 || GCC 3.4.x || || || 32-bit ||Unknown  ||Unknown ||Unknown || {{{./configure
LDFLAGS=-no-undefined}}} ||  ||
  
+ 

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



</pre>
</div>
</content>
</entry>
<entry>
<title>svn commit: r883368 - in /xerces/c/trunk/src/xercesc: dom/impl/ internal/ util/ validators/DTD/</title>
<author><name>amassari@apache.org</name></author>
<link rel="alternate" href="http://mail-archives.apache.org/mod_mbox/xerces-commits/200911.mbox/%3c20091123152821.6A03423888DC@eris.apache.org%3e"/>
<id>urn:uuid:%3c20091123152821-6A03423888DC@eris-apache-org%3e</id>
<updated>2009-11-23T15:28:20Z</updated>
<content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml">
<pre>
Author: amassari
Date: Mon Nov 23 15:28:19 2009
New Revision: 883368

URL: http://svn.apache.org/viewvc?rev=883368&amp;view=rev
Log:
Rearrange data member to suit Borland compiler; a few conversions unsigned int -&gt; XMLSize_t

Modified:
    xerces/c/trunk/src/xercesc/dom/impl/DOMDeepNodeListPool.c
    xerces/c/trunk/src/xercesc/dom/impl/DOMDeepNodeListPool.hpp
    xerces/c/trunk/src/xercesc/dom/impl/DOMDocumentImpl.cpp
    xerces/c/trunk/src/xercesc/internal/XTemplateSerializer.cpp
    xerces/c/trunk/src/xercesc/util/Hash2KeysSetOf.c
    xerces/c/trunk/src/xercesc/util/Hash2KeysSetOf.hpp
    xerces/c/trunk/src/xercesc/util/NameIdPool.c
    xerces/c/trunk/src/xercesc/util/NameIdPool.hpp
    xerces/c/trunk/src/xercesc/util/RefHash2KeysTableOf.hpp
    xerces/c/trunk/src/xercesc/util/RefHash3KeysIdPool.c
    xerces/c/trunk/src/xercesc/util/RefHash3KeysIdPool.hpp
    xerces/c/trunk/src/xercesc/validators/DTD/DTDGrammar.hpp

Modified: xerces/c/trunk/src/xercesc/dom/impl/DOMDeepNodeListPool.c
URL: http://svn.apache.org/viewvc/xerces/c/trunk/src/xercesc/dom/impl/DOMDeepNodeListPool.c?rev=883368&amp;r1=883367&amp;r2=883368&amp;view=diff
==============================================================================
--- xerces/c/trunk/src/xercesc/dom/impl/DOMDeepNodeListPool.c (original)
+++ xerces/c/trunk/src/xercesc/dom/impl/DOMDeepNodeListPool.c Mon Nov 23 15:28:19 2009
@@ -71,11 +71,11 @@
     fAdoptedElems(adoptElems)
     , fBucketList(0)
     , fHashModulus(modulus)
-    , fHasher(hasher)
     , fIdPtrs(0)
     , fIdPtrsCount(initSize)
     , fIdCounter(0)
     , fMemoryManager(XMLPlatformUtils::fgMemoryManager)
+    , fHasher(hasher)
 {
     initialize(modulus);
 
@@ -246,7 +246,7 @@
 
 template &lt;class TVal, class THasher&gt;
 TVal*
-DOMDeepNodeListPool&lt;TVal, THasher&gt;::getById(const unsigned int elemId)
+DOMDeepNodeListPool&lt;TVal, THasher&gt;::getById(const XMLSize_t elemId)
 {
     // If its either zero or beyond our current id, its an error
     if (!elemId || (elemId &gt; fIdCounter))
@@ -257,7 +257,7 @@
 
 template &lt;class TVal, class THasher&gt;
 const TVal*
-DOMDeepNodeListPool&lt;TVal, THasher&gt;::getById(const unsigned int elemId) const
+DOMDeepNodeListPool&lt;TVal, THasher&gt;::getById(const XMLSize_t elemId) const
 {
     // If its either zero or beyond our current id, its an error
     if (!elemId || (elemId &gt; fIdCounter))
@@ -270,7 +270,7 @@
 //  DOMDeepNodeListPool: Putters
 // ---------------------------------------------------------------------------
 template &lt;class TVal, class THasher&gt;
-unsigned int
+XMLSize_t
 DOMDeepNodeListPool&lt;TVal, THasher&gt;::put(void* key1, XMLCh* key2, XMLCh* key3, TVal*
const valueToAdopt)
 {
     // First see if the key exists already
@@ -344,7 +344,7 @@
         fIdPtrs = newArray;
         fIdPtrsCount = newCount;
     }
-    const unsigned int retId = ++fIdCounter;
+    const XMLSize_t retId = ++fIdCounter;
     fIdPtrs[retId] = valueToAdopt;
 
     // Return the id that we gave to this element

Modified: xerces/c/trunk/src/xercesc/dom/impl/DOMDeepNodeListPool.hpp
URL: http://svn.apache.org/viewvc/xerces/c/trunk/src/xercesc/dom/impl/DOMDeepNodeListPool.hpp?rev=883368&amp;r1=883367&amp;r2=883368&amp;view=diff
==============================================================================
--- xerces/c/trunk/src/xercesc/dom/impl/DOMDeepNodeListPool.hpp (original)
+++ xerces/c/trunk/src/xercesc/dom/impl/DOMDeepNodeListPool.hpp Mon Nov 23 15:28:19 2009
@@ -125,13 +125,13 @@
     TVal* getByKey(const void* const key1, const XMLCh* const key2, const XMLCh* const key3);
     const TVal* getByKey(const void* const key1, const XMLCh* const key2, const XMLCh* const
key3) const;
 
-    TVal* getById(const unsigned int elemId);
-    const TVal* getById(const unsigned int elemId) const;
+    TVal* getById(const XMLSize_t elemId);
+    const TVal* getById(const XMLSize_t elemId) const;
 
     // -----------------------------------------------------------------------
     //  Putters
     // -----------------------------------------------------------------------
-    unsigned int put(void* key1, XMLCh* key2, XMLCh* key3, TVal* const valueToAdopt);
+    XMLSize_t put(void* key1, XMLCh* key2, XMLCh* key3, TVal* const valueToAdopt);
 
 private:
 
@@ -184,11 +184,11 @@
     bool                                       fAdoptedElems;
     DOMDeepNodeListPoolTableBucketElem&lt;TVal&gt;** fBucketList;
     XMLSize_t                                  fHashModulus;
-    THasher                                    fHasher;
     TVal**                                     fIdPtrs;
     XMLSize_t                                  fIdPtrsCount;
-    unsigned int                               fIdCounter;
+    XMLSize_t                                  fIdCounter;
     MemoryManager*                             fMemoryManager;
+    THasher                                    fHasher;
 };
 
 XERCES_CPP_NAMESPACE_END

Modified: xerces/c/trunk/src/xercesc/dom/impl/DOMDocumentImpl.cpp
URL: http://svn.apache.org/viewvc/xerces/c/trunk/src/xercesc/dom/impl/DOMDocumentImpl.cpp?rev=883368&amp;r1=883367&amp;r2=883368&amp;view=diff
==============================================================================
--- xerces/c/trunk/src/xercesc/dom/impl/DOMDocumentImpl.cpp (original)
+++ xerces/c/trunk/src/xercesc/dom/impl/DOMDocumentImpl.cpp Mon Nov 23 15:28:19 2009
@@ -909,7 +909,7 @@
 
     DOMDeepNodeListImpl* retList = fNodeListPool-&gt;getByKey(rootNode, tagName, 0);
     if (!retList) {
-        int id = fNodeListPool-&gt;put((void*) rootNode, (XMLCh*) tagName, 0, new (this)
DOMDeepNodeListImpl(rootNode, tagName));
+        XMLSize_t id = fNodeListPool-&gt;put((void*) rootNode, (XMLCh*) tagName, 0, new (this)
DOMDeepNodeListImpl(rootNode, tagName));
         retList = fNodeListPool-&gt;getById(id);
     }
 
@@ -928,7 +928,7 @@
     DOMDeepNodeListImpl* retList = fNodeListPool-&gt;getByKey(rootNode, localName, namespaceURI);
     if (!retList) {
         // the pool will adopt the DOMDeepNodeListImpl
-        int id = fNodeListPool-&gt;put((void*) rootNode, (XMLCh*) localName, (XMLCh*) namespaceURI,
new (this) DOMDeepNodeListImpl(rootNode, namespaceURI, localName));
+        XMLSize_t id = fNodeListPool-&gt;put((void*) rootNode, (XMLCh*) localName, (XMLCh*)
namespaceURI, new (this) DOMDeepNodeListImpl(rootNode, namespaceURI, localName));
         retList = fNodeListPool-&gt;getById(id);
     }
 

Modified: xerces/c/trunk/src/xercesc/internal/XTemplateSerializer.cpp
URL: http://svn.apache.org/viewvc/xerces/c/trunk/src/xercesc/internal/XTemplateSerializer.cpp?rev=883368&amp;r1=883367&amp;r2=883368&amp;view=diff
==============================================================================
--- xerces/c/trunk/src/xercesc/internal/XTemplateSerializer.cpp (original)
+++ xerces/c/trunk/src/xercesc/internal/XTemplateSerializer.cpp Mon Nov 23 15:28:19 2009
@@ -2168,7 +2168,7 @@
     {
         NameIdPoolEnumerator&lt;DTDElementDecl&gt; e(objToStore, objToStore-&gt;getMemoryManager());
 
-        serEng&lt;&lt;e.size();
+        serEng&lt;&lt;(unsigned int)e.size();
 
         while (e.hasMoreElements())
         {
@@ -2221,7 +2221,7 @@
     {
         NameIdPoolEnumerator&lt;DTDEntityDecl&gt; e(objToStore, objToStore-&gt;getMemoryManager());
 
-        serEng&lt;&lt;e.size();
+        serEng&lt;&lt;(unsigned int)e.size();
 
         while (e.hasMoreElements())
         {
@@ -2273,7 +2273,7 @@
     {
         NameIdPoolEnumerator&lt;XMLNotationDecl&gt; e(objToStore, objToStore-&gt;getMemoryManager());
 
-        serEng&lt;&lt;e.size();
+        serEng&lt;&lt;(unsigned int)e.size();
 
         while (e.hasMoreElements())
         {

Modified: xerces/c/trunk/src/xercesc/util/Hash2KeysSetOf.c
URL: http://svn.apache.org/viewvc/xerces/c/trunk/src/xercesc/util/Hash2KeysSetOf.c?rev=883368&amp;r1=883367&amp;r2=883368&amp;view=diff
==============================================================================
--- xerces/c/trunk/src/xercesc/util/Hash2KeysSetOf.c (original)
+++ xerces/c/trunk/src/xercesc/util/Hash2KeysSetOf.c Mon Nov 23 15:28:19 2009
@@ -62,8 +62,8 @@
     , fBucketList(0)
     , fHashModulus(modulus)
     , fCount(0)
-    , fHasher (hasher)
     , fAvailable(0)
+    , fHasher (hasher)
 {
     initialize(modulus);
 }

Modified: xerces/c/trunk/src/xercesc/util/Hash2KeysSetOf.hpp
URL: http://svn.apache.org/viewvc/xerces/c/trunk/src/xercesc/util/Hash2KeysSetOf.hpp?rev=883368&amp;r1=883367&amp;r2=883368&amp;view=diff
==============================================================================
--- xerces/c/trunk/src/xercesc/util/Hash2KeysSetOf.hpp (original)
+++ xerces/c/trunk/src/xercesc/util/Hash2KeysSetOf.hpp Mon Nov 23 15:28:19 2009
@@ -135,8 +135,8 @@
     Hash2KeysSetBucketElem**            fBucketList;
     XMLSize_t                           fHashModulus;
     XMLSize_t                           fCount;
-    THasher				                fHasher;
     Hash2KeysSetBucketElem*             fAvailable;
+    THasher				                fHasher;
 };
 
 

Modified: xerces/c/trunk/src/xercesc/util/NameIdPool.c
URL: http://svn.apache.org/viewvc/xerces/c/trunk/src/xercesc/util/NameIdPool.c?rev=883368&amp;r1=883367&amp;r2=883368&amp;view=diff
==============================================================================
--- xerces/c/trunk/src/xercesc/util/NameIdPool.c (original)
+++ xerces/c/trunk/src/xercesc/util/NameIdPool.c Mon Nov 23 15:28:19 2009
@@ -39,14 +39,14 @@
 //  NameIdPool: Constructors and Destructor
 // ---------------------------------------------------------------------------
 template &lt;class TElem&gt;
-NameIdPool&lt;TElem&gt;::NameIdPool( const unsigned int hashModulus
-                             , const unsigned int initSize
+NameIdPool&lt;TElem&gt;::NameIdPool( const XMLSize_t      hashModulus
+                             , const XMLSize_t      initSize
                              , MemoryManager* const manager) :
     fMemoryManager(manager)
-    , fBucketList(hashModulus, manager)
     , fIdPtrs(0)
     , fIdPtrsCount(initSize)
     , fIdCounter(0)
+    , fBucketList(hashModulus, manager)
 {
     if (!hashModulus)
         ThrowXMLwithMemMgr(IllegalArgumentException, XMLExcepts::Pool_ZeroModulus, fMemoryManager);
@@ -119,7 +119,7 @@
 
 template &lt;class TElem&gt;
 inline TElem* NameIdPool&lt;TElem&gt;::
-getById(const unsigned int elemId)
+getById(const XMLSize_t elemId)
 {
     // If its either zero or beyond our current id, its an error
     if (!elemId || (elemId &gt; fIdCounter))
@@ -130,7 +130,7 @@
 
 template &lt;class TElem&gt;
 inline const TElem* NameIdPool&lt;TElem&gt;::
-getById(const unsigned int elemId) const
+getById(const XMLSize_t elemId) const
 {
     // If its either zero or beyond our current id, its an error
     if (!elemId || (elemId &gt; fIdCounter))
@@ -149,7 +149,7 @@
 //  NameIdPool: Setters
 // ---------------------------------------------------------------------------
 template &lt;class TElem&gt;
-unsigned int NameIdPool&lt;TElem&gt;::put(TElem* const elemToAdopt)
+XMLSize_t NameIdPool&lt;TElem&gt;::put(TElem* const elemToAdopt)
 {
     // First see if the key exists already. If so, its an error
     if(containsKey(elemToAdopt-&gt;getKey()))
@@ -172,7 +172,7 @@
     if (fIdCounter + 1 == fIdPtrsCount)
     {
         // Create a new count 1.5 times larger and allocate a new array
-        unsigned int newCount = (unsigned int)(fIdPtrsCount * 1.5);
+        XMLSize_t newCount = (XMLSize_t)(fIdPtrsCount * 1.5);
         TElem** newArray = (TElem**) fMemoryManager-&gt;allocate
         (
             newCount * sizeof(TElem*)
@@ -186,7 +186,7 @@
         fIdPtrs = newArray;
         fIdPtrsCount = newCount;
     }
-    const unsigned int retId = ++fIdCounter;
+    const XMLSize_t retId = ++fIdCounter;
     fIdPtrs[retId] = elemToAdopt;
 
     // Set the id on the passed element
@@ -276,7 +276,7 @@
     fCurIndex = fToEnum-&gt;fIdCounter ? 1:0;
 }
 
-template &lt;class TElem&gt; unsigned int NameIdPoolEnumerator&lt;TElem&gt;::size() const
+template &lt;class TElem&gt; XMLSize_t NameIdPoolEnumerator&lt;TElem&gt;::size() const
 {
     return fToEnum-&gt;fIdCounter;
 }

Modified: xerces/c/trunk/src/xercesc/util/NameIdPool.hpp
URL: http://svn.apache.org/viewvc/xerces/c/trunk/src/xercesc/util/NameIdPool.hpp?rev=883368&amp;r1=883367&amp;r2=883368&amp;view=diff
==============================================================================
--- xerces/c/trunk/src/xercesc/util/NameIdPool.hpp (original)
+++ xerces/c/trunk/src/xercesc/util/NameIdPool.hpp Mon Nov 23 15:28:19 2009
@@ -67,8 +67,8 @@
     // -----------------------------------------------------------------------
     NameIdPool
     (
-        const   unsigned int    hashModulus
-        , const unsigned int    initSize = 128
+        const   XMLSize_t       hashModulus
+        , const XMLSize_t       initSize = 128
         , MemoryManager* const  manager = XMLPlatformUtils::fgMemoryManager
     );
 
@@ -87,8 +87,8 @@
     // -----------------------------------------------------------------------
     TElem* getByKey(const XMLCh* const key);
     const TElem* getByKey(const XMLCh* const key) const;
-    TElem* getById(const unsigned int elemId);
-    const TElem* getById(const unsigned int elemId) const;
+    TElem* getById(const XMLSize_t elemId);
+    const TElem* getById(const XMLSize_t elemId) const;
 
     MemoryManager* getMemoryManager() const;
     // -----------------------------------------------------------------------
@@ -97,7 +97,7 @@
     //  Dups are not allowed and cause an IllegalArgumentException. The id
     //  of the new element is returned.
     // -----------------------------------------------------------------------
-    unsigned int put(TElem* const valueToAdopt);
+    XMLSize_t put(TElem* const valueToAdopt);
 
 
 protected :
@@ -136,10 +136,10 @@
     //
     // -----------------------------------------------------------------------
     MemoryManager*                  fMemoryManager;
-    RefHashTableOf&lt;TElem&gt;           fBucketList;
     TElem**                         fIdPtrs;
-    unsigned int                    fIdPtrsCount;
-    unsigned int                    fIdCounter;
+    XMLSize_t                       fIdPtrsCount;
+    XMLSize_t                       fIdCounter;
+    RefHashTableOf&lt;TElem&gt;           fBucketList;
 };
 
 
@@ -180,7 +180,7 @@
     bool hasMoreElements() const;
     TElem&amp; nextElement();
     void Reset();
-    unsigned int  size()  const;
+    XMLSize_t size()  const;
 
 private :
     // -----------------------------------------------------------------------
@@ -193,7 +193,7 @@
     //  fToEnum
     //      The name id pool that is being enumerated.
     // -----------------------------------------------------------------------
-    unsigned int            fCurIndex;
+    XMLSize_t               fCurIndex;
     NameIdPool&lt;TElem&gt;*      fToEnum;
     MemoryManager*          fMemoryManager;
 };

Modified: xerces/c/trunk/src/xercesc/util/RefHash2KeysTableOf.hpp
URL: http://svn.apache.org/viewvc/xerces/c/trunk/src/xercesc/util/RefHash2KeysTableOf.hpp?rev=883368&amp;r1=883367&amp;r2=883368&amp;view=diff
==============================================================================
--- xerces/c/trunk/src/xercesc/util/RefHash2KeysTableOf.hpp (original)
+++ xerces/c/trunk/src/xercesc/util/RefHash2KeysTableOf.hpp Mon Nov 23 15:28:19 2009
@@ -170,7 +170,7 @@
     RefHash2KeysTableBucketElem&lt;TVal&gt;** fBucketList;
     XMLSize_t                           fHashModulus;
     XMLSize_t                           fCount;
-    THasher				fHasher;
+    THasher                             fHasher;
 };
 
 

Modified: xerces/c/trunk/src/xercesc/util/RefHash3KeysIdPool.c
URL: http://svn.apache.org/viewvc/xerces/c/trunk/src/xercesc/util/RefHash3KeysIdPool.c?rev=883368&amp;r1=883367&amp;r2=883368&amp;view=diff
==============================================================================
--- xerces/c/trunk/src/xercesc/util/RefHash3KeysIdPool.c (original)
+++ xerces/c/trunk/src/xercesc/util/RefHash3KeysIdPool.c Mon Nov 23 15:28:19 2009
@@ -73,10 +73,10 @@
     , fAdoptedElems(true)
     , fBucketList(0)
     , fHashModulus(modulus)
-    , fHasher(hasher)
     , fIdPtrs(0)
     , fIdPtrsCount(initSize)
     , fIdCounter(0)
+    , fHasher(hasher)
 {
     initialize(modulus);
 
@@ -130,10 +130,10 @@
     , fAdoptedElems(adoptElems)
     , fBucketList(0)
     , fHashModulus(modulus)
-    , fHasher(hasher)
     , fIdPtrs(0)
     , fIdPtrsCount(initSize)
     , fIdCounter(0)
+    , fHasher(hasher)
 {
     initialize(modulus);
 

Modified: xerces/c/trunk/src/xercesc/util/RefHash3KeysIdPool.hpp
URL: http://svn.apache.org/viewvc/xerces/c/trunk/src/xercesc/util/RefHash3KeysIdPool.hpp?rev=883368&amp;r1=883367&amp;r2=883368&amp;view=diff
==============================================================================
--- xerces/c/trunk/src/xercesc/util/RefHash3KeysIdPool.hpp (original)
+++ xerces/c/trunk/src/xercesc/util/RefHash3KeysIdPool.hpp Mon Nov 23 15:28:19 2009
@@ -196,10 +196,10 @@
     bool                                fAdoptedElems;
     RefHash3KeysTableBucketElem&lt;TVal&gt;** fBucketList;
     XMLSize_t                           fHashModulus;
-    THasher                             fHasher;
     TVal**                              fIdPtrs;
     XMLSize_t                           fIdPtrsCount;
     XMLSize_t                           fIdCounter;
+    THasher                             fHasher;
 };
 
 

Modified: xerces/c/trunk/src/xercesc/validators/DTD/DTDGrammar.hpp
URL: http://svn.apache.org/viewvc/xerces/c/trunk/src/xercesc/validators/DTD/DTDGrammar.hpp?rev=883368&amp;r1=883367&amp;r2=883368&amp;view=diff
==============================================================================
--- xerces/c/trunk/src/xercesc/validators/DTD/DTDGrammar.hpp (original)
+++ xerces/c/trunk/src/xercesc/validators/DTD/DTDGrammar.hpp Mon Nov 23 15:28:19 2009
@@ -163,7 +163,7 @@
     // -----------------------------------------------------------------------
     //  Content management methods
     // -----------------------------------------------------------------------
-    unsigned int putEntityDecl(DTDEntityDecl* const entityDecl) const;
+    XMLSize_t putEntityDecl(DTDEntityDecl* const entityDecl) const;
 
     /***
      * Support for Serialization/De-serialization
@@ -275,7 +275,7 @@
 // -----------------------------------------------------------------------
 //  Setter methods
 // -----------------------------------------------------------------------
-inline unsigned int DTDGrammar::putEntityDecl(DTDEntityDecl* const entityDecl)   const
+inline XMLSize_t DTDGrammar::putEntityDecl(DTDEntityDecl* const entityDecl)   const
 {
     return fEntityDeclPool-&gt;put(entityDecl);
 }



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



</pre>
</div>
</content>
</entry>
<entry>
<title>svn commit: r883322 - /xerces/c/trunk/src/xercesc/validators/schema/TraverseSchema.cpp</title>
<author><name>borisk@apache.org</name></author>
<link rel="alternate" href="http://mail-archives.apache.org/mod_mbox/xerces-commits/200911.mbox/%3c20091123124233.0F69F23888DC@eris.apache.org%3e"/>
<id>urn:uuid:%3c20091123124233-0F69F23888DC@eris-apache-org%3e</id>
<updated>2009-11-23T12:42:32Z</updated>
<content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml">
<pre>
Author: borisk
Date: Mon Nov 23 12:42:32 2009
New Revision: 883322

URL: http://svn.apache.org/viewvc?rev=883322&amp;view=rev
Log:
Save the scope count to the grammar object in case we will be adding to this 
schema (multi-import case).

Modified:
    xerces/c/trunk/src/xercesc/validators/schema/TraverseSchema.cpp

Modified: xerces/c/trunk/src/xercesc/validators/schema/TraverseSchema.cpp
URL: http://svn.apache.org/viewvc/xerces/c/trunk/src/xercesc/validators/schema/TraverseSchema.cpp?rev=883322&amp;r1=883321&amp;r2=883322&amp;view=diff
==============================================================================
--- xerces/c/trunk/src/xercesc/validators/schema/TraverseSchema.cpp (original)
+++ xerces/c/trunk/src/xercesc/validators/schema/TraverseSchema.cpp Mon Nov 23 12:42:32 2009
@@ -234,6 +234,12 @@
 
             preprocessSchema(schemaRoot, schemaURL, multipleImport);
             doTraverseSchema(schemaRoot);
+
+            // Store the scope count in case we need to add more to this
+            // grammar (multi-import case). schemaGrammar and fSchemaGrammar
+            // should be the same here.
+            //
+            fSchemaGrammar-&gt;setScopeCount (fScopeCount);
         }
 
     }
@@ -291,7 +297,6 @@
 void TraverseSchema::preprocessSchema(DOMElement* const schemaRoot,
                                       const XMLCh* const schemaURL,
                                       bool  multipleImport) {
-
     if (!multipleImport) {
         // Make sure namespace binding is defaulted
         const XMLCh* rootPrefix = schemaRoot-&gt;getPrefix();



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



</pre>
</div>
</content>
</entry>
<entry>
<title>svn commit: r883307 - in /xerces/c/trunk/src/xercesc: internal/IGXMLScanner2.cpp internal/SGXMLScanner.cpp validators/schema/SchemaInfo.cpp validators/schema/SchemaInfo.hpp validators/schema/TraverseSchema.cpp</title>
<author><name>borisk@apache.org</name></author>
<link rel="alternate" href="http://mail-archives.apache.org/mod_mbox/xerces-commits/200911.mbox/%3c20091123113529.5C8FA23888D1@eris.apache.org%3e"/>
<id>urn:uuid:%3c20091123113529-5C8FA23888D1@eris-apache-org%3e</id>
<updated>2009-11-23T11:35:29Z</updated>
<content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml">
<pre>
Author: borisk
Date: Mon Nov 23 11:35:28 2009
New Revision: 883307

URL: http://svn.apache.org/viewvc?rev=883307&amp;view=rev
Log:
Mark schema DOM representation as unavailable after the call to TraverseSchema.

Modified:
    xerces/c/trunk/src/xercesc/internal/IGXMLScanner2.cpp
    xerces/c/trunk/src/xercesc/internal/SGXMLScanner.cpp
    xerces/c/trunk/src/xercesc/validators/schema/SchemaInfo.cpp
    xerces/c/trunk/src/xercesc/validators/schema/SchemaInfo.hpp
    xerces/c/trunk/src/xercesc/validators/schema/TraverseSchema.cpp

Modified: xerces/c/trunk/src/xercesc/internal/IGXMLScanner2.cpp
URL: http://svn.apache.org/viewvc/xerces/c/trunk/src/xercesc/internal/IGXMLScanner2.cpp?rev=883307&amp;r1=883306&amp;r2=883307&amp;view=diff
==============================================================================
--- xerces/c/trunk/src/xercesc/internal/IGXMLScanner2.cpp (original)
+++ xerces/c/trunk/src/xercesc/internal/IGXMLScanner2.cpp Mon Nov 23 11:35:28 2009
@@ -1955,6 +1955,17 @@
                         , grammarFound
                     );
 
+                    // Reset the now invalid schema roots in the collected
+                    // schema info entries.
+                    //
+                    {
+                      RefHash2KeysTableOfEnumerator&lt;SchemaInfo&gt; i (
+                        fToCacheGrammar ? fCachedSchemaInfoList : fSchemaInfoList);
+
+                      while (i.hasMoreElements ())
+                        i.nextElement().resetRoot ();
+                    }
+
                     if (fGrammarType == Grammar::DTDGrammarType) {
                         fGrammar = schemaGrammar;
                         fGrammarType = Grammar::SchemaGrammarType;
@@ -2177,6 +2188,17 @@
                 );
 
               grammar = schemaGrammar;
+
+              // Reset the now invalid schema roots in the collected
+              // schema info entries.
+              //
+              {
+                RefHash2KeysTableOfEnumerator&lt;SchemaInfo&gt; i (
+                  toCache ? fCachedSchemaInfoList : fSchemaInfoList);
+
+                while (i.hasMoreElements ())
+                  i.nextElement().resetRoot ();
+              }
             }
 
             if (fValidate) {

Modified: xerces/c/trunk/src/xercesc/internal/SGXMLScanner.cpp
URL: http://svn.apache.org/viewvc/xerces/c/trunk/src/xercesc/internal/SGXMLScanner.cpp?rev=883307&amp;r1=883306&amp;r2=883307&amp;view=diff
==============================================================================
--- xerces/c/trunk/src/xercesc/internal/SGXMLScanner.cpp (original)
+++ xerces/c/trunk/src/xercesc/internal/SGXMLScanner.cpp Mon Nov 23 11:35:28 2009
@@ -3766,6 +3766,17 @@
                         , grammarFound
                     );
 
+                    // Reset the now invalid schema roots in the collected
+                    // schema info entries.
+                    //
+                    {
+                      RefHash2KeysTableOfEnumerator&lt;SchemaInfo&gt; i (
+                        fToCacheGrammar ? fCachedSchemaInfoList : fSchemaInfoList);
+
+                      while (i.hasMoreElements ())
+                        i.nextElement().resetRoot ();
+                    }
+
                     if (fGrammarType == Grammar::DTDGrammarType) {
                         fGrammar = schemaGrammar;
                         fGrammarType = Grammar::SchemaGrammarType;
@@ -3969,6 +3980,17 @@
                 );
 
               grammar = schemaGrammar;
+
+              // Reset the now invalid schema roots in the collected
+              // schema info entries.
+              //
+              {
+                RefHash2KeysTableOfEnumerator&lt;SchemaInfo&gt; i (
+                  toCache ? fCachedSchemaInfoList : fSchemaInfoList);
+
+                while (i.hasMoreElements ())
+                  i.nextElement().resetRoot ();
+              }
             }
 
             if (fValidate) {

Modified: xerces/c/trunk/src/xercesc/validators/schema/SchemaInfo.cpp
URL: http://svn.apache.org/viewvc/xerces/c/trunk/src/xercesc/validators/schema/SchemaInfo.cpp?rev=883307&amp;r1=883306&amp;r2=883307&amp;view=diff
==============================================================================
--- xerces/c/trunk/src/xercesc/validators/schema/SchemaInfo.cpp (original)
+++ xerces/c/trunk/src/xercesc/validators/schema/SchemaInfo.cpp Mon Nov 23 11:35:28 2009
@@ -114,6 +114,9 @@
                                  const XMLCh* const name,
                                  SchemaInfo** enclosingSchema) {
 
+    if (fSchemaRootElement == 0)
+      return 0;
+
     SchemaInfo* currentInfo = this;
     DOMElement* child = getTopLevelComponent(compCategory, compName, name);
 
@@ -147,8 +150,8 @@
                                  const XMLCh* const compName,
                                  const XMLCh* const name) {
 
-    if (compCategory &gt;= C_Count)
-        return 0;
+    if (fSchemaRootElement == 0 || compCategory &gt;= C_Count)
+      return 0;
 
     DOMElement* child = XUtil::getFirstChildElement(fSchemaRootElement);
 

Modified: xerces/c/trunk/src/xercesc/validators/schema/SchemaInfo.hpp
URL: http://svn.apache.org/viewvc/xerces/c/trunk/src/xercesc/validators/schema/SchemaInfo.hpp?rev=883307&amp;r1=883306&amp;r2=883307&amp;view=diff
==============================================================================
--- xerces/c/trunk/src/xercesc/validators/schema/SchemaInfo.hpp (original)
+++ xerces/c/trunk/src/xercesc/validators/schema/SchemaInfo.hpp Mon Nov 23 11:35:28 2009
@@ -113,6 +113,7 @@
     void setBlockDefault(const int aValue);
     void setFinalDefault(const int aValue);
     void setElemAttrDefaultQualified(const unsigned short aValue);
+    void resetRoot ();
 
     // -----------------------------------------------------------------------
     //  Access methods
@@ -273,6 +274,11 @@
     }*/
 }
 
+inline void SchemaInfo::resetRoot ()
+{
+    fSchemaRootElement = 0;
+}
+
 // ---------------------------------------------------------------------------
 //  SchemaInfo: Access methods
 // ---------------------------------------------------------------------------

Modified: xerces/c/trunk/src/xercesc/validators/schema/TraverseSchema.cpp
URL: http://svn.apache.org/viewvc/xerces/c/trunk/src/xercesc/validators/schema/TraverseSchema.cpp?rev=883307&amp;r1=883306&amp;r2=883307&amp;view=diff
==============================================================================
--- xerces/c/trunk/src/xercesc/validators/schema/TraverseSchema.cpp (original)
+++ xerces/c/trunk/src/xercesc/validators/schema/TraverseSchema.cpp Mon Nov 23 11:35:28 2009
@@ -223,7 +223,7 @@
             if (multipleImport)
             {
               // If we are working on an existing schema, do some
-              // intitialization that is notherwise done by preprocessSchema.
+              // intitialization that is otherwise done by preprocessSchema.
               //
               fComplexTypeRegistry = fSchemaGrammar-&gt;getComplexTypeRegistry();
               fGroupRegistry = fSchemaGrammar-&gt;getGroupInfoRegistry();
@@ -5527,7 +5527,6 @@
     }
 
     if (!typeInfo) {
-
         if (!XMLString::equals(typeURI, SchemaSymbols::fgURI_SCHEMAFORSCHEMA) ||
             XMLString::equals(fTargetNSURIString, SchemaSymbols::fgURI_SCHEMAFORSCHEMA))
{
 
@@ -5546,7 +5545,6 @@
 
     // restore schema information
     restoreSchemaInfo(saveInfo, infoType, saveScope);
-
     return typeInfo;
 }
 



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



</pre>
</div>
</content>
</entry>
<entry>
<title>svn commit: r883299 - /xerces/c/trunk/src/xercesc/util/Xerces_autoconf_config.msvc.hpp</title>
<author><name>amassari@apache.org</name></author>
<link rel="alternate" href="http://mail-archives.apache.org/mod_mbox/xerces-commits/200911.mbox/%3c20091123103455.3CA9623888DC@eris.apache.org%3e"/>
<id>urn:uuid:%3c20091123103455-3CA9623888DC@eris-apache-org%3e</id>
<updated>2009-11-23T10:34:55Z</updated>
<content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml">
<pre>
Author: amassari
Date: Mon Nov 23 10:34:54 2009
New Revision: 883299

URL: http://svn.apache.org/viewvc?rev=883299&amp;view=rev
Log:
Intrinsics are not available in VS.NET 2003

Modified:
    xerces/c/trunk/src/xercesc/util/Xerces_autoconf_config.msvc.hpp

Modified: xerces/c/trunk/src/xercesc/util/Xerces_autoconf_config.msvc.hpp
URL: http://svn.apache.org/viewvc/xerces/c/trunk/src/xercesc/util/Xerces_autoconf_config.msvc.hpp?rev=883299&amp;r1=883298&amp;r2=883299&amp;view=diff
==============================================================================
--- xerces/c/trunk/src/xercesc/util/Xerces_autoconf_config.msvc.hpp (original)
+++ xerces/c/trunk/src/xercesc/util/Xerces_autoconf_config.msvc.hpp Mon Nov 23 10:34:54 2009
@@ -71,9 +71,9 @@
 #endif
 
 #ifdef _NATIVE_WCHAR_T_DEFINED
-#define XERCES_XMLCH_T      wchar_t
+#  define XERCES_XMLCH_T      wchar_t
 #else
-#define XERCES_XMLCH_T      unsigned short
+#  define XERCES_XMLCH_T      unsigned short
 #endif
 
 #define XERCES_SIZE_T       SIZE_T
@@ -86,20 +86,22 @@
 #define XERCES_LSTRSUPPORT          1
 
 #ifdef XERCES_STATIC_LIBRARY
-#define XERCES_PLATFORM_EXPORT
-#define XERCES_PLATFORM_IMPORT
+#  define XERCES_PLATFORM_EXPORT
+#  define XERCES_PLATFORM_IMPORT
 #else
-#define XERCES_PLATFORM_EXPORT __declspec(dllexport)
-#define XERCES_PLATFORM_IMPORT __declspec(dllimport)
-#define DLL_EXPORT
+#  define XERCES_PLATFORM_EXPORT __declspec(dllexport)
+#  define XERCES_PLATFORM_IMPORT __declspec(dllimport)
+#  define DLL_EXPORT
 #endif
 
 #define XERCES_MFC_SUPPORT
 
-#define XERCES_HAVE_INTRIN_H 1
-#define XERCES_HAVE_EMMINTRIN_H 1
-#define XERCES_HAVE_CPUID_INTRINSIC
-#define XERCES_HAVE_SSE2_INTRINSIC
+#if (_MSC_VER &gt;= 1400)
+#  define XERCES_HAVE_INTRIN_H 1
+#  define XERCES_HAVE_EMMINTRIN_H 1
+#  define XERCES_HAVE_CPUID_INTRINSIC
+#  define XERCES_HAVE_SSE2_INTRINSIC
+#endif
 
 // ---------------------------------------------------------------------------
 //  XMLSize_t is the unsigned integral type.
@@ -140,7 +142,7 @@
 //  Force on the Xerces debug token if it is on in the build environment
 // ---------------------------------------------------------------------------
 #if defined(_DEBUG)
-#define XERCES_DEBUG
+#  define XERCES_DEBUG
 #endif
 
 #endif



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



</pre>
</div>
</content>
</entry>
</feed>
