Author: sandygao
Date: Tue Aug 18 21:13:20 2009
New Revision: 805582

URL: http://svn.apache.org/viewvc?rev=805582&view=rev
Log:
Allow substitution of the schema dv factory, which is responsible for creating 
new simple type definitions.

Modified:
    xerces/java/trunk/src/org/apache/xerces/dom/AttrNSImpl.java
    xerces/java/trunk/src/org/apache/xerces/dom/DOMConfigurationImpl.java
    xerces/java/trunk/src/org/apache/xerces/dom/ElementNSImpl.java
    xerces/java/trunk/src/org/apache/xerces/impl/Constants.java
    xerces/java/trunk/src/org/apache/xerces/impl/dv/xs/BaseSchemaDVFactory.java
    xerces/java/trunk/src/org/apache/xerces/impl/dv/xs/XSSimpleTypeDecl.java
    xerces/java/trunk/src/org/apache/xerces/impl/xs/XMLSchemaLoader.java
    xerces/java/trunk/src/org/apache/xerces/impl/xs/XMLSchemaValidator.java
    xerces/java/trunk/src/org/apache/xerces/impl/xs/XSDeclarationPool.java
    
xerces/java/trunk/src/org/apache/xerces/impl/xs/traversers/XSDComplexTypeTraverser.java
    xerces/java/trunk/src/org/apache/xerces/impl/xs/traversers/XSDHandler.java
    
xerces/java/trunk/src/org/apache/xerces/impl/xs/traversers/XSDSimpleTypeTraverser.java
    
xerces/java/trunk/src/org/apache/xerces/parsers/StandardParserConfiguration.java
    xerces/java/trunk/src/org/apache/xerces/parsers/XML11Configuration.java

