sboag       00/05/25 22:50:22

  Modified:    src/org/apache/xalan/xpath/dtm DTMLiaison.java DTM.java
  Log:
  Fixed IDs and namespaces (related to Xerces changes).
  
  Revision  Changes    Path
  1.16      +11 -3     xml-xalan/src/org/apache/xalan/xpath/dtm/DTMLiaison.java
  
  Index: DTMLiaison.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/src/org/apache/xalan/xpath/dtm/DTMLiaison.java,v
  retrieving revision 1.15
  retrieving revision 1.16
  diff -u -r1.15 -r1.16
  --- DTMLiaison.java   2000/03/29 03:51:55     1.15
  +++ DTMLiaison.java   2000/05/26 05:50:21     1.16
  @@ -216,12 +216,20 @@
   
           if(null != m_locale)
             parser.setLocale(m_locale);
  +        
  +        // Set whether or not to create entity ref nodes
  +        
parser.setFeature("http://apache.org/xml/features/dom/create-entity-ref-nodes";, 
  +                          getShouldExpandEntityRefs());
  +
  +        parser.setFeature("http://xml.org/sax/features/namespaces";, true);
   
           if(getUseValidation())
             parser.setFeature("http://xml.org/sax/features/validation";, true);
  -
  -        // Set whether or not to create entity ref nodes
  -        
