You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xerces.apache.org by je...@locus.apache.org on 2000/04/17 23:40:59 UTC

cvs commit: xml-xerces/java/src/org/apache/xerces/framework XMLAttrList.java XMLDocumentHandler.java XMLDocumentScanner.java XMLDTDScanner.java XMLParser.java

jeffreyr    00/04/17 14:40:58

  Modified:    java/src/org/apache/xerces/framework Tag: schemawork
                        XMLAttrList.java XMLDocumentHandler.java
                        XMLDocumentScanner.java XMLDTDScanner.java
                        XMLParser.java
  Log:
  Andy QName support
  
  Revision  Changes    Path
  No                   revision
  
  
  No                   revision
  
  
  1.2.2.1   +139 -13   xml-xerces/java/src/org/apache/xerces/framework/XMLAttrList.java
  
  Index: XMLAttrList.java
  ===================================================================
  RCS file: /home/cvs/xml-xerces/java/src/org/apache/xerces/framework/XMLAttrList.java,v
  retrieving revision 1.2
  retrieving revision 1.2.2.1
  diff -u -r1.2 -r1.2.2.1
  --- XMLAttrList.java	2000/04/04 21:14:20	1.2
  +++ XMLAttrList.java	2000/04/17 21:40:54	1.2.2.1
  @@ -57,6 +57,7 @@
   
   package org.apache.xerces.framework;
   
  +import org.apache.xerces.utils.QName;
   import org.apache.xerces.utils.StringPool;
   
   import org.xml.sax.AttributeList;
  @@ -93,34 +94,50 @@
    * may be used to access the attribute list through the SAX <code>AttributeList</code>
    * interface.
    *
  - * @version $Id: XMLAttrList.java,v 1.2 2000/04/04 21:14:20 andyc Exp $
  + * @version $Id: XMLAttrList.java,v 1.2.2.1 2000/04/17 21:40:54 jeffreyr Exp $
    */
  -public final class XMLAttrList implements AttributeList {
  +public final class XMLAttrList 
  +    implements AttributeList {
  +
       //
  -    // Chunk size constants
  +    // Constants
       //
  +
  +    // Chunk size constants
  +
       private static final int CHUNK_SHIFT = 5;           // 2^5 = 32
       private static final int CHUNK_SIZE = (1 << CHUNK_SHIFT);
       private static final int CHUNK_MASK = CHUNK_SIZE - 1;
       private static final int INITIAL_CHUNK_COUNT = (1 << (10 - CHUNK_SHIFT));   // 2^10 = 1k
  -    //
  +
       // Flags (bits)
  -    //
  +
       private static final int ATTFLAG_SPECIFIED = 1;
       private static final int ATTFLAG_LASTATTR  = 2;
  +
       //
  -    // Instance variables
  +    // Data
       //
  +
  +    // Instance variables
  +
       private StringPool fStringPool = null;
       private int fCurrentHandle = -1;
       private int fAttributeListHandle = -1;
       private int fAttributeListLength = 0;
       private int fAttrCount = 0;
  +    private int[][] fAttPrefix = new int[INITIAL_CHUNK_COUNT][];
  +    private int[][] fAttLocalpart = new int[INITIAL_CHUNK_COUNT][];
       private int[][] fAttName = new int[INITIAL_CHUNK_COUNT][];
  +    private int[][] fAttURI = new int[INITIAL_CHUNK_COUNT][];
       private int[][] fAttValue = new int[INITIAL_CHUNK_COUNT][];
       private int[][] fAttType = new int[INITIAL_CHUNK_COUNT][];
       private byte[][] fAttFlags = new byte[INITIAL_CHUNK_COUNT][];
   
  +    // utility
  +
  +    private QName fAttributeQName = new QName();
  +
       /**
        * Constructor
        *
  @@ -143,6 +160,12 @@
           fAttrCount = 0;
       }
   
  +    public int addAttr(int attrName, int attValue, 
  +                       int attType, boolean specified, boolean search) throws Exception
  +    {
  +        fAttributeQName.setValues(-1, attrName, attrName);
  +        return addAttr(fAttributeQName, attValue, attType, specified, search);
  +    }
       /**
        * Add an attribute to the current set.
        *
  @@ -155,15 +178,18 @@
        * @return The index of this attribute; or -1 is <code>search</code> was <code>true</code>
        *         and <code>attrName</code> was already present.
        */
  -    public int addAttr(int attrName, int attValue, int attType, boolean specified, boolean search) throws Exception
  -    {
  +    public int addAttr(QName attribute, 
  +                       int attValue, int attType, 
  +                       boolean specified, boolean search) throws Exception {
  +
           int chunk;
           int index;
           if (search) {
               chunk = fCurrentHandle >> CHUNK_SHIFT;
               index = fCurrentHandle & CHUNK_MASK;
               for (int attrIndex = fCurrentHandle; attrIndex < fAttrCount; attrIndex++) {
  -                if (fStringPool.equalNames(fAttName[chunk][index], attrName)) {
  +                // REVISIT: Should this be localpart?
  +                if (fStringPool.equalNames(fAttName[chunk][index], attribute.rawname)) {
                       return -1;
                   }
                   if (++index == CHUNK_SIZE) {
  @@ -176,13 +202,17 @@
               index = fAttrCount & CHUNK_MASK;
           }
           ensureCapacity(chunk, index);
  -        fAttName[chunk][index] = attrName;
  +        fAttPrefix[chunk][index] = attribute.prefix;
  +        fAttLocalpart[chunk][index] = attribute.localpart;
  +        fAttName[chunk][index] = attribute.rawname;
  +        fAttURI[chunk][index] = attribute.uri;
           fAttValue[chunk][index] = attValue;
           fAttType[chunk][index] = attType;
           fAttFlags[chunk][index] = (byte)(specified ? ATTFLAG_SPECIFIED : 0);
           return fAttrCount++;
  -    }
   
  +    } // addAttr(QName,int,int,boolean,boolean):int
  +
       /**
        * Start a new set of attributes.
        *
  @@ -205,6 +235,29 @@
       }
   
       /**
  +     * Get the prefix of the attribute.
  +     */
  +    public int getAttrPrefix(int attrIndex) {
  +        if (attrIndex < 0 || attrIndex >= fAttrCount)
  +            return -1;
  +        int chunk = attrIndex >> CHUNK_SHIFT;
  +        int index = attrIndex & CHUNK_MASK;
  +        return fAttPrefix[chunk][index];
  +    }
  +
  +    /**
  +     * Return the localpart of the attribute.
  +     */
  +    public int getAttrLocalpart(int attrIndex) {
  +        if (attrIndex < 0 || attrIndex >= fAttrCount)
  +            return -1;
  +        int chunk = attrIndex >> CHUNK_SHIFT;
  +        int index = attrIndex & CHUNK_MASK;
  +        return fAttLocalpart[chunk][index];
  +    }
  +
  +    // REVISIT: Should this be renamed "getAttrRawname" to match?
  +    /**
        * Get the name of the attribute
        *
        * @param attrIndex The index of the attribute.
  @@ -217,6 +270,24 @@
           int index = attrIndex & CHUNK_MASK;
           return fAttName[chunk][index];
       }
  +    
  +    /** Sets the uri of the attribute. */
  +    public void setAttrURI(int attrIndex, int uri) {
  +        if (attrIndex < 0 || attrIndex >= fAttrCount)
  +            return;
  +        int chunk = attrIndex >> CHUNK_SHIFT;
  +        int index = attrIndex & CHUNK_MASK;
  +        fAttURI[chunk][index] = uri;
  +    }
  +
  +    /** Return the uri of the attribute. */
  +    public int getAttrURI(int attrIndex) {
  +        if (attrIndex < 0 || attrIndex >= fAttrCount)
  +            return -1;
  +        int chunk = attrIndex >> CHUNK_SHIFT;
  +        int index = attrIndex & CHUNK_MASK;
  +        return fAttURI[chunk][index];
  +    }
   
       /**
        * Get the value of the attribute
  @@ -273,7 +344,10 @@
           int index = attrListHandle & CHUNK_MASK;
           while (true) {
               boolean last = (fAttFlags[chunk][index] & ATTFLAG_LASTATTR) != 0;
  +            fAttPrefix[chunk][index] = -1;
  +            fAttLocalpart[chunk][index] = -1;
               fAttName[chunk][index] = -1;
  +            fAttURI[chunk][index] = -1;
               if ((fAttFlags[chunk][index] & ATTFLAG_SPECIFIED) != 0)
                   fStringPool.releaseString(fAttValue[chunk][index]);
               fAttValue[chunk][index] = -1;
  @@ -368,6 +442,30 @@
       }
   
       /**
  +     * Return the prefix of an attribute in this list (by position).
  +     */
  +    public String getPrefix(int i) {
  +        if (i < 0 || i >= fAttributeListLength) {
  +            return null;
  +        }
  +        int chunk = (fAttributeListHandle + i) >> CHUNK_SHIFT;
  +        int index = (fAttributeListHandle + i) & CHUNK_MASK;
  +        return fStringPool.toString(fAttPrefix[chunk][index]);
  +    }
  +
  +    /**
  +     * Return the local part of an attribute in this list (by position).
  +     */
  +    public String getLocalpart(int i) {
  +        if (i < 0 || i >= fAttributeListLength) {
  +            return null;
  +        }
  +        int chunk = (fAttributeListHandle + i) >> CHUNK_SHIFT;
  +        int index = (fAttributeListHandle + i) & CHUNK_MASK;
  +        return fStringPool.toString(fAttLocalpart[chunk][index]);
  +    }
  +
  +    /**
        * Return the name of an attribute in this list (by position).
        *
        * <p>The names must be unique: the SAX parser shall not include the
  @@ -391,6 +489,15 @@
           return fStringPool.toString(fAttName[chunk][index]);
       }
   
  +    /** Returns the URI of an attribute in this list (by position). */
  +    public String getURI(int i) {
  +        if (i < 0 || i >= fAttributeListLength)
  +            return null;
  +        int chunk = (fAttributeListHandle + i) >> CHUNK_SHIFT;
  +        int index = (fAttributeListHandle + i) & CHUNK_MASK;
  +        return fStringPool.toString(fAttURI[chunk][index]);
  +    }
  +
       /**
        * Return the type of an attribute in the list (by position).
        *
  @@ -510,15 +617,29 @@
           return null;
       }
   
  +    //
  +    // Private methods
  +    //
  +
       /* Expand our internal data structures as needed. */
       private boolean ensureCapacity(int chunk, int index) {
  +
           try {
               return fAttName[chunk][index] != 0;
           } catch (ArrayIndexOutOfBoundsException ex) {
               int[][] newIntArray = new int[chunk * 2][];
  +            System.arraycopy(fAttPrefix, 0, newIntArray, 0, chunk);
  +            fAttPrefix = newIntArray;
  +            newIntArray = new int[chunk * 2][];
  +            System.arraycopy(fAttLocalpart, 0, newIntArray, 0, chunk);
  +            fAttLocalpart = newIntArray;
  +            newIntArray = new int[chunk * 2][];
               System.arraycopy(fAttName, 0, newIntArray, 0, chunk);
               fAttName = newIntArray;
               newIntArray = new int[chunk * 2][];
  +            System.arraycopy(fAttURI, 0, newIntArray, 0, chunk);
  +            fAttURI = newIntArray;
  +            newIntArray = new int[chunk * 2][];
               System.arraycopy(fAttValue, 0, newIntArray, 0, chunk);
               fAttValue = newIntArray;
               newIntArray = new int[chunk * 2][];
  @@ -529,10 +650,15 @@
               fAttFlags = newByteArray;
           } catch (NullPointerException ex) {
           }
  +        fAttPrefix[chunk] = new int[CHUNK_SIZE];
  +        fAttLocalpart[chunk] = new int[CHUNK_SIZE];
           fAttName[chunk] = new int[CHUNK_SIZE];
  +        fAttURI[chunk] = new int[CHUNK_SIZE];
           fAttValue[chunk] = new int[CHUNK_SIZE];
           fAttType[chunk] = new int[CHUNK_SIZE];
           fAttFlags[chunk] = new byte[CHUNK_SIZE];
           return true;
  -    }
  -}
  +
  +    } // ensureCapacity(int,int):boolean
  +
  +} // class XMLAttrList
  
  
  
  1.2.2.1   +10 -9     xml-xerces/java/src/org/apache/xerces/framework/XMLDocumentHandler.java
  
  Index: XMLDocumentHandler.java
  ===================================================================
  RCS file: /home/cvs/xml-xerces/java/src/org/apache/xerces/framework/XMLDocumentHandler.java,v
  retrieving revision 1.2
  retrieving revision 1.2.2.1
  diff -u -r1.2 -r1.2.2.1
  --- XMLDocumentHandler.java	2000/04/04 21:14:21	1.2
  +++ XMLDocumentHandler.java	2000/04/17 21:40:54	1.2.2.1
  @@ -57,6 +57,8 @@
   
   package org.apache.xerces.framework;
   
  +import org.apache.xerces.utils.QName;
  +
   /**
    * XMLValidator defines the interface that XMLDocumentScanner and XML
    * EntityHandler have with an object that serves as a pluggable validator.
  @@ -69,7 +71,7 @@
    * the grammar specification file (which contains markup declarations and entity
    * declarations)
    *
  - * @version $Id: XMLDocumentHandler.java,v 1.2 2000/04/04 21:14:21 andyc Exp $
  + * @version $Id: XMLDocumentHandler.java,v 1.2.2.1 2000/04/17 21:40:54 jeffreyr Exp $
    */
   
   public interface XMLDocumentHandler {
  @@ -133,7 +135,8 @@
        * @param attrListHandle handle into attrList.  Allows attributes to be retreived.
        * @exception java.lang.Exception
        */
  -    public void startElement(int elementType, XMLAttrList attrList, int attrListHandle) throws Exception;
  +    public void startElement(QName element, 
  +                             XMLAttrList attrList, int attrListHandle) throws Exception;
   
       /**
        * callback for end of element.
  @@ -141,7 +144,7 @@
        * @param elementType element handle for the element being scanned
        * @exception java.lang.Exception
        */
  -    public void endElement(int elementType) throws Exception;
  +    public void endElement(QName element) throws Exception;
   
       /**
        * callback for start of entity reference.
  @@ -252,7 +255,7 @@
            * @param systemId string pool index of the DTD's system ID
            * @exception java.lang.Exception
            */
  -        public void startDTD(int rootElementType, int publicId, int systemId) throws Exception;
  +        public void startDTD(QName rootElement, int publicId, int systemId) throws Exception;
   
           /**
            * Supports DOM Level 2 internalSubset additions.
  @@ -281,7 +284,7 @@
            * @see org.apache.xerces.framework.XMLContentSpec
            * @exception java.lang.Exception
            */
  -        public void elementDecl(int elementType, XMLContentSpec contentSpec) throws Exception;
  +        public void elementDecl(QName elementDecl, XMLContentSpec contentSpec) throws Exception;
   
           /**
            * callback for an attribute list declaration. 
  @@ -296,10 +299,8 @@
            *        or -1 if there is no defaultvalue 
            * @exception java.lang.Exception
            */
  -        public void attlistDecl(int elementType,
  -                                int attrName,
  -                                int attType,
  -                                String enumString,
  +        public void attlistDecl(QName elementDecl, QName attributeDecl,
  +                                int attType, String enumString,
                                   int attDefaultType,
                                   int attDefaultValue) throws Exception;
   
  
  
  
  1.3.2.1   +68 -50    xml-xerces/java/src/org/apache/xerces/framework/XMLDocumentScanner.java
  
  Index: XMLDocumentScanner.java
  ===================================================================
  RCS file: /home/cvs/xml-xerces/java/src/org/apache/xerces/framework/XMLDocumentScanner.java,v
  retrieving revision 1.3
  retrieving revision 1.3.2.1
  diff -u -r1.3 -r1.3.2.1
  --- XMLDocumentScanner.java	2000/04/04 21:14:21	1.3
  +++ XMLDocumentScanner.java	2000/04/17 21:40:54	1.3.2.1
  @@ -58,6 +58,7 @@
   package org.apache.xerces.framework;
   
   import org.apache.xerces.readers.XMLEntityHandler;
  +import org.apache.xerces.utils.QName;
   import org.apache.xerces.utils.StringPool;
   import org.apache.xerces.utils.XMLMessages;
   
  @@ -76,7 +77,7 @@
    * "connecting" that method to the corresponding method provided
    * by the XMLDTDScanner class.
    *
  - * @version $Id: XMLDocumentScanner.java,v 1.3 2000/04/04 21:14:21 andyc Exp $
  + * @version $Id: XMLDocumentScanner.java,v 1.3.2.1 2000/04/17 21:40:54 jeffreyr Exp $
    */
   public final class XMLDocumentScanner {
       //
  @@ -146,6 +147,9 @@
       //
       // Instance Variables
       //
  +    QName fElementQName = new QName();
  +    QName fAttributeQName = new QName();
  +    QName fCurrentElementQName = new QName();
       ScannerDispatcher fDispatcher = null;
       EventHandler fEventHandler = null;
       StringPool fStringPool = null;
  @@ -184,11 +188,14 @@
            *
            * @param entityReader The entity reader.
            * @param fastchar A likely non-name character that might terminate the element type.
  +         * <!--
            * @return The handle in the string pool for the element type scanned, or -1 if
            *         we were not able to scan an element type at the current location.
  +         * -->
            * @exception java.lang.Exception
            */
  -        public int scanElementType(XMLEntityHandler.EntityReader entityReader, char fastchar) throws Exception;
  +        public void scanElementType(XMLEntityHandler.EntityReader entityReader, 
  +                                   char fastchar, QName element) throws Exception;
           /**
            * Scan the expected element type.
            *
  @@ -203,7 +210,8 @@
            *         find.
            * @exception java.lang.Exception
            */
  -        public boolean scanExpectedElementType(XMLEntityHandler.EntityReader entityReader, char fastchar) throws Exception;
  +        public boolean scanExpectedElementType(XMLEntityHandler.EntityReader entityReader, 
  +                                               char fastchar, QName element) throws Exception;
           /**
            * Scan an attribute name.
            *
  @@ -212,11 +220,14 @@
            *
            * @param entityReader The entity reader.
            * @param elementType The element type for this attribute.
  +         * <!--
            * @return The handle in the string pool for the attribute name scanned, or -1 if
            *         we were not able to scan an attribute name at the current location.
  +         * -->
            * @exception java.lang.Exception
            */
  -        public int scanAttributeName(XMLEntityHandler.EntityReader entityReader, int elementType) throws Exception;
  +        public void scanAttributeName(XMLEntityHandler.EntityReader entityReader, 
  +                                     QName element, QName attribute) throws Exception;
           /**
            * Signal the start of a document
            *
  @@ -252,7 +263,7 @@
            * @param elementType handle to the elementType being scanned
            * @exception java.lang.Exception
            */
  -        public void callStartElement(int elementType) throws Exception;
  +        public void callStartElement(QName element) throws Exception;
           /**
            * signal the scanning of an end element tag
            *
  @@ -327,7 +338,7 @@
            *         XMLDocumentScanner.RESULT_DUPLICATE_ATTR if the attribute is a duplicate.
            * @exception java.lang.Exception
            */
  -        public int scanAttValue(int elementType, int attrName) throws Exception;
  +        public int scanAttValue(QName element, QName attribute) throws Exception;
       }
   
       /**
  @@ -452,13 +463,13 @@
        * @return handle in the string pool of the scanned value
        * @exception java.lang.Exception
        */
  -    public int scanAttValue(int elementType, int attrName, boolean asSymbol) throws Exception {
  +    public int scanAttValue(QName element, QName attribute, boolean asSymbol) throws Exception {
           boolean single;
           if (!(single = fEntityReader.lookingAtChar('\'', true)) && !fEntityReader.lookingAtChar('\"', true)) {
               reportFatalXMLError(XMLMessages.MSG_QUOTE_REQUIRED_IN_ATTVALUE,
                                   XMLMessages.P10_QUOTE_REQUIRED,
  -                                elementType,
  -                                attrName);
  +                                element.rawname,
  +                                attribute.rawname);
               return -1;
           }
           char qchar = single ? '\'' : '\"';
  @@ -468,8 +479,10 @@
               return attValue;
           int previousState = setScannerState(SCANNER_STATE_ATTRIBUTE_VALUE);
           fAttValueReader = fReaderId;
  -        fAttValueElementType = elementType;
  -        fAttValueAttrName = attrName;
  +        // REVISIT: What should this be?
  +        fAttValueElementType = element.rawname;
  +        // REVISIT: What should this be?
  +        fAttValueAttrName = attribute.rawname;
           fAttValueOffset = fEntityReader.currentOffset();
           int dataOffset = fLiteralData.length();
           if (fAttValueOffset - fAttValueMark > 0)
  @@ -539,8 +552,8 @@
                   setMark = true;
                   reportFatalXMLError(XMLMessages.MSG_LESSTHAN_IN_ATTVALUE,
                                       XMLMessages.WFC_NO_LESSTHAN_IN_ATTVALUE,
  -                                    elementType,
  -                                    attrName);
  +                                    element.rawname,
  +                                    attribute.rawname);
               } else if (!fEntityReader.lookingAtValidChar(true)) {
                   if (fAttValueOffset - fAttValueMark > 0)
                       fEntityReader.append(fLiteralData, fAttValueMark, fAttValueOffset - fAttValueMark);
  @@ -551,8 +564,8 @@
                   if (invChar >= 0) {
                       reportFatalXMLError(XMLMessages.MSG_INVALID_CHAR_IN_ATTVALUE,
                                           XMLMessages.P10_INVALID_CHARACTER,
  -                                        fStringPool.toString(elementType),
  -                                        fStringPool.toString(attrName),
  +                                        fStringPool.toString(element.rawname),
  +                                        fStringPool.toString(attribute.rawname),
                                           Integer.toHexString(invChar));
                   }
               }
  @@ -984,8 +997,8 @@
                   switch (fScannerState) {
                   case SCANNER_STATE_ROOT_ELEMENT:
                   {
  -                    int elementType = fEventHandler.scanElementType(fEntityReader, '>');
  -                    if (elementType != -1) {
  +                    fEventHandler.scanElementType(fEntityReader, '>', fElementQName);
  +                    if (fElementQName.rawname != -1) {
                           //
                           // root element
                           //
  @@ -998,18 +1011,18 @@
                               //
                               // we have more content
                               //
  -                            fEventHandler.callStartElement(elementType);
  +                            fEventHandler.callStartElement(fElementQName);
                               fScannerMarkupDepth--;
                               if (fElementDepth == fElementTypeStack.length) {
                                   int[] newStack = new int[fElementDepth * 2];
                                   System.arraycopy(fElementTypeStack, 0, newStack, 0, fElementDepth);
                                   fElementTypeStack = newStack;
                               }
  -                            fCurrentElementType = elementType;
  -                            fElementTypeStack[fElementDepth] = elementType;
  +                            fCurrentElementType = fElementQName.rawname;
  +                            fElementTypeStack[fElementDepth] = fElementQName.rawname;
                               fElementDepth++;
                               restoreScannerState(SCANNER_STATE_CONTENT);
  -                        } else if (scanElement(elementType)) {
  +                        } else if (scanElement(fElementQName)) {
                               //
                               // we have more content
                               //
  @@ -1018,8 +1031,8 @@
                                   System.arraycopy(fElementTypeStack, 0, newStack, 0, fElementDepth);
                                   fElementTypeStack = newStack;
                               }
  -                            fCurrentElementType = elementType;
  -                            fElementTypeStack[fElementDepth] = elementType;
  +                            fCurrentElementType = fElementQName.rawname;
  +                            fElementTypeStack[fElementDepth] = fElementQName.rawname;
                               fElementDepth++;
                               restoreScannerState(SCANNER_STATE_CONTENT);
                           } else {
  @@ -1081,7 +1094,7 @@
                               //
                               // [42] ETag ::= '</' Name S? '>'
                               //
  -                            if (!fEventHandler.scanExpectedElementType(fEntityReader, '>')) {
  +                            if (!fEventHandler.scanExpectedElementType(fEntityReader, '>', fElementQName)) {
                                   abortMarkup(XMLMessages.MSG_ETAG_REQUIRED,
                                               XMLMessages.P39_UNTERMINATED,
                                               fCurrentElementType);
  @@ -1109,31 +1122,31 @@
                                   }
                               }
                           } else {
  -                            int elementType = fEventHandler.scanElementType(fEntityReader, '>');
  -                            if (elementType != -1) {
  +                            fEventHandler.scanElementType(fEntityReader, '>', fElementQName);
  +                            if (fElementQName.rawname != -1) {
                                   //
                                   // element
                                   //
                                   if (fEntityReader.lookingAtChar('>', true)) {
  -                                    fEventHandler.callStartElement(elementType);
  +                                    fEventHandler.callStartElement(fElementQName);
                                       fScannerMarkupDepth--;
                                       if (fElementDepth == fElementTypeStack.length) {
                                           int[] newStack = new int[fElementDepth * 2];
                                           System.arraycopy(fElementTypeStack, 0, newStack, 0, fElementDepth);
                                           fElementTypeStack = newStack;
                                       }
  -                                    fCurrentElementType = elementType;
  -                                    fElementTypeStack[fElementDepth] = elementType;
  +                                    fCurrentElementType = fElementQName.rawname;
  +                                    fElementTypeStack[fElementDepth] = fElementQName.rawname;
                                       fElementDepth++;
                                   } else {
  -                                    if (scanElement(elementType)) {
  +                                    if (scanElement(fElementQName)) {
                                           if (fElementDepth == fElementTypeStack.length) {
                                               int[] newStack = new int[fElementDepth * 2];
                                               System.arraycopy(fElementTypeStack, 0, newStack, 0, fElementDepth);
                                               fElementTypeStack = newStack;
                                           }
  -                                        fCurrentElementType = elementType;
  -                                        fElementTypeStack[fElementDepth] = elementType;
  +                                        fCurrentElementType = fElementQName.rawname;
  +                                        fElementTypeStack[fElementDepth] = fElementQName.rawname;
                                           fElementDepth++;
                                       }
                                   }
  @@ -1151,7 +1164,10 @@
                           setScannerState(SCANNER_STATE_START_OF_MARKUP);
                           continue;
                       }
  -                    switch (fEntityReader.scanContent(fCurrentElementType)) {
  +                    // REVISIT: Is this the right thing to do? Do we need to
  +                    //          save more information on the stack?
  +                    fCurrentElementQName.setValues(-1, -1, fCurrentElementType);
  +                    switch (fEntityReader.scanContent(fCurrentElementQName)) {
                       case XMLEntityHandler.CONTENT_RESULT_START_OF_PI:
                           fScannerMarkupDepth++;
                           int piTarget = fEntityReader.scanName(' ');
  @@ -1192,7 +1208,7 @@
                           //
                           // [42] ETag ::= '</' Name S? '>'
                           //
  -                        if (!fEventHandler.scanExpectedElementType(fEntityReader, '>')) {
  +                        if (!fEventHandler.scanExpectedElementType(fEntityReader, '>', fElementQName)) {
                               abortMarkup(XMLMessages.MSG_ETAG_REQUIRED,
                                           XMLMessages.P39_UNTERMINATED,
                                           fCurrentElementType);
  @@ -1225,28 +1241,28 @@
                       {
                           fScannerMarkupDepth++;
                           fParseTextDecl = false;
  -                        int elementType = fEventHandler.scanElementType(fEntityReader, '>');
  -                        if (elementType != -1) {
  +                        fEventHandler.scanElementType(fEntityReader, '>', fElementQName);
  +                        if (fElementQName.rawname != -1) {
                               if (fEntityReader.lookingAtChar('>', true)) {
  -                                fEventHandler.callStartElement(elementType);
  +                                fEventHandler.callStartElement(fElementQName);
                                   fScannerMarkupDepth--;
                                   if (fElementDepth == fElementTypeStack.length) {
                                       int[] newStack = new int[fElementDepth * 2];
                                       System.arraycopy(fElementTypeStack, 0, newStack, 0, fElementDepth);
                                       fElementTypeStack = newStack;
                                   }
  -                                fCurrentElementType = elementType;
  -                                fElementTypeStack[fElementDepth] = elementType;
  +                                fCurrentElementType = fElementQName.rawname;
  +                                fElementTypeStack[fElementDepth] = fElementQName.rawname;
                                   fElementDepth++;
                               } else {
  -                                if (scanElement(elementType)) {
  +                                if (scanElement(fElementQName)) {
                                       if (fElementDepth == fElementTypeStack.length) {
                                           int[] newStack = new int[fElementDepth * 2];
                                           System.arraycopy(fElementTypeStack, 0, newStack, 0, fElementDepth);
                                           fElementTypeStack = newStack;
                                       }
  -                                    fCurrentElementType = elementType;
  -                                    fElementTypeStack[fElementDepth] = elementType;
  +                                    fCurrentElementType = fElementQName.rawname;
  +                                    fElementTypeStack[fElementDepth] = fElementQName.rawname;
                                       fElementDepth++;
                                   }
                               }
  @@ -1777,7 +1793,7 @@
       //
       // Note: We have already scanned Name.
       //
  -    boolean scanElement(int elementType) throws Exception
  +    boolean scanElement(QName element) throws Exception
       {
           //
           // Scan for attributes
  @@ -1799,8 +1815,9 @@
                   // Name
                   //
                   setScannerState(SCANNER_STATE_ATTRIBUTE_NAME);
  -                int attrName = fEventHandler.scanAttributeName(fEntityReader, elementType);
  -                if (attrName == -1) {
  +                fEventHandler.scanAttributeName(fEntityReader, 
  +                                                element, fAttributeQName);
  +                if (fAttributeQName.rawname == -1) {
                       break;
                   }
                   //
  @@ -1811,13 +1828,14 @@
                       if (fScannerState != SCANNER_STATE_END_OF_INPUT) {
                           abortMarkup(XMLMessages.MSG_EQ_REQUIRED_IN_ATTRIBUTE,
                                       XMLMessages.P41_EQ_REQUIRED,
  -                                    elementType, attrName);
  +                                    element.rawname, fAttributeQName.rawname);
                           restoreScannerState(previousState);
                       }
                       return false;
                   }
                   fEntityReader.skipPastSpaces();
  -                int result = fEventHandler.scanAttValue(elementType, attrName);
  +                //int result = fEventHandler.scanAttValue(prefixIndex, elementType, 
  +                int result = fEventHandler.scanAttValue(element,  fAttributeQName);
                   if (result == RESULT_FAILURE) {
                       if (fScannerState != SCANNER_STATE_END_OF_INPUT) {
                           skipPastEndOfCurrentMarkup();
  @@ -1827,7 +1845,7 @@
                   } else if (result == RESULT_DUPLICATE_ATTR) {
                       reportFatalXMLError(XMLMessages.MSG_ATTRIBUTE_NOT_UNIQUE,
                                           XMLMessages.WFC_UNIQUE_ATT_SPEC,
  -                                        elementType, attrName);
  +                                        element.rawname, fAttributeQName.rawname);
                   }
                   restoreScannerState(SCANNER_STATE_ATTRIBUTE_LIST);
                   if (!fEntityReader.lookingAtSpace(true)) {
  @@ -1844,11 +1862,11 @@
               if (fScannerState != SCANNER_STATE_END_OF_INPUT) {
                   abortMarkup(XMLMessages.MSG_ELEMENT_UNTERMINATED,
                               XMLMessages.P40_UNTERMINATED,
  -                            elementType);
  +                            element.rawname);
               }
               return false;
           }
  -        fEventHandler.callStartElement(elementType);
  +        fEventHandler.callStartElement(element);
           fScannerMarkupDepth--;
           if (slash) { // '/>'
               fEventHandler.callEndElement(fReaderId);
  
  
  
  1.6.2.1   +110 -68   xml-xerces/java/src/org/apache/xerces/framework/XMLDTDScanner.java
  
  Index: XMLDTDScanner.java
  ===================================================================
  RCS file: /home/cvs/xml-xerces/java/src/org/apache/xerces/framework/XMLDTDScanner.java,v
  retrieving revision 1.6
  retrieving revision 1.6.2.1
  diff -u -r1.6 -r1.6.2.1
  --- XMLDTDScanner.java	2000/04/04 21:14:20	1.6
  +++ XMLDTDScanner.java	2000/04/17 21:40:55	1.6.2.1
  @@ -58,6 +58,7 @@
   package org.apache.xerces.framework;
   
   import org.apache.xerces.readers.XMLEntityHandler;
  +import org.apache.xerces.utils.QName;
   import org.apache.xerces.utils.StringPool;
   import org.apache.xerces.utils.XMLMessages;
   
  @@ -81,7 +82,7 @@
    * </ol>
    *
    * @see XMLDTDScanner.EventHandler
  - * @version $Id: XMLDTDScanner.java,v 1.6 2000/04/04 21:14:20 andyc Exp $
  + * @version $Id: XMLDTDScanner.java,v 1.6.2.1 2000/04/17 21:40:55 jeffreyr Exp $
    */
   public final class XMLDTDScanner {
       //
  @@ -172,6 +173,9 @@
       //
       // Instance Variables
       //
  +    private QName fElementQName = new QName();
  +    private QName fAttributeQName = new QName();
  +    private QName fElementRefQName = new QName();
       private EventHandler fEventHandler = null;
       private StringPool fStringPool = null;
       private XMLErrorReporter fErrorReporter = null;
  @@ -402,7 +406,7 @@
            * @param systemId StringPool handle of the system id
            * @exception java.lang.Exception
            */
  -        public void doctypeDecl(int rootElementType, int publicId, int systemId) throws Exception;
  +        public void doctypeDecl(QName rootElement, int publicId, int systemId) throws Exception;
           /**
            * Called when the DTDScanner starts reading from the external subset
            *
  @@ -424,7 +428,7 @@
            * @return handle to the element whose declaration was added
            * @exception java.lang.Exception
            */
  -        public int addElementDecl(int elementType) throws Exception;
  +        public int addElementDecl(QName elementDecl) throws Exception;
           /**
            * Add an element declaration
            *
  @@ -434,7 +438,7 @@
            * @return handle to the element declaration that was added 
            * @exception java.lang.Exception
            */
  -        public int addElementDecl(int elementType, int contentSpecType, int contentSpec) throws Exception;
  +        public int addElementDecl(QName elementDecl, int contentSpecType, int contentSpec) throws Exception;
           /**
            * Add an attribute definition
            *
  @@ -447,7 +451,9 @@
            * @return handle to the attribute definition
            * @exception java.lang.Exception
            */
  -        public int addAttDef(int elementIndex, int attName, int attType, int enumeration, int attDefaultType, int attDefaultValue) throws Exception;
  +        public int addAttDef(QName elementDecl, QName attributeDecl, 
  +                             int attType, int enumeration, 
  +                             int attDefaultType, int attDefaultValue) throws Exception;
           /**
            * create an XMLContentSpec.Node for a leaf
            *
  @@ -597,10 +603,13 @@
            *
            * @param entityReader reader to read from
            * @param fastchar hint - character likely to terminate the element type
  +         * <!--
            * @return StringPool handle for the element type
  +         * -->
            * @exception java.lang.Exception
            */
  -        public int scanElementType(XMLEntityHandler.EntityReader entityReader, char fastchar) throws Exception;
  +        public void scanElementType(XMLEntityHandler.EntityReader entityReader, 
  +                                    char fastchar, QName element) throws Exception;
           /**
            * Scan for an element type at a point in the grammar where parameter
            * entity references are allowed.  If such a reference is encountered,
  @@ -610,10 +619,13 @@
            *
            * @param entityReader reader to read from
            * @param fastchar hint - character likely to terminate the element type
  +         * <!--
            * @return StringPool handle for the element type
  +         * -->
            * @exception java.lang.Exception
            */
  -        public int checkForElementTypeWithPEReference(XMLEntityHandler.EntityReader entityReader, char fastchar) throws Exception;
  +        public void checkForElementTypeWithPEReference(XMLEntityHandler.EntityReader entityReader, 
  +                                                       char fastchar, QName element) throws Exception;
           /**
            * Scan for an attribute name at a point in the grammar where parameter
            * entity references are allowed.  If such a reference is encountered,
  @@ -623,10 +635,13 @@
            *
            * @param entityReader reader to read from
            * @param fastchar hint - character likely to terminate the attribute name
  +         * <!--
            * @return StringPool handle for the attribute name
  +         * -->
            * @exception java.lang.Exception
            */
  -        public int checkForAttributeNameWithPEReference(XMLEntityHandler.EntityReader entityReader, char fastcheck) throws Exception;
  +        public void checkForAttributeNameWithPEReference(XMLEntityHandler.EntityReader entityReader, 
  +                                                         char fastcheck, QName attribute) throws Exception;
           /**
            * Scan for a Name at a point in the grammar where parameter entity
            * references are allowed.  If such a reference is encountered, the
  @@ -663,7 +678,9 @@
            * @return StringPool handle to the default value
            * @exception java.lang.Exception
            */
  -        public int scanDefaultAttValue(int elementType, int attrName, int attType, int enumeration) throws Exception;
  +        public int scanDefaultAttValue(QName element, QName attribute, 
  +                                       int attType, 
  +                                       int enumeration) throws Exception;
           /**
            * Supports DOM Level 2 internalSubset additions.
            * Called when the internal subset is completely scanned.
  @@ -1082,8 +1099,8 @@
               return false;
           }
           fEntityReader.skipPastSpaces();
  -        int rootElementType = fEventHandler.scanElementType(fEntityReader, ' ');
  -        if (rootElementType == -1) {
  +        fEventHandler.scanElementType(fEntityReader, ' ', fElementQName);
  +        if (fElementQName.rawname == -1) {
               abortMarkup(XMLMessages.MSG_ROOT_ELEMENT_TYPE_REQUIRED,
                           XMLMessages.P28_ROOT_ELEMENT_TYPE_REQUIRED);
               return false;
  @@ -1107,7 +1124,7 @@
               }
           } else
               lbrkt = fEntityReader.lookingAtChar('[', true);
  -        fEventHandler.doctypeDecl(rootElementType, publicId, systemId);
  +        fEventHandler.doctypeDecl(fElementQName, publicId, systemId);
           if (lbrkt) {
               scanDecls(false);
               fEntityReader.skipPastSpaces();
  @@ -1116,7 +1133,7 @@
               if (fScannerState != SCANNER_STATE_END_OF_INPUT) {
                   abortMarkup(XMLMessages.MSG_DOCTYPEDECL_UNTERMINATED,
                               XMLMessages.P28_UNTERMINATED,
  -                            rootElementType);
  +                            fElementQName.rawname);
               }
               return false;
           }
  @@ -1667,18 +1684,22 @@
           fEventHandler.callTextDecl(version, encoding);
           restoreScannerState(prevState);
       }
  -    //
  -    // [45] elementdecl ::= '<!ELEMENT' S Name S contentspec S? '>'
  -    //
  -    private void scanElementDecl() throws Exception
  -    {
  +
  +    /**
  +     * Scans an element declaration.
  +     * <pre>
  +     * [45] elementdecl ::= '&lt;!ELEMENT' S Name S contentspec S? '&gt;'
  +     * </pre>
  +     */
  +    private void scanElementDecl() throws Exception {
  +        
           if (!checkForPEReference(true)) {
               abortMarkup(XMLMessages.MSG_SPACE_REQUIRED_BEFORE_ELEMENT_TYPE_IN_ELEMENTDECL,
                           XMLMessages.P45_SPACE_REQUIRED);
               return;
           }
  -        int elementType = fEventHandler.checkForElementTypeWithPEReference(fEntityReader, ' ');
  -        if (elementType == -1) {
  +        fEventHandler.checkForElementTypeWithPEReference(fEntityReader, ' ', fElementQName);
  +        if (fElementQName.rawname == -1) {
               abortMarkup(XMLMessages.MSG_ELEMENT_TYPE_REQUIRED_IN_ELEMENTDECL,
                           XMLMessages.P45_ELEMENT_TYPE_REQUIRED);
               return;
  @@ -1686,7 +1707,7 @@
           if (!checkForPEReference(true)) {
               abortMarkup(XMLMessages.MSG_SPACE_REQUIRED_BEFORE_CONTENTSPEC_IN_ELEMENTDECL,
                           XMLMessages.P45_SPACE_REQUIRED,
  -                        elementType);
  +                        fElementQName.rawname);
               return;
           }
           int contentSpecType = -1;
  @@ -1698,7 +1719,7 @@
           } else if (!fEntityReader.lookingAtChar('(', true)) {
               abortMarkup(XMLMessages.MSG_CONTENTSPEC_REQUIRED_IN_ELEMENTDECL,
                           XMLMessages.P45_CONTENTSPEC_REQUIRED,
  -                        elementType);
  +                        fElementQName.rawname);
               return;
           } else {
               int contentSpecReader = fReaderId;
  @@ -1711,10 +1732,12 @@
               boolean skippedPCDATA = fEntityReader.skippedString(pcdata_string);
               if (skippedPCDATA) {
                   contentSpecType = fMIXED;
  -                contentSpec = scanMixed(elementType);
  +                // REVISIT: Validation. Should we pass in QName?
  +                contentSpec = scanMixed(fElementQName);
               } else {
                   contentSpecType = fCHILDREN;
  -                contentSpec = scanChildren(elementType);
  +                // REVISIT: Validation. Should we pass in QName?
  +                contentSpec = scanChildren(fElementQName);
               }
               boolean success = contentSpec != -1;
               restoreScannerState(prevState);
  @@ -1733,19 +1756,23 @@
           if (!fEntityReader.lookingAtChar('>', true)) {
               abortMarkup(XMLMessages.MSG_ELEMENTDECL_UNTERMINATED,
                           XMLMessages.P45_UNTERMINATED,
  -                        elementType);
  +                        fElementQName.rawname);
               return;
           }
           decreaseMarkupDepth();
  -        int elementIndex = fEventHandler.addElementDecl(elementType, contentSpecType, contentSpec);
  -    }
  -    //
  -    // [51] Mixed ::= '(' S? '#PCDATA' (S? '|' S? Name)* S? ')*' | '(' S? '#PCDATA' S? ')'
  -    //
  -    // Called after scanning past '(' S? '#PCDATA'
  -    //
  -    private int scanMixed(int elementType) throws Exception
  -    {
  +        int elementIndex = fEventHandler.addElementDecl(fElementQName, contentSpecType, contentSpec);
  +
  +    } // scanElementDecl()
  +
  +    
  +    /**
  +     * Scans mixed content model. Called after scanning past '(' S? '#PCDATA'
  +     * <pre>
  +     * [51] Mixed ::= '(' S? '#PCDATA' (S? '|' S? Name)* S? ')*' | '(' S? '#PCDATA' S? ')'
  +     * </pre>
  +     */
  +    private int scanMixed(QName element) throws Exception {
  +
           int valueIndex = -1;  // -1 is special value for #PCDATA
           int prevNodeIndex = -1;
           boolean starRequired = false;
  @@ -1756,7 +1783,7 @@
                   if (!fEntityReader.lookingAtChar(')', true)) {
                       reportFatalXMLError(XMLMessages.MSG_CLOSE_PAREN_REQUIRED_IN_MIXED,
                                           XMLMessages.P51_CLOSE_PAREN_REQUIRED,
  -                                        elementType);
  +                                        element.rawname);
                       return -1;
                   }
                   decreaseParenDepth();
  @@ -1770,7 +1797,7 @@
                   } else if (starRequired) {
                       reportFatalXMLError(XMLMessages.MSG_MIXED_CONTENT_UNTERMINATED,
                                           XMLMessages.P51_UNTERMINATED,
  -                                        fStringPool.toString(elementType),
  +                                        fStringPool.toString(element.rawname),
                                           fEventHandler.getContentSpecNodeAsString(nodeIndex));
                       return -1;
                   }
  @@ -1784,23 +1811,29 @@
               }
               starRequired = true;
               checkForPEReference(false);
  -            valueIndex = fEventHandler.checkForElementTypeWithPEReference(fEntityReader, ')');
  +            fEventHandler.checkForElementTypeWithPEReference(fEntityReader, ')', fElementRefQName);
  +            valueIndex = fElementRefQName.rawname;
               if (valueIndex == -1) {
                   reportFatalXMLError(XMLMessages.MSG_ELEMENT_TYPE_REQUIRED_IN_MIXED_CONTENT,
                                       XMLMessages.P51_ELEMENT_TYPE_REQUIRED,
  -                                    elementType);
  +                                    element.rawname);
                   return -1;
               }
           }
  -    }
  -    //
  -    // [47] children ::= (choice | seq) ('?' | '*' | '+')?
  -    // [49] choice ::= '(' S? cp ( S? '|' S? cp )* S? ')'
  -    // [50] seq ::= '(' S? cp ( S? ',' S? cp )* S? ')'
  -    // [48] cp ::= (Name | choice | seq) ('?' | '*' | '+')?
  -    //
  -    private int scanChildren(int elementType) throws Exception
  -    {
  +
  +    } // scanMixed(QName):int
  +    
  +    /**
  +     * Scans a children content model.
  +     * <pre>
  +     * [47] children ::= (choice | seq) ('?' | '*' | '+')?
  +     * [49] choice ::= '(' S? cp ( S? '|' S? cp )* S? ')'
  +     * [50] seq ::= '(' S? cp ( S? ',' S? cp )* S? ')'
  +     * [48] cp ::= (Name | choice | seq) ('?' | '*' | '+')?
  +     * </pre>
  +     */
  +    private int scanChildren(QName element) throws Exception {
  +        
           int depth = 1;
           initializeContentModelStack(depth);
           while (true) {
  @@ -1811,11 +1844,12 @@
                   initializeContentModelStack(depth);
                   continue;
               }
  -            int valueIndex = fEventHandler.checkForElementTypeWithPEReference(fEntityReader, ')');
  +            fEventHandler.checkForElementTypeWithPEReference(fEntityReader, ')', fElementRefQName);
  +            int valueIndex = fElementRefQName.rawname;
               if (valueIndex == -1) {
                   reportFatalXMLError(XMLMessages.MSG_OPEN_PAREN_OR_ELEMENT_TYPE_REQUIRED_IN_CHILDREN,
                                       XMLMessages.P47_OPEN_PAREN_OR_ELEMENT_TYPE_REQUIRED,
  -                                    elementType);
  +                                    element.rawname);
                   return -1;
               }
               fNodeIndexStack[depth] = fEventHandler.addContentSpecNode(XMLContentSpec.CONTENTSPECNODE_LEAF, valueIndex);
  @@ -1846,7 +1880,7 @@
                       if (!fEntityReader.lookingAtChar(')', true)) {
                           reportFatalXMLError(XMLMessages.MSG_CLOSE_PAREN_REQUIRED_IN_CHILDREN,
                                               XMLMessages.P47_CLOSE_PAREN_REQUIRED,
  -                                            elementType);
  +                                            element.rawname);
                       }
                       decreaseParenDepth();
                       if (fPrevNodeIndexStack[depth] != -1) {
  @@ -1868,7 +1902,9 @@
               }
               checkForPEReference(false);
           }
  -    }
  +
  +    } // scanChildren(QName):int
  +
       //
       // [52] AttlistDecl ::= '<!ATTLIST' S Name AttDef* S? '>'
       // [53] AttDef ::= S Name S AttType S DefaultDecl
  @@ -1881,13 +1917,14 @@
                           XMLMessages.P52_SPACE_REQUIRED);
               return;
           }
  -        int elementTypeIndex = fEventHandler.checkForElementTypeWithPEReference(fEntityReader, ' ');
  +        fEventHandler.checkForElementTypeWithPEReference(fEntityReader, ' ', fElementQName);
  +        int elementTypeIndex = fElementQName.rawname;
           if (elementTypeIndex == -1) {
               abortMarkup(XMLMessages.MSG_ELEMENT_TYPE_REQUIRED_IN_ATTLISTDECL,
                           XMLMessages.P52_ELEMENT_TYPE_REQUIRED);
               return;
           }
  -        int elementIndex = fEventHandler.addElementDecl(elementTypeIndex);
  +        int elementIndex = fEventHandler.addElementDecl(fElementQName);
           boolean sawSpace = checkForPEReference(true);
           if (fEntityReader.lookingAtChar('>', true)) {
               decreaseMarkupDepth();
  @@ -1910,11 +1947,12 @@
               return;
           }
           while (true) {
  -            int attDefName = fEventHandler.checkForAttributeNameWithPEReference(fEntityReader, ' ');
  +            fEventHandler.checkForAttributeNameWithPEReference(fEntityReader, ' ', fAttributeQName);
  +            int attDefName = fAttributeQName.rawname;
               if (attDefName == -1) {
                   abortMarkup(XMLMessages.MSG_ATTRIBUTE_NAME_REQUIRED_IN_ATTDEF,
                               XMLMessages.P53_NAME_REQUIRED,
  -                            elementTypeIndex);
  +                            fElementQName.rawname);
                   return;
               }
               if (!checkForPEReference(true)) {
  @@ -2009,7 +2047,11 @@
                       attDefDefaultType = fFIXED;
                   } else
                       attDefDefaultType = fDEFAULT;
  -                attDefDefaultValue = fEventHandler.scanDefaultAttValue(elementTypeIndex, attDefName, attDefType, attDefEnumeration);
  +                fElementQName.setValues(-1, elementTypeIndex, elementTypeIndex);
  +                fAttributeQName.setValues(-1, attDefName, attDefName);
  +                attDefDefaultValue = fEventHandler.scanDefaultAttValue(fElementQName, fAttributeQName, 
  +                                                                       attDefType, 
  +                                                                       attDefEnumeration);
                   if (attDefDefaultValue == -1) {
                       skipPastEndOfCurrentMarkup();
                       return;
  @@ -2033,7 +2075,7 @@
               }
               sawSpace = checkForPEReference(true);
               if (fEntityReader.lookingAtChar('>', true)) {
  -                int attDefIndex = fEventHandler.addAttDef(elementIndex, attDefName, attDefType, attDefEnumeration, attDefDefaultType, attDefDefaultValue);
  +                int attDefIndex = fEventHandler.addAttDef(fElementQName, fAttributeQName, attDefType, attDefEnumeration, attDefDefaultType, attDefDefaultValue);
                   decreaseMarkupDepth();
                   return;
               }
  @@ -2050,11 +2092,11 @@
                   }
               }
               if (fEntityReader.lookingAtChar('>', true)) {
  -                int attDefIndex = fEventHandler.addAttDef(elementIndex, attDefName, attDefType, attDefEnumeration, attDefDefaultType, attDefDefaultValue);
  +                int attDefIndex = fEventHandler.addAttDef(fElementQName, fAttributeQName, attDefType, attDefEnumeration, attDefDefaultType, attDefDefaultValue);
                   decreaseMarkupDepth();
                   return;
               }
  -            int attDefIndex = fEventHandler.addAttDef(elementIndex, attDefName, attDefType, attDefEnumeration, attDefDefaultType, attDefDefaultValue);
  +            int attDefIndex = fEventHandler.addAttDef(fElementQName, fAttributeQName, attDefType, attDefEnumeration, attDefDefaultType, attDefDefaultValue);
           }
       }
       //
  @@ -2119,21 +2161,21 @@
        * @return handle in the string pool for the default attribute value
        * @exception java.lang.Exception
        */
  -    public int scanDefaultAttValue(int elementType, int attrName) throws Exception
  +    public int scanDefaultAttValue(QName element, QName attribute) throws Exception
       {
           boolean single;
           if (!(single = fEntityReader.lookingAtChar('\'', true)) && !fEntityReader.lookingAtChar('\"', true)) {
               reportFatalXMLError(XMLMessages.MSG_QUOTE_REQUIRED_IN_ATTVALUE,
                                   XMLMessages.P10_QUOTE_REQUIRED,
  -                                elementType,
  -                                attrName);
  +                                element.rawname,
  +                                attribute.rawname);
               return -1;
           }
           int previousState = setScannerState(SCANNER_STATE_DEFAULT_ATTRIBUTE_VALUE);
           char qchar = single ? '\'' : '\"';
           fDefaultAttValueReader = fReaderId;
  -        fDefaultAttValueElementType = elementType;
  -        fDefaultAttValueAttrName = attrName;
  +        fDefaultAttValueElementType = element.rawname;
  +        fDefaultAttValueAttrName = attribute.rawname;
           boolean setMark = true;
           int dataOffset = fLiteralData.length();
           while (true) {
  @@ -2204,8 +2246,8 @@
                   setMark = true;
                   reportFatalXMLError(XMLMessages.MSG_LESSTHAN_IN_ATTVALUE,
                                       XMLMessages.WFC_NO_LESSTHAN_IN_ATTVALUE,
  -                                    elementType,
  -                                    attrName);
  +                                    element.rawname,
  +                                    attribute.rawname);
                   continue;
               }
               //
  @@ -2235,8 +2277,8 @@
                   if (invChar >= 0) {
                       reportFatalXMLError(XMLMessages.MSG_INVALID_CHAR_IN_ATTVALUE,
                                           XMLMessages.P10_INVALID_CHARACTER,
  -                                        fStringPool.toString(elementType),
  -                                        fStringPool.toString(attrName),
  +                                        fStringPool.toString(element.rawname),
  +                                        fStringPool.toString(attribute.rawname),
                                           Integer.toHexString(invChar));
                   }
                   continue;
  
  
  
  1.15.2.1  +2 -2      xml-xerces/java/src/org/apache/xerces/framework/XMLParser.java
  
  Index: XMLParser.java
  ===================================================================
  RCS file: /home/cvs/xml-xerces/java/src/org/apache/xerces/framework/XMLParser.java,v
  retrieving revision 1.15
  retrieving revision 1.15.2.1
  diff -u -r1.15 -r1.15.2.1
  --- XMLParser.java	2000/04/04 21:14:21	1.15
  +++ XMLParser.java	2000/04/17 21:40:55	1.15.2.1
  @@ -89,7 +89,7 @@
   /**
    * This is the base class of all standard parsers.
    *
  - * @version $Id: XMLParser.java,v 1.15 2000/04/04 21:14:21 andyc Exp $
  + * @version $Id: XMLParser.java,v 1.15.2.1 2000/04/17 21:40:55 jeffreyr Exp $
    */
   public class XMLParser implements XMLErrorReporter {
   
  @@ -142,7 +142,7 @@
       // debugging
   
       /** Set to true and recompile to print exception stack trace. */
  -    private static final boolean PRINT_EXCEPTION_STACK_TRACE = false;
  +    private static final boolean PRINT_EXCEPTION_STACK_TRACE = true;
   
       //
       // Data