Modified: xerces/java/trunk/src/org/apache/xerces/dom/AttrNSImpl.java
URL: 
http://svn.apache.org/viewvc/xerces/java/trunk/src/org/apache/xerces/dom/AttrNSImpl.java?rev=805582&r1=805581&r2=805582&view=diff
==============================================================================
--- xerces/java/trunk/src/org/apache/xerces/dom/AttrNSImpl.java (original)
+++ xerces/java/trunk/src/org/apache/xerces/dom/AttrNSImpl.java Tue Aug 18 
21:13:20 2009
@@ -325,7 +325,7 @@
                                  String typeNameArg, 
                                  int derivationMethod) {
         if (type != null) {
-            if (type instanceof XSSimpleTypeDefinition) {
+            if (type instanceof XSSimpleTypeDecl) {
                 return ((XSSimpleTypeDecl) type).isDOMDerivedFrom(
                         typeNamespaceArg, typeNameArg, derivationMethod);
             }    

Modified: xerces/java/trunk/src/org/apache/xerces/dom/DOMConfigurationImpl.java
URL: 
http://svn.apache.org/viewvc/xerces/java/trunk/src/org/apache/xerces/dom/DOMConfigurationImpl.java?rev=805582&r1=805581&r2=805582&view=diff
==============================================================================
--- xerces/java/trunk/src/org/apache/xerces/dom/DOMConfigurationImpl.java 
(original)
+++ xerces/java/trunk/src/org/apache/xerces/dom/DOMConfigurationImpl.java Tue 
Aug 18 21:13:20 2009
@@ -196,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
     //
@@ -348,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/trunk/src/org/apache/xerces/dom/ElementNSImpl.java
URL: 
http://svn.apache.org/viewvc/xerces/java/trunk/src/org/apache/xerces/dom/ElementNSImpl.java?rev=805582&r1=805581&r2=805582&view=diff
==============================================================================
--- xerces/java/trunk/src/org/apache/xerces/dom/ElementNSImpl.java (original)
+++ xerces/java/trunk/src/org/apache/xerces/dom/ElementNSImpl.java Tue Aug 18 
21:13:20 2009
@@ -349,9 +349,9 @@
      */
     public String getTypeName() {
         if (type !=null){
-            if (type instanceof XSSimpleTypeDefinition) {
+            if (type instanceof XSSimpleTypeDecl) {
                 return ((XSSimpleTypeDecl) type).getTypeName();
-            } else {
+            } else if (type instanceof XSComplexTypeDecl) {
                 return ((XSComplexTypeDecl) type).getTypeName();
             }
         }
@@ -389,10 +389,10 @@
             synchronizeData();
         }
         if (type != null) {
-            if (type instanceof XSSimpleTypeDefinition) {
+            if (type instanceof XSSimpleTypeDecl) {
                 return ((XSSimpleTypeDecl) type).isDOMDerivedFrom(
                         typeNamespaceArg, typeNameArg, derivationMethod);
-            } else {
+            } else if (type instanceof XSComplexTypeDecl) {
                 return ((XSComplexTypeDecl) type).isDOMDerivedFrom(
                         typeNamespaceArg, typeNameArg, derivationMethod);
             }

Modified: xerces/java/trunk/src/org/apache/xerces/impl/Constants.java
URL: 
http://svn.apache.org/viewvc/xerces/java/trunk/src/org/apache/xerces/impl/Constants.java?rev=805582&r1=805581&r2=805582&view=diff
==============================================================================
--- xerces/java/trunk/src/org/apache/xerces/impl/Constants.java (original)
+++ xerces/java/trunk/src/org/apache/xerces/impl/Constants.java Tue Aug 18 
21:13:20 2009
@@ -425,6 +425,9 @@
     /** 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";
+    
     // general constants
     
     /** Element PSVI is stored in augmentations using string "ELEMENT_PSVI" */
@@ -546,6 +549,7 @@
             LOCALE_PROPERTY,
             ROOT_TYPE_DEFINITION_PROPERTY,
             ROOT_ELEMENT_DECLARATION_PROPERTY,
+            SCHEMA_DV_FACTORY_PROPERTY,
     };
     
     /** Empty enumeration. */

Modified: 
xerces/java/trunk/src/org/apache/xerces/impl/dv/xs/BaseSchemaDVFactory.java
URL: 
http://svn.apache.org/viewvc/xerces/java/trunk/src/org/apache/xerces/impl/dv/xs/BaseSchemaDVFactory.java?rev=805582&r1=805581&r2=805582&view=diff
==============================================================================
--- xerces/java/trunk/src/org/apache/xerces/impl/dv/xs/BaseSchemaDVFactory.java 
(original)
+++ xerces/java/trunk/src/org/apache/xerces/impl/dv/xs/BaseSchemaDVFactory.java 
Tue Aug 18 21:13:20 2009
@@ -318,4 +318,8 @@
         fDeclPool = declPool;
     }
 
+    /** Implementation internal **/
+    public XSSimpleTypeDecl newXSSimpleTypeDecl() {
+        return new XSSimpleTypeDecl();
+    }
 } //BaseSchemaDVFactory

Modified: 
xerces/java/trunk/src/org/apache/xerces/impl/dv/xs/XSSimpleTypeDecl.java
URL: 
http://svn.apache.org/viewvc/xerces/java/trunk/src/org/apache/xerces/impl/dv/xs/XSSimpleTypeDecl.java?rev=805582&r1=805581&r2=805582&view=diff
==============================================================================
--- xerces/java/trunk/src/org/apache/xerces/impl/dv/xs/XSSimpleTypeDecl.java 
(original)
+++ xerces/java/trunk/src/org/apache/xerces/impl/dv/xs/XSSimpleTypeDecl.java 
Tue Aug 18 21:13:20 2009
@@ -60,39 +60,39 @@
  */
 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;
+    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;
 
-    static final TypeValidator[] fDVs = {
+    private static final TypeValidator[] gDVs = {
         new AnySimpleDV(),
         new StringDV(),
         new BooleanDV(),
@@ -227,6 +227,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).
@@ -839,6 +847,18 @@
             }
         }
 
+        // whiteSpace
+        if ((presentFacet & FACET_WHITESPACE) != 0) {
+            if ((allowedFacet & FACET_WHITESPACE) == 0) {
+                reportError("cos-applicable-facets", new 
Object[]{"whiteSpace", fTypeName});
+            } else {
+                fWhiteSpace = facets.whiteSpace;
+                whiteSpaceAnnotation = facets.whiteSpaceAnnotation;
+                fFacetsDefined |= FACET_WHITESPACE;
+                if ((fixedFacet & FACET_WHITESPACE) != 0)
+                    fFixedFacet |= FACET_WHITESPACE;
+            }
+        }
         // enumeration
         if ((presentFacet & FACET_ENUMERATION) != 0) {
             if ((allowedFacet & FACET_ENUMERATION) == 0) {
@@ -855,7 +875,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;
@@ -869,18 +889,6 @@
                     fFixedFacet |= FACET_ENUMERATION;
             }
         }
-        // whiteSpace
-        if ((presentFacet & FACET_WHITESPACE) != 0) {
-            if ((allowedFacet & FACET_WHITESPACE) == 0) {
-                reportError("cos-applicable-facets", new 
Object[]{"whiteSpace", fTypeName});
-            } else {
-                fWhiteSpace = facets.whiteSpace;
-                whiteSpaceAnnotation = facets.whiteSpaceAnnotation;
-                fFacetsDefined |= FACET_WHITESPACE;
-                if ((fixedFacet & FACET_WHITESPACE) != 0)
-                    fFixedFacet |= FACET_WHITESPACE;
-            }
-        }
 
         // maxInclusive
         if ((presentFacet & FACET_MAXINCLUSIVE) != 0) {
@@ -1541,6 +1549,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/trunk/src/org/apache/xerces/impl/xs/XMLSchemaLoader.java
URL: 
http://svn.apache.org/viewvc/xerces/java/trunk/src/org/apache/xerces/impl/xs/XMLSchemaLoader.java?rev=805582&r1=805581&r2=805582&view=diff
==============================================================================
--- xerces/java/trunk/src/org/apache/xerces/impl/xs/XMLSchemaLoader.java 
(original)
+++ xerces/java/trunk/src/org/apache/xerces/impl/xs/XMLSchemaLoader.java Tue 
Aug 18 21:13:20 2009
@@ -37,7 +37,10 @@
 import org.apache.xerces.impl.Constants;
 import org.apache.xerces.impl.XMLEntityManager;
 import org.apache.xerces.impl.XMLErrorReporter;
+import org.apache.xerces.impl.dv.DVFactoryException;
 import org.apache.xerces.impl.dv.InvalidDatatypeValueException;
+import org.apache.xerces.impl.dv.SchemaDVFactory;
+import org.apache.xerces.impl.dv.xs.SchemaDVFactoryImpl;
 import org.apache.xerces.impl.xs.models.CMBuilder;
 import org.apache.xerces.impl.xs.models.CMNodeFactory;
 import org.apache.xerces.impl.xs.traversers.XSDHandler;
@@ -142,6 +145,10 @@
     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 = {
         SCHEMA_FULL_CHECKING,
@@ -213,7 +220,8 @@
         SCHEMA_NONS_LOCATION,
         JAXP_SCHEMA_SOURCE,
         SECURITY_MANAGER,
-        LOCALE
+        LOCALE,
+        SCHEMA_DV_FACTORY
     };
     
     // Data
@@ -975,10 +983,25 @@
             psvi = false;
         }
         
+        // Determine schema dv factory to use
+        SchemaDVFactory dvFactory = null;
+        try {
+            dvFactory = 
(SchemaDVFactory)componentManager.getProperty(SCHEMA_DV_FACTORY);
+        } catch (XMLConfigurationException e) {
+        }
+        if (dvFactory == null) {
+            dvFactory = SchemaDVFactory.getInstance();
+        }
+        fSchemaHandler.setDVFactory(dvFactory);
+
         if (!psvi) {
             fDeclPool.reset();
             fCMBuilder.setDeclPool(fDeclPool);
             fSchemaHandler.setDeclPool(fDeclPool);
+            if (dvFactory instanceof SchemaDVFactoryImpl) {
+                fDeclPool.setDVFactory((SchemaDVFactoryImpl)dvFactory);
+                ((SchemaDVFactoryImpl)dvFactory).setDeclPool(fDeclPool);
+            }
         } else {
             fCMBuilder.setDeclPool(null);
             fSchemaHandler.setDeclPool(null);
@@ -1168,7 +1191,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;

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=805582&r1=805581&r2=805582&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 
Aug 18 21:13:20 2009
@@ -248,6 +248,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;
+    
     // recognized features and properties
 
     /** Recognized features. */
@@ -316,11 +320,12 @@
             JAXP_SCHEMA_LANGUAGE,
             ROOT_TYPE_DEF,
             ROOT_ELEMENT_DECL,
+            SCHEMA_DV_FACTORY,
         };
 
     /** 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};
 
     // this is the number of valuestores of each kind
     // we expect an element to have.  It's almost

Modified: xerces/java/trunk/src/org/apache/xerces/impl/xs/XSDeclarationPool.java
URL: 
http://svn.apache.org/viewvc/xerces/java/trunk/src/org/apache/xerces/impl/xs/XSDeclarationPool.java?rev=805582&r1=805581&r2=805582&view=diff
==============================================================================
--- xerces/java/trunk/src/org/apache/xerces/impl/xs/XSDeclarationPool.java 
(original)
+++ xerces/java/trunk/src/org/apache/xerces/impl/xs/XSDeclarationPool.java Tue 
Aug 18 21:13:20 2009
@@ -17,6 +17,7 @@
 
 package org.apache.xerces.impl.xs;
 
+import org.apache.xerces.impl.dv.xs.SchemaDVFactoryImpl;
 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 SchemaDVFactoryImpl dvFactory;
+    public void setDVFactory(SchemaDVFactoryImpl dvFactory) {
+        this.dvFactory = dvFactory;
+    }
 
     public final  XSElementDecl getElementDecl(){
         int     chunk       = fElementDeclIndex >> CHUNK_SHIFT;
@@ -132,7 +138,7 @@
         int     index       = fSTDeclIndex &  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/trunk/src/org/apache/xerces/impl/xs/traversers/XSDComplexTypeTraverser.java
URL: 
http://svn.apache.org/viewvc/xerces/java/trunk/src/org/apache/xerces/impl/xs/traversers/XSDComplexTypeTraverser.java?rev=805582&r1=805581&r2=805582&view=diff
==============================================================================
--- 
xerces/java/trunk/src/org/apache/xerces/impl/xs/traversers/XSDComplexTypeTraverser.java
 (original)
+++ 
xerces/java/trunk/src/org/apache/xerces/impl/xs/traversers/XSDComplexTypeTraverser.java
 Tue Aug 18 21:13:20 2009
@@ -124,8 +124,6 @@
     
     private static final boolean DEBUG=false;
     
-    private SchemaDVFactory schemaFactory = SchemaDVFactory.getInstance();
-    
     private static final class ComplexTypeRecoverableError extends Exception {
         
         private static final long serialVersionUID = 6802729912091130335L;
@@ -577,14 +575,14 @@
             }
             
             String name = genAnonTypeName(simpleContentElement);
-            fXSSimpleType = 
schemaFactory.createTypeRestriction(name,schemaDoc.fTargetNamespace,(short)0,baseValidator,null);
+            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){
                 reportSchemaError(ex.getKey(), ex.getArgs(), simpleContent);
                 // Recreate the type, ignoring the facets
-                fXSSimpleType = 
schemaFactory.createTypeRestriction(name,schemaDoc.fTargetNamespace,(short)0,baseValidator,null);
+                fXSSimpleType = 
fSchemaHandler.fDVFactory.createTypeRestriction(name,schemaDoc.fTargetNamespace,(short)0,baseValidator,null);
             }
             if (fXSSimpleType instanceof XSSimpleTypeDecl) {
                 ((XSSimpleTypeDecl)fXSSimpleType).setAnonymous(true);

Modified: 
xerces/java/trunk/src/org/apache/xerces/impl/xs/traversers/XSDHandler.java
URL: 
http://svn.apache.org/viewvc/xerces/java/trunk/src/org/apache/xerces/impl/xs/traversers/XSDHandler.java?rev=805582&r1=805581&r2=805582&view=diff
==============================================================================
--- xerces/java/trunk/src/org/apache/xerces/impl/xs/traversers/XSDHandler.java 
(original)
+++ xerces/java/trunk/src/org/apache/xerces/impl/xs/traversers/XSDHandler.java 
Tue Aug 18 21:13:20 2009
@@ -33,6 +33,7 @@
 import org.apache.xerces.impl.Constants;
 import org.apache.xerces.impl.XMLEntityManager;
 import org.apache.xerces.impl.XMLErrorReporter;
+import org.apache.xerces.impl.dv.SchemaDVFactory;
 import org.apache.xerces.impl.dv.xs.XSSimpleTypeDecl;
 import org.apache.xerces.impl.xs.SchemaGrammar;
 import org.apache.xerces.impl.xs.SchemaNamespaceSupport;
@@ -86,7 +87,6 @@
 import org.apache.xerces.xs.XSAttributeDeclaration;
 import org.apache.xerces.xs.XSAttributeGroupDefinition;
 import org.apache.xerces.xs.XSAttributeUse;
-import org.apache.xerces.xs.XSComplexTypeDefinition;
 import org.apache.xerces.xs.XSConstants;
 import org.apache.xerces.xs.XSElementDeclaration;
 import org.apache.xerces.xs.XSModelGroup;
@@ -392,6 +392,7 @@
     XSDUniqueOrKeyTraverser fUniqueOrKeyTraverser;
     XSDWildcardTraverser fWildCardTraverser;
     
+    SchemaDVFactory fDVFactory;
     SchemaDOMParser fSchemaParser;
     SchemaContentHandler fXSContentHandler;
     StAXSchemaParser fStAXSchemaParser;
@@ -1633,7 +1634,8 @@
                 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
@@ -3398,6 +3400,9 @@
     public void setDeclPool (XSDeclarationPool declPool){
         fDeclPool = declPool;
     }
+    public void setDVFactory(SchemaDVFactory dvFactory){
+        fDVFactory = dvFactory;
+    }
     
     public void reset(XMLComponentManager componentManager) {
         

Modified: 
xerces/java/trunk/src/org/apache/xerces/impl/xs/traversers/XSDSimpleTypeTraverser.java
URL: 
http://svn.apache.org/viewvc/xerces/java/trunk/src/org/apache/xerces/impl/xs/traversers/XSDSimpleTypeTraverser.java?rev=805582&r1=805581&r2=805582&view=diff
==============================================================================
--- 
xerces/java/trunk/src/org/apache/xerces/impl/xs/traversers/XSDSimpleTypeTraverser.java
 (original)
+++ 
xerces/java/trunk/src/org/apache/xerces/impl/xs/traversers/XSDSimpleTypeTraverser.java
 Tue Aug 18 21:13:20 2009
@@ -79,18 +79,12 @@
  */
 class XSDSimpleTypeTraverser extends XSDAbstractTraverser {
     
-    // the factory used to query/create simple types
-    private final SchemaDVFactory schemaFactory = 
SchemaDVFactory.getInstance();
-    
     // whether the type being parsed is a S4S built-in type.
     private boolean fIsBuiltIn = false;
     
     XSDSimpleTypeTraverser (XSDHandler handler,
             XSAttributeChecker gAttrCheck) {
         super(handler, gAttrCheck);
-        if (schemaFactory instanceof SchemaDVFactoryImpl) {
-            
((SchemaDVFactoryImpl)schemaFactory).setDeclPool(handler.fDeclPool);
-        }
     }
     
     //return qualified name of simpleType or empty string if error occured
@@ -381,16 +375,16 @@
         // 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
@@ -404,7 +398,7 @@
             } catch (InvalidDatatypeFacetException ex) {
                 reportSchemaError(ex.getKey(), ex.getArgs(), child);
                 // Recreate the type, ignoring the facets
-                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));
             }
         }
