You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xerces.apache.org by mr...@apache.org on 2005/10/04 04:49:58 UTC

cvs commit: xml-xerces/java/src/org/apache/xerces/impl/dtd DTDGrammar.java

mrglavas    2005/10/03 19:49:58

  Modified:    java/src/org/apache/xerces/impl/dtd DTDGrammar.java
  Log:
  Added a protected method for use by BalancedDTDGrammar.
  
  Revision  Changes    Path
  1.33      +23 -18    xml-xerces/java/src/org/apache/xerces/impl/dtd/DTDGrammar.java
  
  Index: DTDGrammar.java
  ===================================================================
  RCS file: /home/cvs/xml-xerces/java/src/org/apache/xerces/impl/dtd/DTDGrammar.java,v
  retrieving revision 1.32
  retrieving revision 1.33
  diff -u -r1.32 -r1.33
  --- DTDGrammar.java	7 Mar 2005 23:28:41 -0000	1.32
  +++ DTDGrammar.java	4 Oct 2005 02:49:58 -0000	1.33
  @@ -514,23 +514,8 @@
           //add(or set) this elementDecl to the local cache
           this.fElementDeclTab.put(name, elementDecl );
   
  -        fElementDecl         = elementDecl;
  -
  -        if ((fDepth == 0 ||
  -            (fDepth == 1 && elementDecl.type == XMLElementDecl.TYPE_MIXED)) &&
  -            fNodeIndexStack != null) {
  -            if (elementDecl.type == XMLElementDecl.TYPE_MIXED) {
  -                int pcdata = addUniqueLeafNode(null);
  -                if (fNodeIndexStack[0] == -1) {
  -                    fNodeIndexStack[0] = pcdata;
  -                }
  -                else {
  -                    fNodeIndexStack[0] = addContentSpecNode(XMLContentSpec.CONTENTSPECNODE_CHOICE,
  -                                                            pcdata, fNodeIndexStack[0]);
  -                }
  -            }
  -            setContentSpecIndex(fCurrentElementIndex, fNodeIndexStack[fDepth]);
  -        }
  +        fElementDecl = elementDecl;
  +        addContentSpecToElement(elementDecl);
   
           if ( DEBUG ) {
               System.out.println(  "name = " + fElementDecl.name.localpart );
  @@ -1648,6 +1633,26 @@
       //
       // Protected methods
       //
  +    
  +    /**
  +     * Adds the content spec to the give element declaration.
  +     */
  +    protected void addContentSpecToElement(XMLElementDecl elementDecl) {
  +        if ((fDepth == 0 || (fDepth == 1 && elementDecl.type == XMLElementDecl.TYPE_MIXED)) &&
  +                fNodeIndexStack != null) {
  +            if (elementDecl.type == XMLElementDecl.TYPE_MIXED) {
  +                int pcdata = addUniqueLeafNode(null);
  +                if (fNodeIndexStack[0] == -1) {
  +                    fNodeIndexStack[0] = pcdata;
  +                }
  +                else {
  +                    fNodeIndexStack[0] = addContentSpecNode(XMLContentSpec.CONTENTSPECNODE_CHOICE,
  +                            pcdata, fNodeIndexStack[0]);
  +                }
  +            }
  +            setContentSpecIndex(fCurrentElementIndex, fNodeIndexStack[fDepth]);
  +        }
  +    }
   
       /**
        * getElementContentModelValidator
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@xerces.apache.org
For additional commands, e-mail: commits-help@xerces.apache.org