Author: knoaman
Date: Mon Nov 3 14:08:57 2008
New Revision: 710187
URL: http://svn.apache.org/viewvc?rev=710187&view=rev
Log:
XML Schema 1.1 - implement XML Schema Structure changes to ID/IDRef and related
types - patch by John K Chan
Modified:
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/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
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=710187&r1=710186&r2=710187&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 Nov 3 14:08:57 2008
@@ -2871,7 +2871,10 @@
} else {
// 5 Let [Definition:] the wild IDs be the set of all
attribute information item to which clause 3.2 applied and whose validation
resulted in a context-determined declaration of mustFind or no
context-determined declaration at all, and whose [local name] and [namespace
name] resolve (as defined by QName resolution (Instance) (3.15.4)) to an
attribute declaration whose {type definition} is or is derived from ID. Then
all of the following must be true:
// 5.1 There must be no more than one item in wild IDs.
- if (currDecl.fType.getTypeCategory() ==
XSTypeDefinition.SIMPLE_TYPE
+ //
+ // Only applies to XML Schema 1.0
+ if (fSchemaVersion < Constants.SCHEMA_VERSION_1_1
+ && currDecl.fType.getTypeCategory() ==
XSTypeDefinition.SIMPLE_TYPE
&& ((XSSimpleType) currDecl.fType).isIDType()) {
if (wildcardIDName != null) {
reportSchemaError(
@@ -2887,6 +2890,9 @@
} // end of for (all attributes)
// 5.2 If wild IDs is non-empty, there must not be any attribute uses
among the {attribute uses} whose {attribute declaration}'s {type definition} is
or is derived from ID.
+ //
+ // Only applies to XML Schema 1.0
+ // Since we do not set the wildcardIDName if it's 1.1, no need to
explicitly check for the version
if (!isSimple && attrGrp.fIDAttrName != null && wildcardIDName !=
null) {
reportSchemaError(
"cvc-complex-type.5.2",
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=710187&r1=710186&r2=710187&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
Mon Nov 3 14:08:57 2008
@@ -644,7 +644,8 @@
if
(attrGrp.getAttributeUse(tempAttrUse.fAttrDecl.getNamespace(),
tempAttrUse.fAttrDecl.getName())==null) {
String idName = attrGrp.addAttributeUse(tempAttrUse);
- if (idName != null) {
+ // Only applies to XML Schema 1.0
+ if (fSchemaHandler.fSchemaVersion <
Constants.SCHEMA_VERSION_1_1 && idName != null) {
String code = (enclosingCT == null) ?
"ag-props-correct.3" : "ct-props-correct.5";
String name = (enclosingCT == null) ? attrGrp.fName :
enclosingCT.getName();
reportSchemaError(code, new Object[]{name,
tempAttrUse.fAttrDecl.getName(), idName}, child);
@@ -670,7 +671,8 @@
if (existingAttrUse ==
attrGrp.getAttributeUse(oneAttrUse.fAttrDecl.getNamespace(),
oneAttrUse.fAttrDecl.getName())) {
String idName = attrGrp.addAttributeUse(oneAttrUse);
- if (idName != null) {
+ // Only applies to XML Schema 1.0
+ if (fSchemaHandler.fSchemaVersion <
Constants.SCHEMA_VERSION_1_1 && idName != null) {
String code = (enclosingCT == null) ?
"ag-props-correct.3" : "ct-props-correct.5";
String name = (enclosingCT == null) ?
attrGrp.fName : enclosingCT.getName();
reportSchemaError(code, new Object[]{name,
oneAttrUse.fAttrDecl.getName(), idName}, child);
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=710187&r1=710186&r2=710187&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
Mon Nov 3 14:08:57 2008
@@ -17,6 +17,7 @@
package org.apache.xerces.impl.xs.traversers;
+import org.apache.xerces.impl.Constants;
import org.apache.xerces.impl.dv.InvalidDatatypeValueException;
import org.apache.xerces.impl.dv.ValidatedInfo;
import org.apache.xerces.impl.dv.XSSimpleType;
@@ -176,7 +177,9 @@
}
// 3 If the {type definition} is or is derived from ID then there
must not be a {value constraint}.
- if (((XSSimpleType)attribute.getTypeDefinition()).isIDType() ) {
+ //
+ // Only applies to XML Schema 1.0
+ if (fSchemaHandler.fSchemaVersion < Constants.SCHEMA_VERSION_1_1
&& ((XSSimpleType)attribute.getTypeDefinition()).isIDType() ) {
reportSchemaError ("a-props-correct.3", new Object[]{nameAtt},
attrDecl);
}
@@ -394,7 +397,9 @@
}
// 3 If the {type definition} is or is derived from ID then there must
not be a {value constraint}.
- if (attDefault != null) {
+ //
+ // Only applies to XML Schema 1.0
+ if (fSchemaHandler.fSchemaVersion < Constants.SCHEMA_VERSION_1_1 &&
attDefault != null) {
if (attrType.isIDType() ) {
reportSchemaError ("a-props-correct.3", new Object[]{nameAtt},
attrDecl);
}
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=710187&r1=710186&r2=710187&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 Nov 3 14:08:57 2008
@@ -1186,7 +1186,8 @@
if (existingAttrUse == null) {
String idName = toAttrGrp.addAttributeUse(oneAttrUse);
- if (idName != null) {
+ // Only applies to XML Schema 1.0
+ if (fSchemaHandler.fSchemaVersion <
Constants.SCHEMA_VERSION_1_1 && idName != null) {
throw new ComplexTypeRecoverableError("ct-props-correct.5",
new Object[]{typeName, idName,
oneAttrUse.fAttrDecl.getName()},
elem);
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=710187&r1=710186&r2=710187&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 Nov 3 14:08:57 2008
@@ -524,8 +524,10 @@
}
}
+ // Only applies to XML Schema 1.0
+ //
// 5 If the {type definition} or {type definition}'s {content type} is
or is derived from ID then there must not be a {value constraint}.
- if (element.fDefault != null) {
+ if (fSchemaHandler.fSchemaVersion < Constants.SCHEMA_VERSION_1_1 &&
element.fDefault != null) {
if ((elementType.getTypeCategory() == XSTypeDefinition.SIMPLE_TYPE
&&
((XSSimpleType)elementType).isIDType()) ||
(elementType.getTypeCategory() ==
XSTypeDefinition.COMPLEX_TYPE &&
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]