sandygao 2002/12/09 14:08:46
Modified: java/src/org/apache/xerces/impl/msg
XMLSchemaMessages.properties
java/src/org/apache/xerces/impl/xs XSAttributeGroupDecl.java
XSConstraints.java XSWildcardDecl.java
java/src/org/apache/xerces/impl/xs/traversers
XSDComplexTypeTraverser.java
Log:
Fix for errata E1-21: need to check the processContents of wildcards in the
derived types (by restriction), to see whether they are stronger than those in
the base types.
Revision Changes Path
1.54 +5 -2
xml-xerces/java/src/org/apache/xerces/impl/msg/XMLSchemaMessages.properties
Index: XMLSchemaMessages.properties
===================================================================
RCS file:
/home/cvs/xml-xerces/java/src/org/apache/xerces/impl/msg/XMLSchemaMessages.properties,v
retrieving revision 1.53
retrieving revision 1.54
diff -u -r1.53 -r1.54
--- XMLSchemaMessages.properties 27 Aug 2002 19:45:02 -0000 1.53
+++ XMLSchemaMessages.properties 9 Dec 2002 22:08:45 -0000 1.54
@@ -216,7 +216,9 @@
derivation-ok-restriction.2.1.3= derivation-ok-restriction.2.1.3: Error for
type ''{0}''. An attribute use in this type has an effective value constraint which
is not consistent with the effective value constraint of the matching attribute use in
the base type.
derivation-ok-restriction.2.2= derivation-ok-restriction.2.2: Error for
type ''{0}''. An attribute use in this type does not have a matching attribute use in
the base, and, the base type does not have a wildcard which matches this attribute use.
derivation-ok-restriction.3= derivation-ok-restriction.3: Error for type
''{0}''. There is an attribute use in the base type with REQUIRED as true, which does
not have a matching attribute use in the derived type.
- derivation-ok-restriction.4= derivation-ok-restriction.4: Error for type
''{0}''. The wildcard in the derivation is not a valid wildcard subset of the one in
the base.
+ derivation-ok-restriction.4.1 = derivation-ok-restriction.4.1: Error for
type ''{0}''. The derivation has an attribute wildcard, but the base does not have
one.
+ derivation-ok-restriction.4.2 = derivation-ok-restriction.4.2: Error for
type ''{0}''. The wildcard in the derivation is not a valid wildcard subset of the
one in the base.
+ derivation-ok-restriction.4.3 = derivation-ok-restriction.4.3: Error for
type ''{0}''. The process contents of the wildcard in the derivation is weaker than
that in the base.
derivation-ok-restriction.5.1.1 = derivation-ok-restriction.5.1.1: Error
for type ''{0}''. The content type is not a valid restriction of the content type of
the base.
derivation-ok-restriction.5.2 = derivation-ok-restriction.5.2: Error for
type ''{0}''. The content type of this type is empty, but the content type of the
base is not.
derivation-ok-restriction.5.3 = derivation-ok-restriction.5.3: Error for
type ''{0}''. The particle of the type is not a valid restriction of the particle of
the base.
@@ -280,6 +282,7 @@
rcase-NSSubset = rcase-NSSubset: error.
rcase-NSSubset.1 = rcase-NSSubset.1: Wildcard is not a subset of
corresponding wildcard in base.
rcase-NSSubset.2 = rcase-NSSubset.2: Wildcard's occurrence range is not a
valid restriction of that in the base.
+ rcase-NSSubset.3 = rcase-NSSubset.3: Wildcard's process contents is weaker
than that in the base.
rcase-Recurse = rcase-Recurse: error.
rcase-Recurse.1 = rcase-Recurse.1: Group's occurrence range is not a valid
restriction of base group's occurrence range.
rcase-Recurse.2 = rcase-Recurse.2: There is not a complete functional
mapping between the particles.
1.11 +7 -3
xml-xerces/java/src/org/apache/xerces/impl/xs/XSAttributeGroupDecl.java
Index: XSAttributeGroupDecl.java
===================================================================
RCS file:
/home/cvs/xml-xerces/java/src/org/apache/xerces/impl/xs/XSAttributeGroupDecl.java,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- XSAttributeGroupDecl.java 18 Nov 2002 23:11:54 -0000 1.10
+++ XSAttributeGroupDecl.java 9 Dec 2002 22:08:46 -0000 1.11
@@ -273,11 +273,15 @@
//
if (fAttributeWC != null) {
if (baseGroup.fAttributeWC == null) {
- errorCode = "derivation-ok-restriction.4";
+ errorCode = "derivation-ok-restriction.4.1";
return errorCode;
}
if (! fAttributeWC.isSubsetOf(baseGroup.fAttributeWC)) {
- errorCode="derivation-ok-restriction.4";
+ errorCode="derivation-ok-restriction.4.2";
+ return errorCode;
+ }
+ if (fAttributeWC.weakerProcessContents(baseGroup.fAttributeWC)) {
+ errorCode="derivation-ok-restriction.4.3";
return errorCode;
}
}
1.28 +4 -1 xml-xerces/java/src/org/apache/xerces/impl/xs/XSConstraints.java
Index: XSConstraints.java
===================================================================
RCS file:
/home/cvs/xml-xerces/java/src/org/apache/xerces/impl/xs/XSConstraints.java,v
retrieving revision 1.27
retrieving revision 1.28
diff -u -r1.27 -r1.28
--- XSConstraints.java 18 Nov 2002 23:11:54 -0000 1.27
+++ XSConstraints.java 9 Dec 2002 22:08:46 -0000 1.28
@@ -1145,6 +1145,9 @@
throw new XMLSchemaException("rcase-NSSubset.1",null);
}
+ if (dWildcard.weakerProcessContents(bWildcard)) {
+ throw new XMLSchemaException("rcase-NSSubset.3",null);
+ }
}
1.9 +11 -1
xml-xerces/java/src/org/apache/xerces/impl/xs/XSWildcardDecl.java
Index: XSWildcardDecl.java
===================================================================
RCS file:
/home/cvs/xml-xerces/java/src/org/apache/xerces/impl/xs/XSWildcardDecl.java,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- XSWildcardDecl.java 17 Jun 2002 18:41:45 -0000 1.8
+++ XSWildcardDecl.java 9 Dec 2002 22:08:46 -0000 1.9
@@ -199,6 +199,16 @@
} // isSubsetOf
/**
+ * Check whether this wildcard has a weaker process contents than the super.
+ */
+ public boolean weakerProcessContents(XSWildcardDecl superWildcard) {
+ return fProcessContents == XSWildcardDecl.PC_LAX &&
+ superWildcard.fProcessContents == XSWildcardDecl.PC_STRICT ||
+ fProcessContents == XSWildcardDecl.PC_SKIP &&
+ superWildcard.fProcessContents != XSWildcardDecl.PC_SKIP;
+ }
+
+ /**
* Schema Component Constraint: Attribute Wildcard Union
*/
public XSWildcardDecl performUnionWith(XSWildcardDecl wildcard,
1.26 +7 -5
xml-xerces/java/src/org/apache/xerces/impl/xs/traversers/XSDComplexTypeTraverser.java
Index: XSDComplexTypeTraverser.java
===================================================================
RCS file:
/home/cvs/xml-xerces/java/src/org/apache/xerces/impl/xs/traversers/XSDComplexTypeTraverser.java,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -r1.25 -r1.26
--- XSDComplexTypeTraverser.java 26 Aug 2002 13:57:19 -0000 1.25
+++ XSDComplexTypeTraverser.java 9 Dec 2002 22:08:46 -0000 1.26
@@ -707,10 +707,12 @@
}
mergeAttributes(baseType.getAttrGrp(), fAttrGrp, fName, false,
complexContent);
- String error = fAttrGrp.validRestrictionOf(baseType.getAttrGrp());
- if (error != null) {
- throw new ComplexTypeRecoverableError(error,
- new Object[]{fName}, complexContent);
+ if (baseType != SchemaGrammar.fAnyType) {
+ String error = fAttrGrp.validRestrictionOf(baseType.getAttrGrp());
+ if (error != null) {
+ throw new ComplexTypeRecoverableError(error,
+ new Object[]{fName}, complexContent);
+ }
}
// Remove prohibited uses. Must be done after merge for RESTRICTION.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]