You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xerces.apache.org by sa...@apache.org on 2002/04/04 20:36:26 UTC
cvs commit: xml-xerces/java/src/org/apache/xerces/impl/xs/traversers XSDGroupTraverser.java XSDComplexTypeTraverser.java XSDAbstractTraverser.java XSDAbstractParticleTraverser.java
sandygao 02/04/04 10:36:26
Modified: java/src/org/apache/xerces/impl/xs/traversers
XSDGroupTraverser.java XSDComplexTypeTraverser.java
XSDAbstractTraverser.java
XSDAbstractParticleTraverser.java
Log:
Cleaned up some error messages:
1. Remove (old) error codes that are not used;
2. Convert references to old codes to new ones (defined by the spec.)
Now only error codes of Identity Constraint are not from the spec.
Revision Changes Path
1.10 +13 -7 xml-xerces/java/src/org/apache/xerces/impl/xs/traversers/XSDGroupTraverser.java
Index: XSDGroupTraverser.java
===================================================================
RCS file: /home/cvs/xml-xerces/java/src/org/apache/xerces/impl/xs/traversers/XSDGroupTraverser.java,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- XSDGroupTraverser.java 3 Apr 2002 23:48:27 -0000 1.9
+++ XSDGroupTraverser.java 4 Apr 2002 18:36:26 -0000 1.10
@@ -77,7 +77,7 @@
* @author Rahul Srivastava, Sun Microsystems Inc.
* @author Elena Litani, IBM
* @author Lisa Martin, IBM
- * @version $Id: XSDGroupTraverser.java,v 1.9 2002/04/03 23:48:27 elena Exp $
+ * @version $Id: XSDGroupTraverser.java,v 1.10 2002/04/04 18:36:26 sandygao Exp $
*/
class XSDGroupTraverser extends XSDAbstractParticleTraverser {
@@ -166,7 +166,9 @@
// must have at least one child
Element l_elmChild = DOMUtil.getFirstChildElement(elmNode);
if (l_elmChild == null) {
- reportSchemaError("s4s-elt-must-match", new Object[]{"group (global)", "(annotation?, (all | choice | sequence))"}, elmNode);
+ reportSchemaError("s4s-elt-must-match",
+ new Object[]{"group (global)", "(annotation?, (all | choice | sequence))"},
+ elmNode);
} else {
String childName = l_elmChild.getLocalName();
if (childName.equals(SchemaSymbols.ELT_ANNOTATION)) {
@@ -177,7 +179,9 @@
}
if (l_elmChild == null) {
- reportSchemaError("s4s-elt-must-match", new Object[]{"group (global)", "(annotation?, (all | choice | sequence))"}, elmNode);
+ reportSchemaError("s4s-elt-must-match",
+ new Object[]{"group (global)", "(annotation?, (all | choice | sequence))"},
+ elmNode);
} else if (childName.equals(SchemaSymbols.ELT_ALL)) {
particle = traverseAll(l_elmChild, schemaDoc, grammar, CHILD_OF_GROUP);
} else if (childName.equals(SchemaSymbols.ELT_CHOICE)) {
@@ -185,14 +189,16 @@
} else if (childName.equals(SchemaSymbols.ELT_SEQUENCE)) {
particle = traverseSequence(l_elmChild, schemaDoc, grammar, CHILD_OF_GROUP);
} else {
- Object[] args = new Object [] { "group", childName};
- reportSchemaError("GroupContentRestricted", args, l_elmChild);
+ reportSchemaError("s4s-elt-must-match",
+ new Object[]{"group (global)", "(annotation?, (all | choice | sequence))"},
+ l_elmChild);
}
if (l_elmChild != null &&
DOMUtil.getNextSiblingElement(l_elmChild) != null) {
- Object[] args = new Object [] { "group", childName};
- reportSchemaError("GroupContentRestricted", args, l_elmChild);
+ reportSchemaError("s4s-elt-must-match",
+ new Object[]{"group (global)", "(annotation?, (all | choice | sequence))"},
+ DOMUtil.getNextSiblingElement(l_elmChild));
}
// add global group declaration to the grammar
1.17 +2 -2 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.16
retrieving revision 1.17
diff -u -r1.16 -r1.17
--- XSDComplexTypeTraverser.java 3 Apr 2002 23:48:27 -0000 1.16
+++ XSDComplexTypeTraverser.java 4 Apr 2002 18:36:26 -0000 1.17
@@ -91,7 +91,7 @@
* ((group | all | choice | sequence)?,
* ((attribute | attributeGroup)*, anyAttribute?))))
* </complexType>
- * @version $Id: XSDComplexTypeTraverser.java,v 1.16 2002/04/03 23:48:27 elena Exp $
+ * @version $Id: XSDComplexTypeTraverser.java,v 1.17 2002/04/04 18:36:26 sandygao Exp $
*/
class XSDComplexTypeTraverser extends XSDAbstractParticleTraverser {
@@ -724,7 +724,7 @@
if (typeInfo.fParticle.fType == XSParticleDecl.PARTICLE_ALL ||
baseType.fParticle.fType == XSParticleDecl.PARTICLE_ALL) {
throw new ComplexTypeRecoverableError("cos-all-limited.1.2",
- new Object[]{typeName}, complexContent);
+ null, complexContent);
}
XSParticleDecl temp = new XSParticleDecl();
temp.fType = XSParticleDecl.PARTICLE_SEQUENCE;
1.15 +22 -36 xml-xerces/java/src/org/apache/xerces/impl/xs/traversers/XSDAbstractTraverser.java
Index: XSDAbstractTraverser.java
===================================================================
RCS file: /home/cvs/xml-xerces/java/src/org/apache/xerces/impl/xs/traversers/XSDAbstractTraverser.java,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -r1.14 -r1.15
--- XSDAbstractTraverser.java 3 Apr 2002 23:48:27 -0000 1.14
+++ XSDAbstractTraverser.java 4 Apr 2002 18:36:26 -0000 1.15
@@ -92,7 +92,7 @@
* @author Rahul Srivastava, Sun Microsystems Inc.
* @author Neeraj Bajaj, Sun Microsystems Inc.
*
- * @version $Id: XSDAbstractTraverser.java,v 1.14 2002/04/03 23:48:27 elena Exp $
+ * @version $Id: XSDAbstractTraverser.java,v 1.15 2002/04/04 18:36:26 sandygao Exp $
*/
abstract class XSDAbstractTraverser {
@@ -526,11 +526,17 @@
// Neither minOccurs nor maxOccurs may be specified
// for the child of a model group definition.
- if (isGroupChild && (!defaultMin || !defaultMax)) {
- Object[] args = new Object[]{parent.getAttribute(SchemaSymbols.ATT_NAME),
- particleName};
- reportSchemaError("MinMaxOnGroupChild", args, parent);
- min = max = 1;
+ if (isGroupChild) {
+ if (!defaultMin) {
+ Object[] args = new Object[]{particleName, "minOccurs"};
+ reportSchemaError("s4s-att-not-allowed", args, parent);
+ min = 1;
+ }
+ if (!defaultMax) {
+ Object[] args = new Object[]{particleName, "maxOccurs"};
+ reportSchemaError("s4s-att-not-allowed", args, parent);
+ max = 1;
+ }
}
// If minOccurs=maxOccurs=0, no component is specified
@@ -544,38 +550,18 @@
// For a complex type definition that contains an <all> or a
// reference a <group> whose model group is an all model group,
// minOccurs and maxOccurs must be one.
- if (processingAllEl || groupRefWithAll || processingAllGP) {
- String errorMsg;
- if ((processingAllGP||groupRefWithAll||min!=0) && min !=1) {
- if (processingAllEl) {
- errorMsg = "BadMinMaxForAllElem";
- }
- else if (processingAllGP) {
- errorMsg = "BadMinMaxForAllGp";
- }
- else {
- errorMsg = "BadMinMaxForGroupWithAll";
- }
- Object[] args = new Object [] {"minOccurs", Integer.toString(min)};
- reportSchemaError(errorMsg, args, parent);
- min = 1;
- }
-
+ if (processingAllEl) {
if (max != 1) {
-
- if (processingAllEl) {
- errorMsg = "BadMinMaxForAllElem";
- }
- else if (processingAllGP) {
- errorMsg = "BadMinMaxForAllGp";
- }
- else {
- errorMsg = "BadMinMaxForGroupWithAll";
- }
-
- Object[] args = new Object [] {"maxOccurs", Integer.toString(max)};
- reportSchemaError(errorMsg, args, parent);
+ reportSchemaError("cos-all-limited.2", null, parent);
max = 1;
+ if (min > 1)
+ min = 1;
+ }
+ }
+ else if (processingAllGP || groupRefWithAll) {
+ if (min != 1 || max != 1) {
+ reportSchemaError("cos-all-limited.1.2", null, parent);
+ min = max = 1;
}
}
1.7 +7 -14 xml-xerces/java/src/org/apache/xerces/impl/xs/traversers/XSDAbstractParticleTraverser.java
Index: XSDAbstractParticleTraverser.java
===================================================================
RCS file: /home/cvs/xml-xerces/java/src/org/apache/xerces/impl/xs/traversers/XSDAbstractParticleTraverser.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- XSDAbstractParticleTraverser.java 3 Apr 2002 23:48:27 -0000 1.6
+++ XSDAbstractParticleTraverser.java 4 Apr 2002 18:36:26 -0000 1.7
@@ -67,7 +67,7 @@
/**
* @author Elena Litani, IBM
* @author Sandy Gao, IBM
- * @version $Id: XSDAbstractParticleTraverser.java,v 1.6 2002/04/03 23:48:27 elena Exp $
+ * @version $Id: XSDAbstractParticleTraverser.java,v 1.7 2002/04/04 18:36:26 sandygao Exp $
*/
abstract class XSDAbstractParticleTraverser extends XSDAbstractTraverser {
@@ -120,8 +120,8 @@
particle = fSchemaHandler.fElementTraverser.traverseLocal(child, schemaDoc, grammar, PROCESSING_ALL_EL);
}
else {
- Object[] args = { childName};
- reportSchemaError("AllContentRestricted", args, child);
+ Object[] args = {"all", "(annotation?, element*)"};
+ reportSchemaError("s4s-elt-must-match", args, child);
}
if (left == null) {
@@ -272,14 +272,7 @@
// don't insert the "all" particle, otherwise we won't be
// able to create DFA from this content model
particle = null;
- Object [] args;
- if (choice) {
- args = new Object[]{SchemaSymbols.ELT_CHOICE};
- }
- else {
- args = new Object[]{SchemaSymbols.ELT_SEQUENCE};
- }
- reportSchemaError("AllContentLimited",args, child);
+ reportSchemaError("cos-all-limited.1.2", null, child);
}
}
@@ -295,12 +288,12 @@
else {
Object [] args;
if (choice) {
- args = new Object[]{SchemaSymbols.ELT_CHOICE};
+ args = new Object[]{"choice", "(annotation?, (element | group | choice | sequence | any)*)"};
}
else {
- args = new Object[]{SchemaSymbols.ELT_SEQUENCE};
+ args = new Object[]{"sequence", "(annotation?, (element | group | choice | sequence | any)*)"};
}
- reportSchemaError("SeqChoiceContentRestricted", args, child);
+ reportSchemaError("s4s-elt-must-match", args, child);
}
---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-cvs-help@xml.apache.org