You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xerces.apache.org by kn...@apache.org on 2008/09/29 23:18:29 UTC
svn commit: r700258 - in
/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs: ./
models/ traversers/
Author: knoaman
Date: Mon Sep 29 14:18:28 2008
New Revision: 700258
URL: http://svn.apache.org/viewvc?rev=700258&view=rev
Log:
Refactor XSConstraints to allow XML Schema 1.0 vs. 1.1 constraint checking
Added:
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/XS10Constraints.java (with props)
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/XS11Constraints.java (with props)
Modified:
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/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/XSDAttributeGroupTraverser.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/XSDHandler.java
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=700258&r1=700257&r2=700258&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 Mon Sep 29 14:18:28 2008
@@ -246,6 +246,9 @@
/** XML Schema 1.1 flag */
private short fSchemaVersion = Constants.SCHEMA_VERSION_1_0;
+
+ /** XML Schema Constraints checker */
+ private XSConstraints fXSConstraints = XSConstraints.XS_1_0_CONSTRAINTS;
// default constructor. Create objects we absolutely need:
public XMLSchemaLoader() {
@@ -321,7 +324,7 @@
builder = new CMBuilder(nodeFactory);
}
fCMBuilder = builder;
- fSchemaHandler = new XSDHandler(fGrammarBucket);
+ fSchemaHandler = new XSDHandler(fGrammarBucket, fSchemaVersion, fXSConstraints);
fDeclPool = new XSDeclarationPool();
fJAXPCache = new WeakHashMap();
@@ -485,11 +488,13 @@
void setSchemaVersion(String version) {
if (version.equals(Constants.W3C_XML_SCHEMA11_NS_URI)) {
fSchemaVersion = Constants.SCHEMA_VERSION_1_1;
+ fXSConstraints = XSConstraints.XS_1_1_CONSTRAINTS;
}
else {
fSchemaVersion = Constants.SCHEMA_VERSION_1_0;
+ fXSConstraints = XSConstraints.XS_1_0_CONSTRAINTS;
}
- fSchemaHandler.setSchemaVersion(fSchemaVersion);
+ fSchemaHandler.setSchemaVersionInfo(fSchemaVersion, fXSConstraints);
fCMBuilder.setSchemaVersion(fSchemaVersion);
}
@@ -501,6 +506,13 @@
}
/**
+ * Return XML Schema Constraints
+ */
+ XSConstraints getXSConstraints() {
+ return fXSConstraints;
+ }
+
+ /**
* Returns a Grammar object by parsing the contents of the
* entities pointed to by sources.
*
@@ -555,7 +567,7 @@
// NOTE: we only need to verify full checking in case the schema was not provided via JAXP
// since full checking already verified for all JAXP schemas
if(fIsCheckedFully && fJAXPCache.get(grammar) != grammar) {
- XSConstraints.fullSchemaChecking(fGrammarBucket, fSubGroupHandler, fCMBuilder, fErrorReporter);
+ fXSConstraints.fullSchemaChecking(fGrammarBucket, fSubGroupHandler, fCMBuilder, fErrorReporter);
}
}
return grammar;
@@ -750,7 +762,7 @@
fJAXPSource instanceof InputSource) {
fJAXPCache.put(fJAXPSource, g);
if (fIsCheckedFully) {
- XSConstraints.fullSchemaChecking(fGrammarBucket, fSubGroupHandler, fCMBuilder, fErrorReporter);
+ fXSConstraints.fullSchemaChecking(fGrammarBucket, fSubGroupHandler, fCMBuilder, fErrorReporter);
}
}
fGrammarBucket.putGrammar(g);
@@ -804,7 +816,7 @@
SchemaGrammar grammar = fSchemaHandler.parseSchema(xis,fXSDDescription, locationPairs);
if (fIsCheckedFully) {
- XSConstraints.fullSchemaChecking(fGrammarBucket, fSubGroupHandler, fCMBuilder, fErrorReporter);
+ fXSConstraints.fullSchemaChecking(fGrammarBucket, fSubGroupHandler, fCMBuilder, fErrorReporter);
}
if (grammar != null) {
targetNamespace = grammar.getTargetNamespace();
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=700258&r1=700257&r2=700258&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 Mon Sep 29 14:18:28 2008
@@ -500,7 +500,10 @@
protected final Hashtable fLocationPairs = new Hashtable();
/** XML Schema 1.1 Support */
- short fSchemaVersion = Constants.SCHEMA_VERSION_1_0;
+ short fSchemaVersion;
+
+ /** XML Schema Constraints */
+ XSConstraints fXSConstraints;
// handlers
@@ -569,8 +572,10 @@
fRootTypeQName = (javax.xml.namespace.QName)value;
}
else if (propertyId.equals(XML_SCHEMA_VERSION)) {
+ // TODO: do we use fSchemaLoader.setProperty
fSchemaLoader.setSchemaVersion((String)value);
fSchemaVersion = fSchemaLoader.getSchemaVersion();
+ fXSConstraints = fSchemaLoader.getXSConstraints();
}
} // setProperty(String,Object)
@@ -1274,6 +1279,8 @@
public XMLSchemaValidator() {
fState4XsiType.setExtraChecking(false);
fState4ApplyDefault.setFacetChecking(false);
+ fSchemaVersion = fSchemaLoader.getSchemaVersion();
+ fXSConstraints = fSchemaLoader.getXSConstraints();
} // <init>()
@@ -2260,7 +2267,7 @@
// check extra schema constraints on root element
if (fElementDepth == -1 && fFullChecking && !fUseGrammarPoolOnly) {
- XSConstraints.fullSchemaChecking(
+ fXSConstraints.fullSchemaChecking(
fGrammarBucket,
fSubGroupHandler,
fCMBuilder,
@@ -2357,7 +2364,7 @@
}
// check extra schema constraints
if (fFullChecking && !fUseGrammarPoolOnly) {
- XSConstraints.fullSchemaChecking(
+ fXSConstraints.fullSchemaChecking(
fGrammarBucket,
fSubGroupHandler,
fCMBuilder,
@@ -2654,7 +2661,7 @@
if (fCurrentType.getTypeCategory() == XSTypeDefinition.COMPLEX_TYPE) {
block |= ((XSComplexTypeDecl) fCurrentType).fBlock;
}
- if (!XSConstraints.checkTypeDerivationOk(type, fCurrentType, block)) {
+ if (!fXSConstraints.checkTypeDerivationOk(type, fCurrentType, block)) {
reportSchemaError(
"cvc-elt.4.3",
new Object[] { element.rawname, xsiType, fCurrentType.getName()});
@@ -3139,7 +3146,7 @@
// 5.1.1 If the actual type definition is a local type definition then the canonical lexical representation of the {value constraint} value must be a valid default for the actual type definition as defined in Element Default Valid (Immediate) (3.3.6).
if (fCurrentType != fCurrentElemDecl.fType) {
//REVISIT:we should pass ValidatedInfo here.
- if (XSConstraints
+ if (fXSConstraints
.ElementDefaultValidImmediate(
fCurrentType,
fCurrentElemDecl.fDefault.stringValue(),
Added: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/XS10Constraints.java
URL: http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/XS10Constraints.java?rev=700258&view=auto
==============================================================================
--- xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/XS10Constraints.java (added)
+++ xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/XS10Constraints.java Mon Sep 29 14:18:28 2008
@@ -0,0 +1,66 @@
+/*
+ * 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;
+
+/**
+ * XML Schema 1.0 constraints
+ *
+ * @xerces.internal
+ *
+ * @author Sandy Gao, IBM
+ * @author Khaled Noaman, IBM
+ *
+ * @version $Id:$
+ *
+ */
+class XS10Constraints extends XSConstraints {
+
+ public XS10Constraints() {
+ super(SchemaGrammar.fAnyType);
+ }
+
+ public boolean overlapUPA(XSElementDecl element,
+ XSWildcardDecl wildcard,
+ SubstitutionGroupHandler sgHandler) {
+ // if the wildcard allows the element
+ if (wildcard.allowNamespace(element.fTargetNamespace))
+ return true;
+
+ // or if the wildcard allows any element in the substitution group
+ XSElementDecl[] subGroup = sgHandler.getSubstitutionGroup(element);
+ for (int i = subGroup.length-1; i >= 0; i--) {
+ if (wildcard.allowNamespace(subGroup[i].fTargetNamespace))
+ return true;
+ }
+
+ return false;
+ }
+
+ public boolean overlapUPA(XSWildcardDecl wildcard1,
+ XSWildcardDecl wildcard2) {
+ // if the intersection of the two wildcard is not empty list
+ XSWildcardDecl intersect = wildcard1.performIntersectionWith(wildcard2, wildcard1.fProcessContents);
+ if (intersect == null ||
+ intersect.fType != XSWildcardDecl.NSCONSTRAINT_LIST ||
+ intersect.fNamespaceList.length != 0) {
+ return true;
+ }
+
+ return false;
+ }
+}
Propchange: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/XS10Constraints.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/XS10Constraints.java
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Added: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/XS11Constraints.java
URL: http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/XS11Constraints.java?rev=700258&view=auto
==============================================================================
--- xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/XS11Constraints.java (added)
+++ xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/XS11Constraints.java Mon Sep 29 14:18:28 2008
@@ -0,0 +1,54 @@
+/*
+ * 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;
+
+/**
+ * XML Schema 1.0 constraints
+ *
+ * @xerces.internal
+ *
+ * @author Khaled Noaman, IBM
+ *
+ * @version $Id:$
+ *
+ */
+class XS11Constraints extends XSConstraints {
+
+ public XS11Constraints() {
+ super(SchemaGrammar.fAnyType); // TODO: use 1.1 specific anyType
+ }
+
+ public boolean overlapUPA(XSElementDecl element,
+ XSWildcardDecl wildcard,
+ SubstitutionGroupHandler sgHandler) {
+ return false;
+ }
+
+ public boolean overlapUPA(XSWildcardDecl wildcard1,
+ XSWildcardDecl wildcard2) {
+ // if the intersection of the two wildcards is not any and
+ // and the {namespaces} of such intersection is not the empty set
+ XSWildcardDecl intersect = wildcard1.performIntersectionWith(wildcard2, wildcard1.fProcessContents);
+ if (intersect.fType != XSWildcardDecl.NSCONSTRAINT_ANY &&
+ intersect.fNamespaceList.length != 0) {
+ return true;
+ }
+
+ return false;
+ }
+}
Propchange: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/XS11Constraints.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/XS11Constraints.java
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
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=700258&r1=700257&r2=700258&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 Mon Sep 29 14:18:28 2008
@@ -142,7 +142,7 @@
* @param typeName the name of the type containing this attribute group, used for error reporting purposes
* @param baseGroup the XSAttributeGroupDecl that is the base we are checking against
*/
- public Object[] validRestrictionOf(String typeName, XSAttributeGroupDecl baseGroup) {
+ public Object[] validRestrictionOf(String typeName, XSAttributeGroupDecl baseGroup, XSConstraints xsConstraints) {
Object[] errorArgs = null;
XSAttributeUseImpl attrUse = null;
@@ -179,7 +179,7 @@
//
// derivation-ok-restriction. Constraint 2.1.1
//
- if (! XSConstraints.checkSimpleDerivationOk(attrDecl.fType,
+ if (! xsConstraints.checkSimpleDerivationOk(attrDecl.fType,
baseAttrDecl.fType,
baseAttrDecl.fType.getFinal()) ) {
errorArgs = new Object[]{typeName, attrDecl.fName, attrDecl.fType.getName(),
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=700258&r1=700257&r2=700258&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 Mon Sep 29 14:18:28 2008
@@ -43,7 +43,7 @@
*
* @version $Id$
*/
-public class XSConstraints {
+public abstract class XSConstraints {
// IHR: Visited on 2006-11-17
// Added a boolean return value to particleValidRestriction (it was a void function)
@@ -53,6 +53,11 @@
static final int OCCURRENCE_UNKNOWN = SchemaSymbols.OCCURRENCE_UNBOUNDED-1;
static final XSSimpleType STRING_TYPE = (XSSimpleType)SchemaGrammar.SG_SchemaNS.getGlobalTypeDecl(SchemaSymbols.ATTVAL_STRING);
+ static final XSConstraints XS_1_0_CONSTRAINTS = new XS10Constraints();
+ static final XSConstraints XS_1_1_CONSTRAINTS = new XS11Constraints();
+
+ private final XSComplexTypeDecl fAnyType;
+
private static final Comparator ELEMENT_PARTICLE_COMPARATOR = new Comparator() {
public int compare(Object o1, Object o2) {
@@ -87,18 +92,22 @@
}
};
+ protected XSConstraints(XSComplexTypeDecl anyType) {
+ fAnyType = anyType;
+ }
+
/**
* check whether derived is valid derived from base, given a subset
* of {restriction, extension}.B
*/
- public static boolean checkTypeDerivationOk(XSTypeDefinition derived, XSTypeDefinition base, short block) {
+ public boolean checkTypeDerivationOk(XSTypeDefinition derived, XSTypeDefinition base, short block) {
// if derived is anyType, then it's valid only if base is anyType too
- if (derived == SchemaGrammar.fAnyType)
+ if (derived == fAnyType)
return derived == base;
// if derived is anySimpleType, then it's valid only if the base
// is ur-type
if (derived == SchemaGrammar.fAnySimpleType) {
- return (base == SchemaGrammar.fAnyType ||
+ return (base == fAnyType ||
base == SchemaGrammar.fAnySimpleType);
}
@@ -108,7 +117,7 @@
if (base.getTypeCategory() == XSTypeDefinition.COMPLEX_TYPE) {
// if base is anyType, change base to anySimpleType,
// otherwise, not valid
- if (base == SchemaGrammar.fAnyType)
+ if (base == fAnyType)
base = SchemaGrammar.fAnySimpleType;
else
return false;
@@ -125,11 +134,11 @@
* check whether simple type derived is valid derived from base,
* given a subset of {restriction, extension}.
*/
- public static boolean checkSimpleDerivationOk(XSSimpleType derived, XSTypeDefinition base, short block) {
+ public boolean checkSimpleDerivationOk(XSSimpleType derived, XSTypeDefinition base, short block) {
// if derived is anySimpleType, then it's valid only if the base
// is ur-type
if (derived == SchemaGrammar.fAnySimpleType) {
- return (base == SchemaGrammar.fAnyType ||
+ return (base == fAnyType ||
base == SchemaGrammar.fAnySimpleType);
}
@@ -137,7 +146,7 @@
if (base.getTypeCategory() == XSTypeDefinition.COMPLEX_TYPE) {
// if base is anyType, change base to anySimpleType,
// otherwise, not valid
- if (base == SchemaGrammar.fAnyType)
+ if (base == fAnyType)
base = SchemaGrammar.fAnySimpleType;
else
return false;
@@ -150,9 +159,9 @@
* check whether complex type derived is valid derived from base,
* given a subset of {restriction, extension}.
*/
- public static boolean checkComplexDerivationOk(XSComplexTypeDecl derived, XSTypeDefinition base, short block) {
+ public boolean checkComplexDerivationOk(XSComplexTypeDecl derived, XSTypeDefinition base, short block) {
// if derived is anyType, then it's valid only if base is anyType too
- if (derived == SchemaGrammar.fAnyType)
+ if (derived == fAnyType)
return derived == base;
return checkComplexDerivation((XSComplexTypeDecl)derived, base, block);
}
@@ -162,7 +171,7 @@
* anySimpleType, and base is not anyType. Another method will be
* introduced for public use, which will call this method.
*/
- private static boolean checkSimpleDerivation(XSSimpleType derived, XSSimpleType base, short block) {
+ private boolean checkSimpleDerivation(XSSimpleType derived, XSSimpleType base, short block) {
// 1 They are the same type definition.
if (derived == base)
return true;
@@ -212,7 +221,7 @@
* anyType. Another method will be introduced for public use,
* which will call this method.
*/
- private static boolean checkComplexDerivation(XSComplexTypeDecl derived, XSTypeDefinition base, short block) {
+ private boolean checkComplexDerivation(XSComplexTypeDecl derived, XSTypeDefinition base, short block) {
// 2.1 B and D must be the same type definition.
if (derived == base)
return true;
@@ -229,7 +238,7 @@
// 2.3 All of the following must be true:
// 2.3.1 D's {base type definition} must not be the ur-type definition.
- if (directBase == SchemaGrammar.fAnyType ||
+ if (directBase == fAnyType ||
directBase == SchemaGrammar.fAnySimpleType) {
return false;
}
@@ -245,7 +254,7 @@
if (base.getTypeCategory() == XSTypeDefinition.COMPLEX_TYPE) {
// if base is anyType, change base to anySimpleType,
// otherwise, not valid
- if (base == SchemaGrammar.fAnyType)
+ if (base == fAnyType)
base = SchemaGrammar.fAnySimpleType;
else
return false;
@@ -262,7 +271,7 @@
* returns the compiled form of the value
* The parameter value could be either a String or a ValidatedInfo object
*/
- public static Object ElementDefaultValidImmediate(XSTypeDefinition type, String value, ValidationContext context, ValidatedInfo vinfo) {
+ public Object ElementDefaultValidImmediate(XSTypeDefinition type, String value, ValidationContext context, ValidatedInfo vinfo) {
XSSimpleType dv = null;
@@ -313,7 +322,7 @@
return actualValue;
}
- static void reportSchemaError(XMLErrorReporter errorReporter,
+ void reportSchemaError(XMLErrorReporter errorReporter,
SimpleLocator loc,
String key, Object[] args) {
if (loc != null) {
@@ -332,7 +341,7 @@
* Unique Particle Attribution, Particle Derivation (Restriction),
* Element Declrations Consistent.
*/
- public static void fullSchemaChecking(XSGrammarBucket grammarBucket,
+ public void fullSchemaChecking(XSGrammarBucket grammarBucket,
SubstitutionGroupHandler SGHandler,
CMBuilder cmBuilder,
XMLErrorReporter errorReporter) {
@@ -425,7 +434,7 @@
// 2. Particle Derivation
if (types[j].fBaseType != null &&
- types[j].fBaseType != SchemaGrammar.fAnyType &&
+ types[j].fBaseType != fAnyType &&
types[j].fDerivedBy == XSConstants.DERIVATION_RESTRICTION &&
(types[j].fBaseType instanceof XSComplexTypeDecl)) {
@@ -466,7 +475,7 @@
further = false;
if (cm != null) {
try {
- further = cm.checkUniqueParticleAttribution(SGHandler);
+ further = cm.checkUniqueParticleAttribution(SGHandler, this);
} catch (XMLSchemaException e) {
reportSchemaError(errorReporter, ctLocators[j],
e.getKey(),
@@ -505,7 +514,7 @@
Check that a given particle is a valid restriction of a base particle.
*/
- public static void checkElementDeclsConsistent(XSComplexTypeDecl type,
+ public void checkElementDeclsConsistent(XSComplexTypeDecl type,
XSParticleDecl particle,
SymbolHash elemDeclHash,
SubstitutionGroupHandler sgHandler)
@@ -537,7 +546,7 @@
checkElementDeclsConsistent(type, group.fParticles[i], elemDeclHash, sgHandler);
}
- public static void findElemInTable(XSComplexTypeDecl type, XSElementDecl elem,
+ public void findElemInTable(XSComplexTypeDecl type, XSElementDecl elem,
SymbolHash elemDeclHash)
throws XMLSchemaException {
@@ -570,7 +579,7 @@
// in the bParticle.
// With this information the checkRecurseLax function knows when is
// to keep the order and when to ignore it.
- private static boolean particleValidRestriction(XSParticleDecl dParticle,
+ private boolean particleValidRestriction(XSParticleDecl dParticle,
SubstitutionGroupHandler dSGHandler,
XSParticleDecl bParticle,
SubstitutionGroupHandler bSGHandler)
@@ -578,7 +587,7 @@
return particleValidRestriction(dParticle, dSGHandler, bParticle, bSGHandler, true);
}
- private static boolean particleValidRestriction(XSParticleDecl dParticle,
+ private boolean particleValidRestriction(XSParticleDecl dParticle,
SubstitutionGroupHandler dSGHandler,
XSParticleDecl bParticle,
SubstitutionGroupHandler bSGHandler,
@@ -963,7 +972,7 @@
return bExpansionHappened;
}
- private static void addElementToParticleVector (Vector v, XSElementDecl d) {
+ private void addElementToParticleVector (Vector v, XSElementDecl d) {
XSParticleDecl p = new XSParticleDecl();
p.fValue = d;
@@ -972,7 +981,7 @@
}
- private static XSParticleDecl getNonUnaryGroup(XSParticleDecl p) {
+ private XSParticleDecl getNonUnaryGroup(XSParticleDecl p) {
if (p.fType == XSParticleDecl.PARTICLE_ELEMENT ||
p.fType == XSParticleDecl.PARTICLE_WILDCARD)
@@ -1029,7 +1038,7 @@
}
- private static void checkNameAndTypeOK(XSElementDecl dElement, int dMin, int dMax,
+ private void checkNameAndTypeOK(XSElementDecl dElement, int dMin, int dMax,
XSElementDecl bElement, int bMin, int bMax)
throws XMLSchemaException {
@@ -1120,7 +1129,7 @@
}
- private static void checkIDConstraintRestriction(XSElementDecl derivedElemDecl,
+ private void checkIDConstraintRestriction(XSElementDecl derivedElemDecl,
XSElementDecl baseElemDecl)
throws XMLSchemaException {
// TODO
@@ -1188,7 +1197,7 @@
}
- private static void checkNSRecurseCheckCardinality(Vector children, int min1, int max1,
+ private void checkNSRecurseCheckCardinality(Vector children, int min1, int max1,
SubstitutionGroupHandler dSGHandler,
XSParticleDecl wildcard, int min2, int max2,
boolean checkWCOccurrence)
@@ -1221,7 +1230,7 @@
}
- private static void checkRecurse(Vector dChildren, int min1, int max1,
+ private void checkRecurse(Vector dChildren, int min1, int max1,
SubstitutionGroupHandler dSGHandler,
Vector bChildren, int min2, int max2,
SubstitutionGroupHandler bSGHandler)
@@ -1268,7 +1277,7 @@
}
- private static void checkRecurseUnordered(Vector dChildren, int min1, int max1,
+ private void checkRecurseUnordered(Vector dChildren, int min1, int max1,
SubstitutionGroupHandler dSGHandler,
Vector bChildren, int min2, int max2,
SubstitutionGroupHandler bSGHandler)
@@ -1320,7 +1329,7 @@
}
- private static void checkRecurseLax(Vector dChildren, int min1, int max1,
+ private void checkRecurseLax(Vector dChildren, int min1, int max1,
SubstitutionGroupHandler dSGHandler,
Vector bChildren, int min2, int max2,
SubstitutionGroupHandler bSGHandler)
@@ -1362,7 +1371,7 @@
}
- private static void checkMapAndSum(Vector dChildren, int min1, int max1,
+ private void checkMapAndSum(Vector dChildren, int min1, int max1,
SubstitutionGroupHandler dSGHandler,
Vector bChildren, int min2, int max2,
SubstitutionGroupHandler bSGHandler)
@@ -1411,7 +1420,7 @@
}
}
// to check whether two element overlap, as defined in constraint UPA
- public static boolean overlapUPA(XSElementDecl element1,
+ public boolean overlapUPA(XSElementDecl element1,
XSElementDecl element2,
SubstitutionGroupHandler sgHandler) {
// if the two element have the same name and namespace,
@@ -1443,40 +1452,8 @@
return false;
}
- // to check whether an element overlaps with a wildcard,
- // as defined in constraint UPA
- public static boolean overlapUPA(XSElementDecl element,
- XSWildcardDecl wildcard,
- SubstitutionGroupHandler sgHandler) {
- // if the wildcard allows the element
- if (wildcard.allowNamespace(element.fTargetNamespace))
- return true;
-
- // or if the wildcard allows any element in the substitution group
- XSElementDecl[] subGroup = sgHandler.getSubstitutionGroup(element);
- for (int i = subGroup.length-1; i >= 0; i--) {
- if (wildcard.allowNamespace(subGroup[i].fTargetNamespace))
- return true;
- }
-
- return false;
- }
-
- public static boolean overlapUPA(XSWildcardDecl wildcard1,
- XSWildcardDecl wildcard2) {
- // if the intersection of the two wildcard is not empty list
- XSWildcardDecl intersect = wildcard1.performIntersectionWith(wildcard2, wildcard1.fProcessContents);
- if (intersect == null ||
- intersect.fType != XSWildcardDecl.NSCONSTRAINT_LIST ||
- intersect.fNamespaceList.length != 0) {
- return true;
- }
-
- return false;
- }
-
// call one of the above methods according to the type of decls
- public static boolean overlapUPA(Object decl1, Object decl2,
+ public boolean overlapUPA(Object decl1, Object decl2,
SubstitutionGroupHandler sgHandler) {
if (decl1 instanceof XSElementDecl) {
if (decl2 instanceof XSElementDecl) {
@@ -1503,4 +1480,13 @@
}
}
+ // to check whether an element overlaps with a wildcard,
+ // as defined in constraint UPA
+ public abstract boolean overlapUPA(XSElementDecl element,
+ XSWildcardDecl wildcard,
+ SubstitutionGroupHandler sgHandler);
+
+ public abstract boolean overlapUPA(XSWildcardDecl wildcard1,
+ XSWildcardDecl wildcard2);
+
} // class XSContraints
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=700258&r1=700257&r2=700258&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 Mon Sep 29 14:18:28 2008
@@ -244,14 +244,14 @@
* check whether this content violates UPA constraint.
*
* @param subGroupHandler the substitution group handler
+ * @param xsConstraints the XML Schema Constraint checker
* @return true if this content model contains other or list wildcard
*/
- public boolean checkUniqueParticleAttribution(SubstitutionGroupHandler subGroupHandler) throws XMLSchemaException {
+ public boolean checkUniqueParticleAttribution(SubstitutionGroupHandler subGroupHandler, XSConstraints xsConstraints) throws XMLSchemaException {
// check whether there is conflict between any two leaves
for (int i = 0; i < fNumElements; i++) {
for (int j = i+1; j < fNumElements; j++) {
- // TODO: apply 1.1 rules
- if (XSConstraints.overlapUPA((XSElementDecl)fAllDecls[i], (XSElementDecl)fAllDecls[j], subGroupHandler)) {
+ if (xsConstraints.overlapUPA((XSElementDecl)fAllDecls[i], (XSElementDecl)fAllDecls[j], subGroupHandler)) {
// REVISIT: do we want to report all errors? or just one?
throw new XMLSchemaException("cos-nonambig", new Object[]{fAllDecls[i].toString(),
fAllDecls[j].toString()});
@@ -260,8 +260,7 @@
}
for (int i = fNumElements; i < fNumDecls; i++) {
for (int j = i+1; j < fNumDecls; j++) {
- // TODO: apply 1.1 rules
- if (XSConstraints.overlapUPA((XSWildcardDecl)fAllDecls[i], (XSWildcardDecl)fAllDecls[j])) {
+ if (xsConstraints.overlapUPA((XSWildcardDecl)fAllDecls[i], (XSWildcardDecl)fAllDecls[j])) {
// REVISIT: do we want to report all errors? or just one?
throw new XMLSchemaException("cos-nonambig", new Object[]{fAllDecls[i].toString(),
fAllDecls[j].toString()});
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=700258&r1=700257&r2=700258&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 Mon Sep 29 14:18:28 2008
@@ -176,13 +176,14 @@
* check whether this content violates UPA constraint.
*
* @param subGroupHandler the substitution group handler
+ * @param xsConstraints the XML Schema Constraint checker
* @return true if this content model contains other or list wildcard
*/
- public boolean checkUniqueParticleAttribution(SubstitutionGroupHandler subGroupHandler) throws XMLSchemaException {
+ public boolean checkUniqueParticleAttribution(SubstitutionGroupHandler subGroupHandler, XSConstraints xsConstraints) throws XMLSchemaException {
// check whether there is conflict between any two leaves
for (int i = 0; i < fNumElements; i++) {
for (int j = i+1; j < fNumElements; j++) {
- if (XSConstraints.overlapUPA(fAllElements[i], fAllElements[j], subGroupHandler)) {
+ if (xsConstraints.overlapUPA(fAllElements[i], fAllElements[j], subGroupHandler)) {
// REVISIT: do we want to report all errors? or just one?
throw new XMLSchemaException("cos-nonambig", new Object[]{fAllElements[i].toString(),
fAllElements[j].toString()});
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=700258&r1=700257&r2=700258&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 Mon Sep 29 14:18:28 2008
@@ -21,6 +21,7 @@
import org.apache.xerces.impl.xs.SubstitutionGroupHandler;
import org.apache.xerces.impl.xs.XMLSchemaException;
+import org.apache.xerces.impl.xs.XSConstraints;
import org.apache.xerces.xni.QName;
/**
@@ -74,9 +75,10 @@
* check whether this content violates UPA constraint.
*
* @param subGroupHandler the substitution group handler
+ * @param xsConstraints the XML Schema Constraint checker
* @return true if this content model contains other or list wildcard
*/
- public boolean checkUniqueParticleAttribution(SubstitutionGroupHandler subGroupHandler) throws XMLSchemaException;
+ public boolean checkUniqueParticleAttribution(SubstitutionGroupHandler subGroupHandler, XSConstraints xsConstraints) throws XMLSchemaException;
/**
* Check which elements are valid to appear at this point. This method also
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=700258&r1=700257&r2=700258&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 Mon Sep 29 14:18:28 2008
@@ -1121,9 +1121,10 @@
* check whether this content violates UPA constraint.
*
* @param subGroupHandler the substitution group handler
+ * @param xsConstraints the XML Schema Constraint checker
* @return true if this content model contains other or list wildcard
*/
- public boolean checkUniqueParticleAttribution(SubstitutionGroupHandler subGroupHandler) throws XMLSchemaException {
+ public boolean checkUniqueParticleAttribution(SubstitutionGroupHandler subGroupHandler, XSConstraints xsConstraints) throws XMLSchemaException {
// Unique Particle Attribution
// store the conflict results between any two elements in fElemMap
// 0: not compared; -1: no conflict; 1: conflict
@@ -1137,7 +1138,7 @@
if (fTransTable[i][j] != -1 &&
fTransTable[i][k] != -1) {
if (conflictTable[j][k] == 0) {
- if (XSConstraints.overlapUPA
+ if (xsConstraints.overlapUPA
(fElemMap[j], fElemMap[k],
subGroupHandler)) {
if (fCountingStates != null) {
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=700258&r1=700257&r2=700258&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 Mon Sep 29 14:18:28 2008
@@ -21,6 +21,7 @@
import org.apache.xerces.impl.xs.SubstitutionGroupHandler;
import org.apache.xerces.impl.xs.XMLSchemaException;
+import org.apache.xerces.impl.xs.XSConstraints;
import org.apache.xerces.xni.QName;
/**
@@ -111,9 +112,10 @@
* check whether this content violates UPA constraint.
*
* @param subGroupHandler the substitution group handler
+ * @param xsConstraints the XML Schema Constraint checker
* @return true if this content model contains other or list wildcard
*/
- public boolean checkUniqueParticleAttribution(SubstitutionGroupHandler subGroupHandler) throws XMLSchemaException {
+ public boolean checkUniqueParticleAttribution(SubstitutionGroupHandler subGroupHandler, XSConstraints xsConstraints) throws XMLSchemaException {
return false;
}
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=700258&r1=700257&r2=700258&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 Mon Sep 29 14:18:28 2008
@@ -156,7 +156,7 @@
new QName(XMLSymbols.EMPTY_STRING, nameAttr, nameAttr, schemaDoc.fTargetNamespace),
schemaDoc, elmNode);
if(redefinedAttrGrp != null) {
- Object[] errArgs = attrGrp.validRestrictionOf(nameAttr, redefinedAttrGrp);
+ Object[] errArgs = attrGrp.validRestrictionOf(nameAttr, redefinedAttrGrp, fSchemaHandler.fXSConstraints);
if (errArgs != null) {
reportSchemaError((String)errArgs[errArgs.length-1], errArgs, child);
reportSchemaError("src-redefine.7.2.2", new Object [] {nameAttr, errArgs[errArgs.length-1]}, 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=700258&r1=700257&r2=700258&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 Mon Sep 29 14:18:28 2008
@@ -578,7 +578,7 @@
//according to derivation-ok-restriction 5.1.2.1
if (baseValidator != null &&
- !XSConstraints.checkSimpleDerivationOk(dv, baseValidator,
+ !fSchemaHandler.fXSConstraints.checkSimpleDerivationOk(dv, baseValidator,
baseValidator.getFinal())) {
fAttrChecker.returnAttrArray(simpleContentAttrValues, schemaDoc);
fAttrChecker.returnAttrArray(derivationTypeAttrValues, schemaDoc);
@@ -659,7 +659,7 @@
// Prohibited uses must be removed after merge for RESTRICTION
fAttrGrp.removeProhibitedAttrs();
- Object[] errArgs=fAttrGrp.validRestrictionOf(fName, baseComplexType.getAttrGrp());
+ Object[] errArgs=fAttrGrp.validRestrictionOf(fName, baseComplexType.getAttrGrp(), fSchemaHandler.fXSConstraints);
if (errArgs != null) {
fAttrChecker.returnAttrArray(simpleContentAttrValues, schemaDoc);
fAttrChecker.returnAttrArray(derivationTypeAttrValues, schemaDoc);
@@ -903,7 +903,7 @@
fAttrGrp.removeProhibitedAttrs();
if (baseType != SchemaGrammar.fAnyType) {
- Object[] errArgs = fAttrGrp.validRestrictionOf(fName, baseType.getAttrGrp());
+ Object[] errArgs = fAttrGrp.validRestrictionOf(fName, baseType.getAttrGrp(), fSchemaHandler.fXSConstraints);
if (errArgs != null) {
fAttrChecker.returnAttrArray(complexContentAttrValues, schemaDoc);
fAttrChecker.returnAttrArray(derivationTypeAttrValues, schemaDoc);
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=700258&r1=700257&r2=700258&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 Mon Sep 29 14:18:28 2008
@@ -493,7 +493,7 @@
// 2 If there is a {value constraint}, the canonical lexical representation of its value must be valid with respect to the {type definition} as defined in Element Default Valid (Immediate) (3.3.6).
if (element.fDefault != null) {
fValidationState.setNamespaceSupport(schemaDoc.fNamespaceSupport);
- if (XSConstraints.ElementDefaultValidImmediate(element.fType, element.fDefault.normalizedValue, fValidationState, element.fDefault) == null) {
+ 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.setConstraintType(XSConstants.VC_NONE);
}
@@ -501,7 +501,7 @@
// 4 If there is an {substitution group affiliation}, the {type definition} of the element declaration must be validly derived from the {type definition} of the {substitution group affiliation}, given the value of the {substitution group exclusions} of the {substitution group affiliation}, as defined in Type Derivation OK (Complex) (3.4.6) (if the {type definition} is complex) or as defined in Type Derivation OK (Simple) (3.14.6) (if the {type definition} is simple).
if (element.fSubGroup != null) {
- if (!XSConstraints.checkTypeDerivationOk(element.fType, element.fSubGroup.fType, element.fSubGroup.fFinal)) {
+ if (!fSchemaHandler.fXSConstraints.checkTypeDerivationOk(element.fType, element.fSubGroup.fType, element.fSubGroup.fFinal)) {
reportSchemaError ("e-props-correct.4", new Object[]{nameAtt, subGroupAtt.prefix+":"+subGroupAtt.localpart}, elmDecl);
}
}
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=700258&r1=700257&r2=700258&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 Mon Sep 29 14:18:28 2008
@@ -41,6 +41,7 @@
import org.apache.xerces.impl.xs.XMLSchemaLoader;
import org.apache.xerces.impl.xs.XSAttributeGroupDecl;
import org.apache.xerces.impl.xs.XSComplexTypeDecl;
+import org.apache.xerces.impl.xs.XSConstraints;
import org.apache.xerces.impl.xs.XSDDescription;
import org.apache.xerces.impl.xs.XSDeclarationPool;
import org.apache.xerces.impl.xs.XSElementDecl;
@@ -377,7 +378,10 @@
XSAnnotationGrammarPool fGrammarBucketAdapter;
// flag to indicate schema 1.1 support
- short fSchemaVersion = Constants.SCHEMA_VERSION_1_0;
+ short fSchemaVersion;
+
+ // XML Schema constraint checker
+ XSConstraints fXSConstraints;
// these data members are needed for the deferred traversal
// of local elements.
@@ -412,7 +416,9 @@
private String [][] fKeyrefNamespaceContext = new String[INIT_KEYREF_STACK][1];
// Constructors
- public XSDHandler(){
+ public XSDHandler(short schemaVersion, XSConstraints xsConstraints){
+ fSchemaVersion = schemaVersion;
+ fXSConstraints = xsConstraints;
fHiddenNodes = new Hashtable();
fSchemaParser = new SchemaDOMParser(new SchemaParsingConfig());
fSchemaParser.setSupportedVersion(fSupportedVersion); //REVISIT: pass to constructor?
@@ -421,8 +427,8 @@
// it should be possible to use the same XSDHandler to parse
// multiple schema documents; this will allow one to be
// constructed.
- public XSDHandler (XSGrammarBucket gBucket) {
- this();
+ public XSDHandler (XSGrammarBucket gBucket, short schemaVersion, XSConstraints xsConstraints) {
+ this(schemaVersion, xsConstraints);
fGrammarBucket = gBucket;
// Note: don't use SchemaConfiguration internally
@@ -2839,8 +2845,9 @@
*
* @param state
*/
- public void setSchemaVersion(short version) {
+ public void setSchemaVersionInfo(short version, XSConstraints xsConstraints) {
fSchemaVersion = version;
+ fXSConstraints = xsConstraints;
if (version < Constants.SCHEMA_VERSION_1_1) {
fSupportedVersion = SUPPORTED_VERSION_1_0;
}
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@xerces.apache.org
For additional commands, e-mail: commits-help@xerces.apache.org