xerces-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ne...@apache.org
Subject cvs commit: xml-xerces/java/src/org/apache/xerces/validators/schema TraverseSchema.java
Date Wed, 21 Feb 2001 23:14:47 GMT
neilg       01/02/21 15:14:47

  Modified:    java/src/org/apache/xerces/validators/common
                        XMLValidator.java Grammar.java DFAContentModel.java
               java/src/org/apache/xerces/validators/schema
                        TraverseSchema.java
  Log:
  miscelaneous bugfixes relating to schemas with no targetNamespace or containing types with
more than one <any> element.
  
  Revision  Changes    Path
  1.124     +3 -3      xml-xerces/java/src/org/apache/xerces/validators/common/XMLValidator.java
  
  Index: XMLValidator.java
  ===================================================================
  RCS file: /home/cvs/xml-xerces/java/src/org/apache/xerces/validators/common/XMLValidator.java,v
  retrieving revision 1.123
  retrieving revision 1.124
  diff -u -r1.123 -r1.124
  --- XMLValidator.java	2001/02/21 19:05:37	1.123
  +++ XMLValidator.java	2001/02/21 23:14:42	1.124
  @@ -121,7 +121,7 @@
   /**
    * This class is the super all-in-one validator used by the parser.
    *
  - * @version $Id: XMLValidator.java,v 1.123 2001/02/21 19:05:37 elena Exp $
  + * @version $Id: XMLValidator.java,v 1.124 2001/02/21 23:14:42 neilg Exp $
    */
   public final class XMLValidator
       implements DefaultEntityHandler.EventHandler,
  @@ -306,7 +306,7 @@
      private final int TOP_LEVEL_SCOPE = -1;
      private int fCurrentScope = TOP_LEVEL_SCOPE;
      private int fCurrentSchemaURI = -1;
  -   private int fEmptyURI = - 1; 
  +   private int fEmptyURI = StringPool.EMPTY_STRING; 
      private int fXsiPrefix = - 1;
      private int fXsiURI = -2; 
      private int fXsiTypeAttValue = -1;
  @@ -1868,7 +1868,7 @@
         fCheckedForSchema = false;
   
         fCurrentScope = TOP_LEVEL_SCOPE;
  -      fCurrentSchemaURI = -1;
  +      fCurrentSchemaURI = StringPool.EMPTY_STRING;
         fEmptyURI = StringPool.EMPTY_STRING; 
         fXsiPrefix = - 1;
         fXsiTypeValidator = null;
  
  
  
  1.18      +5 -2      xml-xerces/java/src/org/apache/xerces/validators/common/Grammar.java
  
  Index: Grammar.java
  ===================================================================
  RCS file: /home/cvs/xml-xerces/java/src/org/apache/xerces/validators/common/Grammar.java,v
  retrieving revision 1.17
  retrieving revision 1.18
  diff -u -r1.17 -r1.18
  --- Grammar.java	2001/02/01 09:58:31	1.17
  +++ Grammar.java	2001/02/21 23:14:43	1.18
  @@ -71,7 +71,7 @@
   
   
   /**
  - * @version $Id: Grammar.java,v 1.17 2001/02/01 09:58:31 andyc Exp $
  + * @version $Id: Grammar.java,v 1.18 2001/02/21 23:14:43 neilg Exp $
    */
   public class Grammar
   implements XMLContentSpec.Provider {
  @@ -732,6 +732,9 @@
           // We will build a node at this level for the new tree
           CMNode nodeRet = null;
           getContentSpec(startNode, contentSpec);
  +        if (((contentSpec.type & 0x0f) == XMLContentSpec.CONTENTSPECNODE_ANY) ||
  +        ((contentSpec.type & 0x0f) == XMLContentSpec.CONTENTSPECNODE_ANY_OTHER)  ||
  +        ((contentSpec.type & 0x0f) == XMLContentSpec.CONTENTSPECNODE_ANY_LOCAL) )
           if ((contentSpec.type & 0x0f) == XMLContentSpec.CONTENTSPECNODE_ANY) {
               //nodeRet = new CMAny(contentSpec.type, -1, fLeafCount++);
               nodeRet = new CMAny(contentSpec.type, contentSpec.otherValue, fLeafCount++);
  @@ -740,7 +743,7 @@
               nodeRet = new CMAny(contentSpec.type, contentSpec.otherValue, fLeafCount++);
           }
           else if ((contentSpec.type & 0x0f) == XMLContentSpec.CONTENTSPECNODE_ANY_LOCAL)
{
  -            nodeRet = new CMAny(contentSpec.type, -1, fLeafCount++);
  +            nodeRet = new CMAny(contentSpec.type, 0, fLeafCount++);
           }
           //
           //  If this node is a leaf, then its an easy one. We just add it
  
  
  
  1.23      +10 -5     xml-xerces/java/src/org/apache/xerces/validators/common/DFAContentModel.java
  
  Index: DFAContentModel.java
  ===================================================================
  RCS file: /home/cvs/xml-xerces/java/src/org/apache/xerces/validators/common/DFAContentModel.java,v
  retrieving revision 1.22
  retrieving revision 1.23
  diff -u -r1.22 -r1.23
  --- DFAContentModel.java	2001/02/01 09:58:30	1.22
  +++ DFAContentModel.java	2001/02/21 23:14:43	1.23
  @@ -75,7 +75,7 @@
    * are very constrained in form and easily handled via a special case. 
    * This also makes implementation of this class much easier.
    *
  - * @version $Id: DFAContentModel.java,v 1.22 2001/02/01 09:58:30 andyc Exp $
  + * @version $Id: DFAContentModel.java,v 1.23 2001/02/21 23:14:43 neilg Exp $
    */
   public class DFAContentModel 
       implements XMLContentModel {
  @@ -899,7 +899,7 @@
                   //}
                   fElemMapType[fElemMapSize] = fLeafListType[outIndex];
                   fElemMapSize++;
  -            }
  +            } 
           }
           // set up the fLeafNameTypeVector object if there is one.
           if (fLeafNameTypeVector != null) {
  @@ -918,6 +918,7 @@
   	for (int elemIndex = 0; elemIndex < fElemMapSize; elemIndex++) {
   	    for (int leafIndex = 0; leafIndex < fLeafCount; leafIndex++) {
   		final QName leaf = fLeafList[leafIndex].getElement();
  +final int leafType = fLeafListType[leafIndex];
   		final QName element = fElemMap[elemIndex];
   		if (fDTD) {
   		    if (leaf.rawname == element.rawname) {
  @@ -926,12 +927,16 @@
   		}
   		else {
   		    if (leaf.uri == element.uri &&
  -			leaf.localpart == element.localpart)
  +			leaf.localpart == element.localpart) {
  +        if (!((leafType & 0x0f) == XMLContentSpec.CONTENTSPECNODE_ANY ||
  +            (leafType & 0x0f) == XMLContentSpec.CONTENTSPECNODE_ANY_LOCAL ||
  +            (leafType & 0x0f) == XMLContentSpec.CONTENTSPECNODE_ANY_OTHER))
   			fLeafSorter[fSortCount++] = leafIndex;
  +}
   		}
   	    }
   	    fLeafSorter[fSortCount++] = -1;
  -	}
  +	} 
   
   	/* Optimization(Jan, 2001) */
   
  @@ -1351,7 +1356,7 @@
               (nodeCur.type() & 0x0f) == XMLContentSpec.CONTENTSPECNODE_ANY_LOCAL ||
               (nodeCur.type() & 0x0f) == XMLContentSpec.CONTENTSPECNODE_ANY_OTHER) {
               // REVISIT: Don't waste these structures.
  -            QName qname = new QName(-1, -1, -1, ((CMAny)nodeCur).getURI());
  +			QName qname = new QName(-1, -1, -1, ((CMAny)nodeCur).getURI());
               fLeafList[curIndex] = new CMLeaf(qname, ((CMAny)nodeCur).getPosition());
               fLeafListType[curIndex] = nodeCur.type();
               curIndex++;
  
  
  
  1.107     +6 -4      xml-xerces/java/src/org/apache/xerces/validators/schema/TraverseSchema.java
  
  Index: TraverseSchema.java
  ===================================================================
  RCS file: /home/cvs/xml-xerces/java/src/org/apache/xerces/validators/schema/TraverseSchema.java,v
  retrieving revision 1.106
  retrieving revision 1.107
  diff -u -r1.106 -r1.107
  --- TraverseSchema.java	2001/02/20 07:47:03	1.106
  +++ TraverseSchema.java	2001/02/21 23:14:46	1.107
  @@ -124,7 +124,7 @@
    *  
    * @see org.apache.xerces.validators.common.Grammar
    *
  - * @version $Id: TraverseSchema.java,v 1.106 2001/02/20 07:47:03 andyc Exp $
  + * @version $Id: TraverseSchema.java,v 1.107 2001/02/21 23:14:46 neilg Exp $
    */
   public class TraverseSchema implements 
                               NamespacesScope.NamespacesHandler{
  @@ -1554,8 +1554,10 @@
               //          to StringPool.EMPTY_STRING instead of -1? -Ac
               // REVISIT: is this the right way to do it? EMPTY_STRING does not 
               //          seem to work in this case -el 
  -            String uri = child.getOwnerDocument().getDocumentElement().getAttribute("targetNamespace");
  -            int uriIndex = fStringPool.addSymbol(uri);
  +			// Simplify! - ng
  +            //String uri = child.getOwnerDocument().getDocumentElement().getAttribute("targetNamespace");
  +			String uri = fTargetNSURIString;
  +			int uriIndex = fStringPool.addSymbol(uri);
               anyIndex = fSchemaGrammar.addContentSpecNode(processContentsAny, -1, uriIndex,
false);
           }
           else if (namespace.equals("##other")) {
  @@ -1564,7 +1566,7 @@
               anyIndex = fSchemaGrammar.addContentSpecNode(processContentsAnyOther, -1, uriIndex,
false);
           }
           else if (namespace.equals("##local")) {
  -            anyIndex = fSchemaGrammar.addContentSpecNode(processContentsAnyLocal, -1, -1,
false);
  +            anyIndex = fSchemaGrammar.addContentSpecNode(processContentsAnyLocal, -1, StringPool.EMPTY_STRING,
false);
           }
           else if (namespace.length() > 0) {
               StringTokenizer tokenizer = new StringTokenizer(namespace);
  
  
  

Mime
View raw message