parser.setFeature("http://apache.org/xml/features/dom/create-entity-ref-nodes";, 
getShouldExpandEntityRefs());
  +        else
  +        {
  +          // This doesn't seem to work, but I'm a setting it anyhow.
  +          
parser.setFeature("http://apache.org/xml/features/validation/dynamic";, true);
  +        }
   
           if(m_doThreading)
           {
  
  
  
  1.20      +34 -77    xml-xalan/src/org/apache/xalan/xpath/dtm/DTM.java
  
  Index: DTM.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/src/org/apache/xalan/xpath/dtm/DTM.java,v
  retrieving revision 1.19
  retrieving revision 1.20
  diff -u -r1.19 -r1.20
  --- DTM.java  2000/05/23 21:20:57     1.19
  +++ DTM.java  2000/05/26 05:50:21     1.20
  @@ -166,9 +166,9 @@
     ChunkedIntArray m_entityNodes = null;
     IntMap m_entities = new IntMap();
     
  -  IntToObjectMap m_elementDecls = new IntToObjectMap();
  +  // IntToObjectMap m_elementDecls = new IntToObjectMap();
     
  -  IntMap m_idMap = new IntMap();
  +  Hashtable m_idMap = new Hashtable();
     
     /**
      * Namespace lookup. This is actually a stack of StringToStringTables
  @@ -499,7 +499,7 @@
       
       previousSibling = 0;
       
  -    IntMap elemMap = (IntMap)m_elementDecls.get(qname.rawname);
  +    // IntMap elemMap = (IntMap)m_elementDecls.get(qname.rawname);
   
       // Append the attributes
       if(attrListIndex!=-1)
  @@ -513,6 +513,12 @@
           int attrNameIndex = xmlAttrList.getAttrName(index);
           attrname=fStringPool.toString(attrNameIndex);
           
  +        if (xmlAttrList.getAttType(index) == fStringPool.addSymbol("ID")) {
  +          int nameIndex = xmlAttrList.getAttValue(index);
  +          m_idMap.put(fStringPool.toString(nameIndex), new Integer( ourslot 
));
  +        }
  +        
  +        /*
           if(null != elemMap)
           {
             int attrDecl = elemMap.get(attrNameIndex);
  @@ -526,6 +532,7 @@
               m_idMap.put(valIndex, ourslot);
             }
           }
  +        */
   
           int w0;
           int colonpos = attrname.indexOf(':');
  @@ -627,40 +634,8 @@
       throws org.xml.sax.SAXException
     {
       throw new 
SAXException(XSLMessages.createXPATHMessage(XPATHErrorResources.ER_SAX_API_NOT_HANDLED,
 null)); //"SAX API characters(char ch[]... not handled by the DTM!");
  -  }
  -    
  -  /**
  -   * callback for an element declaration. 
  -   *
  -   * @param elementType element handle of the element being declared
  -   * @param contentSpec contentSpec for the element being declared
  -   * @see org.apache.xerces.framework.XMLContentSpec
  -   * @exception java.lang.Exception
  -   */
  -  public void elementDecl(QName elementDecl, XMLContentSpec contentSpec) 
throws Exception
  -  {
  -  }
  -
  -  /**
  -   * callback for an attribute list declaration. 
  -   *
  -   * @param elementType element handle for the attribute's element
  -   * @param attrName string pool index of the attribute name
  -   * @param attType type of attribute
  -   * @param enumString String representing the values of the enumeration,
  -   *        if the attribute is of enumerated type, or null if it is not.
  -   * @param attDefaultType an integer value denoting the DefaultDecl value
  -   * @param attDefaultValue string pool index of this attribute's default 
value 
  -   *        or -1 if there is no defaultvalue 
  -   * @exception java.lang.Exception
  -   */
  -  public void attlistDecl(QName elementDecl, QName attributeDecl,
  -                          int attType, String enumString,
  -                          int attDefaultType,
  -                          int attDefaultValue) throws Exception
  -  {
     }
  -  
  +      
     /**
      * callback for the start of the DTD
      * This function will be called when a <!DOCTYPE...> declaration is
  @@ -1030,56 +1005,39 @@
      *  This function will be called at the end of the DTD.
      */
     public final void endDTD() throws Exception {}
  -
  +  
     /**
      * <!ELEMENT Name contentspec>
      */
  -  public final void elementDecl(int elementType, XMLContentSpec contentSpec)
  +  public final void elementDecl(QName elementDecl, XMLContentSpec 
contentSpec)
       throws Exception 
     {
  -    if (DEBUG) 
  +    if (false) 
       {
  -      System.out.println("elementDecl(" + fStringPool.toString(elementType) 
+ ", " +
  +      System.out.println("elementDecl(" + 
fStringPool.toString(elementDecl.rawname) + ", " +
                            contentSpec + ")");
       }
     }
  -
  +  
     /**
  -   * <!ATTLIST Name AttDef>
  +   * callback for an attribute list declaration. 
  +   *
  +   * @param elementType element handle for the attribute's element
  +   * @param attrName string pool index of the attribute name
  +   * @param attType type of attribute
  +   * @param enumString String representing the values of the enumeration,
  +   *        if the attribute is of enumerated type, or null if it is not.
  +   * @param attDefaultType an integer value denoting the DefaultDecl value
  +   * @param attDefaultValue string pool index of this attribute's default 
value 
  +   *        or -1 if there is no defaultvalue 
  +   * @exception java.lang.Exception
      */
  -  public final void attlistDecl(int elementTypeIndex,
  -                          int attrNameIndex, int attType,
  +  public final void attlistDecl(QName elementDecl, QName attributeDecl, 
  +                                int attType,
                             String enumString,
                             int attDefaultType, int attDefaultValue)
       throws Exception 
     {
  -
  -    if (false) 
  -    {
  -      System.out.println("attlistDecl(" + 
fStringPool.toString(elementTypeIndex) + ", " +
  -                         fStringPool.toString(attrNameIndex) + ", " +
  -                         fStringPool.toString(attType) + ", " +
  -                         enumString + ", " +
  -                         fStringPool.toString(attDefaultType) + ", " +
  -                         fStringPool.toString(attDefaultValue) + ")");
  -    }
  -
  -
  -    if (false) 
  -    {
  -      System.out.println("  adding attribute value decl: "+
  -                         fStringPool.toString(attDefaultValue));
  -    }
  -    
  -    IntMap elemMap = (IntMap)m_elementDecls.get(elementTypeIndex);
  -    if(null == elemMap)
  -    {
  -      elemMap = new IntMap();
  -      m_elementDecls.put(elementTypeIndex, elemMap);
  -    }
  -    // ...hope we don't exceed bits...
  -    elemMap.put(attrNameIndex, (attType << 16) | ((attDefaultValue > 0) ? 
attDefaultValue : 0));
  -
     } // attlistDecl(int,int,int,String,int,int)
     
     /**
  @@ -1087,13 +1045,12 @@
      */
     public final Element getIdentifier(String id)
     {
  -    int strIndex = fStringPool.addSymbol(id);
  -    int elemNum = m_idMap.get(strIndex);
  -    if(elemNum <= 0)
  +    Integer elemNum = (Integer)m_idMap.get(id);
  +    if(elemNum == null)
       {
         // Then we have to keep trying until it has arrived, or the end of 
         // the document is found.
  -      while((elemNum <= 0) && !done && !m_isError)
  +      while((elemNum == null) && !done && !m_isError)
         {
           synchronized (this)
           {
  @@ -1107,11 +1064,11 @@
             {
               // That's OK, it's as good a time as any to check again
             }
  -          elemNum = m_idMap.get(strIndex);
  +          elemNum = (Integer)m_idMap.get(id);
           }
         }
       }
  -    return (elemNum > 0) ? getNode(elemNum) : null;
  +    return (elemNum != null) ? getNode(elemNum.intValue()) : null;
     }
   
     /**
  
  
  

Reply via email to