You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xerces.apache.org by lm...@apache.org on 2001/10/16 21:29:56 UTC
cvs commit: xml-xerces/java/src/org/apache/xerces/impl/v2 CMBuilder.java
lmartin 01/10/16 12:29:56
Modified: java/src/org/apache/xerces/impl/v2 CMBuilder.java
Log:
support content models that have empty particles
Revision Changes Path
1.11 +22 -13 xml-xerces/java/src/org/apache/xerces/impl/v2/CMBuilder.java
Index: CMBuilder.java
===================================================================
RCS file: /home/cvs/xml-xerces/java/src/org/apache/xerces/impl/v2/CMBuilder.java,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- CMBuilder.java 2001/10/09 22:35:18 1.10
+++ CMBuilder.java 2001/10/16 19:29:56 1.11
@@ -64,7 +64,7 @@
* This class constructs content models for a given grammar.
*
* @author Elena Litani, IBM
- * @version $Id: CMBuilder.java,v 1.10 2001/10/09 22:35:18 elena Exp $
+ * @version $Id: CMBuilder.java,v 1.11 2001/10/16 19:29:56 lmartin Exp $
*/
public class CMBuilder {
@@ -108,20 +108,20 @@
//if (cmValidator != null)
// return cmValidator;
- if (contentType == XSComplexTypeDecl.CONTENTTYPE_MIXED &&
- particle == null) {
- // create special content model for mixed with no element content
- cmValidator = new XSMixedCM();
- }
- else {
-
- particle = expandParticleTree( (XSParticleDecl)particle);
+ if (particle != null)
+ particle = expandParticleTree( (XSParticleDecl)particle);
+
// REVISIT: should we expand?? or throw away the expanded tree??
//typeDecl.fParticle
// And create the content model according to the spec type
- if (contentType == XSComplexTypeDecl.CONTENTTYPE_MIXED) {
+
+ if (particle == null) {
+ // create special content model for no element content
+ cmValidator = new XSEmptyCM();
+ }
+ else if (contentType == XSComplexTypeDecl.CONTENTTYPE_MIXED) {
//
// Create a child model as
// per the element-only case
@@ -140,7 +140,6 @@
throw new RuntimeException("Unknown content type for a element decl "
+ "in getElementContentModelValidator() in Grammar class");
}
- }
// Add the new model to the content model for this element
typeDecl.fCMValidator = cmValidator;
@@ -179,12 +178,19 @@
//REVISIT: look at uri and switch grammar if necessary
left = expandParticleTree( (XSParticleDecl)left);
+ if (right != null)
+ right = expandParticleTree( (XSParticleDecl)right);
+
+ // At this point, by expanding the particle tree, we may have a null left or right
+ if (left==null && right==null)
+ return null;
+
+ if (left == null)
+ return expandContentModel((XSParticleDecl)right, minOccurs, maxOccurs);
if (right == null)
return expandContentModel((XSParticleDecl)left, minOccurs, maxOccurs);
- right = expandParticleTree( (XSParticleDecl)right);
-
// When checking Unique Particle Attribution, we always create new
// new node to store different name for different groups
//if (grammar.fUPAChecking) {
@@ -195,6 +201,9 @@
particle.fValue = left;
particle.fOtherValue = right;
return expandContentModel((XSParticleDecl)particle, minOccurs, maxOccurs);
+ }
+ else if (type == XSParticleDecl.PARTICLE_EMPTY) {
+ return null;
}
else {
// When checking Unique Particle Attribution, we have to rename
---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-cvs-help@xml.apache.org