@@ -505,13 +499,13 @@
         XSSimpleType stringType = 
(XSSimpleType)SchemaGrammar.SG_SchemaNS.getTypeDefinition("string");
         switch (refType) {
         case XSConstants.DERIVATION_RESTRICTION:
-            return schemaFactory.createTypeRestriction(name, namespace, 
(short)0,
+            return fSchemaHandler.fDVFactory.createTypeRestriction(name, 
namespace, (short)0,
                     stringType, null);
         case XSConstants.DERIVATION_LIST:
-            return schemaFactory.createTypeList(name, namespace, (short)0,
+            return fSchemaHandler.fDVFactory.createTypeList(name, namespace, 
(short)0,
                     stringType, null);
         case XSConstants.DERIVATION_UNION:
-            return schemaFactory.createTypeUnion(name, namespace, (short)0,
+            return fSchemaHandler.fDVFactory.createTypeUnion(name, namespace, 
(short)0,
                     new XSSimpleType[]{stringType}, null);
         }
         

Modified: 
xerces/java/trunk/src/org/apache/xerces/parsers/StandardParserConfiguration.java
URL: 
http://svn.apache.org/viewvc/xerces/java/trunk/src/org/apache/xerces/parsers/StandardParserConfiguration.java?rev=805582&r1=805581&r2=805582&view=diff
==============================================================================
--- 
xerces/java/trunk/src/org/apache/xerces/parsers/StandardParserConfiguration.java
 (original)
+++ 
xerces/java/trunk/src/org/apache/xerces/parsers/StandardParserConfiguration.java
 Tue Aug 18 21:13:20 2009
@@ -150,6 +150,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
     //
@@ -259,6 +263,7 @@
             SCHEMA_NONS_LOCATION,
             ROOT_TYPE_DEF,
             ROOT_ELEMENT_DECL,
+            SCHEMA_DV_FACTORY,
         };
         
         addRecognizedProperties(recognizedProperties);

Modified: 
xerces/java/trunk/src/org/apache/xerces/parsers/XML11Configuration.java
URL: 
http://svn.apache.org/viewvc/xerces/java/trunk/src/org/apache/xerces/parsers/XML11Configuration.java?rev=805582&r1=805581&r2=805582&view=diff
==============================================================================
--- xerces/java/trunk/src/org/apache/xerces/parsers/XML11Configuration.java 
(original)
+++ xerces/java/trunk/src/org/apache/xerces/parsers/XML11Configuration.java Tue 
Aug 18 21:13:20 2009
@@ -287,6 +287,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. */
@@ -552,6 +556,7 @@
                 LOCALE,
                 ROOT_TYPE_DEF,
                 ROOT_ELEMENT_DECL,
+                SCHEMA_DV_FACTORY,
         };
         addRecognizedProperties(recognizedProperties);
                



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to