You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xalan.apache.org by sb...@apache.org on 2001/05/14 07:19:11 UTC

cvs commit: xml-xalan/java/src/org/apache/xml/dtm/sax2dtm SAX2DTM.java

sboag       01/05/13 22:19:11

  Modified:    java/src/org/apache/xalan/transformer Tag: DTM_EXP
                        TransformerImpl.java
               java/src/org/apache/xml/dtm Tag: DTM_EXP
                        DTMManagerDefault.java DTMTreeWalker.java
                        ExpandedNameTable.java
               java/src/org/apache/xml/dtm/dom2dtm Tag: DTM_EXP
                        DOM2DTM.java
  Added:       java/src/org/apache/xml/dtm/sax2dtm Tag: DTM_EXP
                        SAX2DTM.java
  Log:
  Added SAX2DTM class, as an alternative to the DTMDocumentImpl
  class.  Currently about 30 failures in the conformance suite.
  Also took non-DOM stuff out of DOM2DTM and put it in
  DTMDefaultBase, so it can share as an abstract base class
  between DOM2DTM and SAX2DTM.
  SAX2DTM doesn't have any CoRoutine support yet.
  
  Revision  Changes    Path
  No                   revision
  
  
  No                   revision
  
  
  1.90.2.6  +23 -23    xml-xalan/java/src/org/apache/xalan/transformer/TransformerImpl.java
  
  Index: TransformerImpl.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xalan/transformer/TransformerImpl.java,v
  retrieving revision 1.90.2.5
  retrieving revision 1.90.2.6
  diff -u -r1.90.2.5 -r1.90.2.6
  --- TransformerImpl.java	2001/05/11 03:11:32	1.90.2.5
  +++ TransformerImpl.java	2001/05/14 05:19:10	1.90.2.6
  @@ -933,31 +933,31 @@
       // If the Result object contains a Node, then create 
       // a ContentHandler that will add nodes to the input node.
       // %TBD%
  -    int outputNode = DTM.NULL;
  +    org.w3c.dom.Node outputNode = null;
       if(outputTarget instanceof DOMResult)
       {
  -      // %TBD%
  -//      outputNode = ((DOMResult)outputTarget).getNode();
  -//
  -//      Document doc;
  -//      short type;
  -//      if (null != outputNode)
  -//      {
  -//        type = outputNode.getNodeType();
  -//        doc = (Node.DOCUMENT_NODE == type)
  -//                       ? (Document) outputNode : outputNode.getOwnerDocument();
  -//      }
  -//      else
  -//      {
  -//        doc = getXPathContext().getDOMHelper().createDocument();
  -//        outputNode = doc;
  -//        type = outputNode.getNodeType();
  -//        ((DOMResult)outputTarget).setNode(outputNode);
  -//      }
  -//      
  -//      handler = (Node.DOCUMENT_FRAGMENT_NODE == type)
  -//                ? new DOMBuilder(doc, (DocumentFragment) outputNode)
  -//                  : new DOMBuilder(doc, outputNode);
  +      outputNode = ((DOMResult)outputTarget).getNode();
  +
  +      org.w3c.dom.Document doc;
  +      short type;
  +      if (null != outputNode)
  +      {
  +        type = outputNode.getNodeType();
  +        doc = (org.w3c.dom.Node.DOCUMENT_NODE == type)
  +                       ? (org.w3c.dom.Document) outputNode 
  +                       : outputNode.getOwnerDocument();
  +      }
  +      else
  +      {
  +        doc = getXPathContext().getDOMHelper().createDocument();
  +        outputNode = doc;
  +        type = outputNode.getNodeType();
  +        ((DOMResult)outputTarget).setNode(outputNode);
  +      }
  +      
  +      handler = (org.w3c.dom.Node.DOCUMENT_FRAGMENT_NODE == type)
  +                ? new DOMBuilder(doc, (org.w3c.dom.DocumentFragment) outputNode)
  +                  : new DOMBuilder(doc, outputNode);
       }
       else if(outputTarget instanceof SAXResult)
       {
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.1.2.5   +50 -8     xml-xalan/java/src/org/apache/xml/dtm/Attic/DTMManagerDefault.java
  
  Index: DTMManagerDefault.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xml/dtm/Attic/DTMManagerDefault.java,v
  retrieving revision 1.1.2.4
  retrieving revision 1.1.2.5
  diff -u -r1.1.2.4 -r1.1.2.5
  --- DTMManagerDefault.java	2001/05/11 03:11:36	1.1.2.4
  +++ DTMManagerDefault.java	2001/05/14 05:19:11	1.1.2.5
  @@ -70,6 +70,7 @@
   import org.apache.xml.utils.PrefixResolver;
   import org.apache.xml.utils.SystemIDResolver;
   import org.apache.xml.dtm.dom2dtm.DOM2DTM;
  +import org.apache.xml.dtm.sax2dtm.SAX2DTM;
   
   // W3C DOM
   import org.w3c.dom.Document;
  @@ -98,6 +99,8 @@
      *
      */
     public DTMManagerDefault(){}
  +  
  +  private static final boolean DUMPTREE = false;
   
     /**
      * Get an instance of a DTM, loaded with the content from the
  @@ -124,10 +127,12 @@
   
       if (source instanceof DOMSource)
       {
  -      DTM dtm = new DOM2DTM(this, (DOMSource) source, documentID,
  +      DOM2DTM dtm = new DOM2DTM(this, (DOMSource) source, documentID,
                               whiteSpaceFilter);
  -
         m_dtms.add(dtm);
  +      
  +      if(DUMPTREE)
  +        dtm.dumpDTM();
   
         return dtm;
       }
  @@ -160,15 +165,52 @@
             xmlSource.setSystemId(urlOfSource);
           }
             
  -        DTMDocumentImpl dtm = new DTMDocumentImpl(this, 
  -                                                  documentID, 
  -                                                  whiteSpaceFilter);
  -
  -        // It looks like you just construct this??
  -        DTMBuilder builder = new DTMBuilder(dtm, xmlSource, reader);
  +//        DTMDocumentImpl dtm = new DTMDocumentImpl(this, 
  +//                                                  documentID, 
  +//                                                  whiteSpaceFilter);
  +//
  +//        // It looks like you just construct this??
  +//        DTMBuilder builder = new DTMBuilder(dtm, xmlSource, reader);
  +
  +        SAX2DTM dtm = new SAX2DTM(this, 
  +                                  source,
  +                                  documentID, 
  +                                  whiteSpaceFilter);
  +                                  
  +        reader.setContentHandler(dtm);
  +        reader.setDTDHandler(dtm);
  +        reader.setErrorHandler(dtm);
           
  +        try 
  +        {
  +          reader.setProperty("http://xml.org/sax/properties/lexical-handler",
  +                                dtm);
  +        }
  +        catch (org.xml.sax.SAXException se) {}
  +        try
  +        {
  +          reader.setFeature("http://apache.org/xml/features/validation/dynamic",
  +                            true);
  +        }
  +        catch (org.xml.sax.SAXException se) {}
  +          
           m_dtms.add(dtm);
  +        
  +        try
  +        {
  +          reader.parse(xmlSource);
  +        }
  +        catch(RuntimeException re)
  +        {
  +          throw re;
  +        }
  +        catch(Exception e)
  +        {
  +          throw new org.apache.xml.utils.WrappedRuntimeException(e);
  +        }
   
  +        if(DUMPTREE)
  +          dtm.dumpDTM();
           return dtm;
         }
         else
  
  
  
  1.1.2.3   +30 -3     xml-xalan/java/src/org/apache/xml/dtm/Attic/DTMTreeWalker.java
  
  Index: DTMTreeWalker.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xml/dtm/Attic/DTMTreeWalker.java,v
  retrieving revision 1.1.2.2
  retrieving revision 1.1.2.3
  diff -u -r1.1.2.2 -r1.1.2.3
  --- DTMTreeWalker.java	2001/05/06 02:09:41	1.1.2.2
  +++ DTMTreeWalker.java	2001/05/14 05:19:11	1.1.2.3
  @@ -76,11 +76,18 @@
     /** Local reference to a ContentHandler          */
     private ContentHandler m_contentHandler = null;
   
  -  // ARGHH!!  JAXP Uses Xerces without setting the namespace processing to ON!
  -  // DOM2Helper m_dh = new DOM2Helper();
  -
     /** DomHelper for this TreeWalker          */
     protected DTM m_dtm;
  +  
  +  /**
  +   * Set the DTM to be traversed.
  +   * 
  +   * @param dtm The Document Table Model to be used.
  +   */
  +  public void setDTM(DTM dtm)
  +  {
  +    m_dtm = dtm;
  +  }
   
     /**
      * Get the ContentHandler used for the tree walk.
  @@ -90,6 +97,26 @@
     public ContentHandler getcontentHandler()
     {
       return m_contentHandler;
  +  }
  +  
  +  /**
  +   * Set the ContentHandler used for the tree walk.
  +   *
  +   * @param ch the ContentHandler to be the result of the tree walk.
  +   */
  +  public void setcontentHandler(ContentHandler ch)
  +  {
  +    m_contentHandler = ch;
  +  }
  +
  +  
  +  /**
  +   * Constructor.
  +   * @param   contentHandler The implemention of the
  +   * contentHandler operation (toXMLString, digest, ...)
  +   */
  +  public DTMTreeWalker()
  +  {
     }
     
     /**
  
  
  
  1.1.2.5   +30 -8     xml-xalan/java/src/org/apache/xml/dtm/Attic/ExpandedNameTable.java
  
  Index: ExpandedNameTable.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xml/dtm/Attic/ExpandedNameTable.java,v
  retrieving revision 1.1.2.4
  retrieving revision 1.1.2.5
  diff -u -r1.1.2.4 -r1.1.2.5
  --- ExpandedNameTable.java	2001/05/09 22:02:53	1.1.2.4
  +++ ExpandedNameTable.java	2001/05/14 05:19:11	1.1.2.5
  @@ -79,12 +79,12 @@
     /** Probably a reference to static pool.   */
     private DTMStringPool m_namespaceNames;
     
  -  static int BITS_PER_LOCALNAME = 16;
  -  static int BITS_PER_NAMESPACE = 10;
  +  public static int BITS_PER_LOCALNAME = 16;
  +  public static int BITS_PER_NAMESPACE = 10;
   
  -  static int MASK_LOCALNAME = 0x0000FFFF;
  -  static int MASK_NAMESPACE = 0x03FF0000;
  -  static int MASK_NODETYPE = 0xFC000000;
  +  public static int MASK_LOCALNAME = 0x0000FFFF;
  +  public static int MASK_NAMESPACE = 0x03FF0000;
  +  public static int MASK_NODETYPE = 0xFC000000;
   
     /**
      * Create an expanded name table that uses private string pool lookup.
  @@ -129,16 +129,37 @@
   
       return expandedTypeID;
     }
  +  
  +  /**
  +   * Given a type, return an expanded name ID.Any additional nodes that are 
  +   * created that have this expanded name will use this ID.
  +   *
  +   * @param namespace
  +   * @param localName
  +   *
  +   * @return the expanded-name id of the node.
  +   */
  +  public int getExpandedNameID(int type)
  +  {
  +    int expandedTypeID = (type << (BITS_PER_NAMESPACE+BITS_PER_LOCALNAME));
  +
  +    return expandedTypeID;
  +  }
   
     /**
      * Given an expanded-name ID, return the local name part.
      *
      * @param ExpandedNameID an ID that represents an expanded-name.
  -   * @return String Local name of this node.
  +   * @return String Local name of this node, or null if the node has no name.
      */
     public String getLocalName(int ExpandedNameID)
     {
  -    return m_namespaceNames.indexToString(ExpandedNameID & MASK_LOCALNAME);
  +    int localNameID = (ExpandedNameID & MASK_LOCALNAME);
  +    
  +    if (0 == localNameID) 
  +      return null;
  +    else
  +      return m_locNamesPool.indexToString(localNameID);
     }
   
     /**
  @@ -151,7 +172,8 @@
     public String getNamespace(int ExpandedNameID)
     {
   
  -    return m_namespaceNames.indexToString((ExpandedNameID & MASK_NAMESPACE) >> BITS_PER_LOCALNAME);
  +    int id = (ExpandedNameID & MASK_NAMESPACE) >> BITS_PER_LOCALNAME;
  +    return (0 == id) ? null : m_namespaceNames.indexToString(id);
     }
   
     /**
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.1.2.10  +106 -1087 xml-xalan/java/src/org/apache/xml/dtm/dom2dtm/Attic/DOM2DTM.java
  
  Index: DOM2DTM.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xml/dtm/dom2dtm/Attic/DOM2DTM.java,v
  retrieving revision 1.1.2.9
  retrieving revision 1.1.2.10
  diff -u -r1.1.2.9 -r1.1.2.10
  --- DOM2DTM.java	2001/05/10 20:48:41	1.1.2.9
  +++ DOM2DTM.java	2001/05/14 05:19:11	1.1.2.10
  @@ -78,84 +78,61 @@
   /**
    * The <code>DOM2DTM</code> class serves up a DOM via a DTM API.
    */
  -public class DOM2DTM implements DTM
  +public class DOM2DTM extends DTMDefaultBase
   {
  -
     /**
  -   * The node objects.  The instance part of the handle indexes directly
  -   * into this vector.  Each DTM node may actually be composed of several
  -   * DOM nodes.
  -   */
  -  protected Vector m_nodes = new Vector();
  -
  -  /**
  -   * This is extra information about the node objects.  Each information
  -   * block is composed of several array members.  The size of this will always
  -   * be (m_nodes.size() * NODEINFOBLOCKSIZE).
  +   * This represents the number of integers per node in the
  +   * <code>m_info</code> member variable.
      */
  -  protected IntVector m_info = new IntVector();
  -
  -  // Offsets into each set of integers in the <code>m_info</code> table.
  -
  -  /** %TBD% Doc */
  -  static final int OFFSET_EXPANDEDNAMEID = 0;
  -
  -  /** %TBD% Doc */
  -  static final int OFFSET_TYPE = 1;
  +  protected static final int NODEINFOBLOCKSIZE = DEFAULTNODEINFOBLOCKSIZE;
   
  -  /** %TBD% Doc */
  -  static final int OFFSET_LEVEL = 2;
  -
  -  /** %TBD% Doc */
  -  static final int OFFSET_FIRSTCHILD = 3;
  -
  -  /** %TBD% Doc */
  -  static final int OFFSET_NEXTSIBLING = 4;
  +  /** The top of the subtree, may not be the same as m_context if "//foo" pattern. */
  +  transient private Node m_root;
   
  -  /** %TBD% Doc */
  -  static final int OFFSET_PREVSIBLING = 5;
  +  /** The current position in the tree. */
  +  transient private Node m_pos;
   
  -  /** %TBD% Doc */
  -  static final int OFFSET_PARENT = 6;
  +  /** true if all the nodes have been processed. */
  +  transient private boolean m_nodesAreProcessed;
   
     /**
  -   * This represents the number of integers per node in the
  -   * <code>m_info</code> member variable.
  +   * %TBD% Needs doc... how to explain?
  +   * [0] index of parent.
  +   * [1] index of previous sibling.
      */
  -  static final int NODEINFOBLOCKSIZE = 7;
  +  transient private IntStack m_levelInfo = new IntStack();
   
     /**
  -   * The value to use when the information has not been built yet.
  +   * %TBD% Doc
      */
  -  static final int NOTPROCESSED = DTM.NULL - 1;
  -
  -  /** NEEDSDOC Field NODEIDENTITYBITS */
  -  static final int NODEIDENTITYBITS = 0x000FFFFF;
  +  transient private NamedNodeMap m_attrs;
   
     /**
  -   * The DTM manager who "owns" this DTM.
  +   * %TBD% Doc
      */
  -  protected DTMManager m_mgr;
  +  transient private int m_attrsPos;
   
  -  /** %TBD% Doc */
  -  protected int m_dtmIdent;
  +  /** NEEDSDOC Field LEVELINFO_PARENT */
  +  static final int LEVELINFO_PARENT = 1;
   
  -  /** %TBD% Doc */
  -  protected int m_mask;
  +  /** NEEDSDOC Field LEVELINFO_PREVSIB */
  +  static final int LEVELINFO_PREVSIB = 0;
   
  -  /** %TBD% Doc */
  -  protected String m_documentBaseURI;
  +  /** NEEDSDOC Field LEVELINFO_NPERLEVEL */
  +  static final int LEVELINFO_NPERLEVEL = 2;
     
  -  /**
  -   * The whitespace filter that enables elements to strip whitespace or not.
  -   */
  -  protected DTMWSFilter m_wsfilter;
  +  /** Samed element for attribute iteration */
  +  private Node m_elementForAttrs;
     
  -  /** Flag indicating whether to strip whitespace nodes          */
  -  private boolean m_shouldStripWS = false;
  +  /** Samed element index for attribute iteration */
  +  private int m_elementForAttrsIndex;
   
  -  /** Stack of flags indicating whether to strip whitespace nodes          */
  -  private BoolStack m_shouldStripWhitespaceStack;
  +  /**
  +   * The node objects.  The instance part of the handle indexes directly
  +   * into this vector.  Each DTM node may actually be composed of several
  +   * DOM nodes.
  +   */
  +  protected Vector m_nodes = new Vector();
   
     /**
      * Construct a DOM2DTM object from a DOM node.
  @@ -169,20 +146,11 @@
     public DOM2DTM(DTMManager mgr, DOMSource domSource, 
                    int dtmIdentity, DTMWSFilter whiteSpaceFilter)
     {
  +    super(mgr, domSource, dtmIdentity, whiteSpaceFilter);
   
  -    m_mgr = mgr;
       m_root = domSource.getNode();
  -    m_documentBaseURI = domSource.getSystemId();
       m_pos = null;
       m_nodesAreProcessed = false;
  -    m_dtmIdent = dtmIdentity;
  -    m_mask = mgr.getNodeIdentityMask();
  -    m_wsfilter = whiteSpaceFilter;
  -    if(null != whiteSpaceFilter)
  -    {
  -      m_shouldStripWhitespaceStack = new BoolStack();
  -      pushShouldStripWhitespace(false);
  -    }
       addNode(m_root, 0, DTM.NULL, DTM.NULL);
     }
   
  @@ -237,9 +205,15 @@
       }
       
       String nsURI = node.getNamespaceURI();
  -    String localName = node.getLocalName();
  -    int expandedNameID 
  -        = m_mgr.getExpandedNameTable(this).getExpandedNameID(nsURI, localName, type);
  +    String localName =  (type == Node.PROCESSING_INSTRUCTION_NODE) ? 
  +                         node.getNodeName() :
  +                         node.getLocalName();
  +    ExpandedNameTable exnt = m_mgr.getExpandedNameTable(this);
  +
  +    int expandedNameID = (null != localName) 
  +       ? exnt.getExpandedNameID(nsURI, localName, type) :
  +         exnt.getExpandedNameID(type);
  +
       m_info.setElementAt(expandedNameID, startInfo + OFFSET_EXPANDEDNAMEID);    
   
       if (DTM.NULL != previousSibling)
  @@ -251,57 +225,24 @@
   
       return nodeIndex;
     }
  -
  -  /** The top of the subtree, may not be the same as m_context if "//foo" pattern. */
  -  transient private Node m_root;
  -
  -  /** The current position in the tree. */
  -  transient private Node m_pos;
  -
  -  /** true if all the nodes have been processed. */
  -  transient private boolean m_nodesAreProcessed;
  -
  -  /**
  -   * %TBD% Needs doc... how to explain?
  -   * [0] index of parent.
  -   * [1] index of previous sibling.
  -   */
  -  transient private IntStack m_levelInfo = new IntStack();
  -
  -  /**
  -   * %TBD% Doc
  -   */
  -  transient private NamedNodeMap m_attrs;
  -
  +  
     /**
  -   * %TBD% Doc
  +   * Return the number of integers in each node info block.
      */
  -  transient private int m_attrsPos;
  -
  -  /** NEEDSDOC Field LEVELINFO_PARENT */
  -  static final int LEVELINFO_PARENT = 1;
  -
  -  /** NEEDSDOC Field LEVELINFO_PREVSIB */
  -  static final int LEVELINFO_PREVSIB = 0;
  -
  -  /** NEEDSDOC Field LEVELINFO_NPERLEVEL */
  -  static final int LEVELINFO_NPERLEVEL = 2;
  -  
  -  /** Samed element for attribute iteration */
  -  private Node m_elementForAttrs;
  -  
  -  /** Samed element index for attribute iteration */
  -  private int m_elementForAttrsIndex;
  +  protected int getNodeInfoBlockSize()
  +  {
  +    return NODEINFOBLOCKSIZE;
  +  }
   
     /**
      * This method iterates to the next node that will be added to the table.
      * Each call to this method adds a new node to the table, unless the end
      * is reached, in which case it returns null.
      *
  -   * @return The next node in the tree, in document order, or null if 
  +   * @return The true if a next node is found or false if 
      *         there are no more nodes.
      */
  -  protected Node nextNode()
  +  protected boolean nextNode()
     {
       // Non-recursive one-fetch-at-a-time depth-first traversal with 
       // attribute/namespace nodes and white-space stripping.
  @@ -309,8 +250,14 @@
       // constructive suggestions on how to make this cleaner.
   
       if (m_nodesAreProcessed)
  +    {
  +      return false;
  +    }
  +    
  +    if(m_nodes.size() == 47)
       {
  -      return null;
  +      int x = 5;
  +      x++;
       }
   
       Node top = m_root;  // tells us when to stop.
  @@ -401,6 +348,11 @@
         }
         
         nextNode = pos.getNextSibling();
  +      if(null != nextNode && Node.DOCUMENT_TYPE_NODE == nextNode.getNodeType())
  +      {
  +        // Xerces
  +        nextNode = nextNode.getNextSibling(); // just skip it.
  +      }
         
         if(Node.ELEMENT_NODE == pos.getNodeType())
         {
  @@ -437,7 +389,9 @@
           {
             m_info.setElementAt(DTM.NULL, posInfo + OFFSET_NEXTSIBLING);
             nextNode = null;
  -          break;
  +          // break;
  +          m_nodesAreProcessed = true;
  +          return false;
           }
         }
           
  @@ -467,13 +421,13 @@
                     getShouldStripWhitespace() : (DTMWSFilter.STRIP == wsv);
           pushShouldStripWhitespace(shouldStrip);
         }
  -      return pos;
  +      return true;
       }
   
   
       m_nodesAreProcessed = true;
       m_pos = null;
  -    return null;
  +    return false;
     }
   
     /**
  @@ -517,9 +471,7 @@
   
       if (identity >= m_nodes.size())
       {
  -      Node node = nextNode();
  -
  -      if (null == node)
  +      if (!nextNode())
           identity = DTM.NULL;
       }
   
  @@ -552,116 +504,6 @@
     }
   
     /**
  -   * Get a node handle that is relative to the given node.
  -   *
  -   * @param identity The node identity.
  -   * @param offsetValue One of OFFSET_XXX values.
  -   * @return The relative node handle.
  -   */
  -  protected int getNodeInfo(int identity, int offsetValue)
  -  {
  -
  -    int base = (identity * NODEINFOBLOCKSIZE);
  -    int info = m_info.elementAt(base + offsetValue);
  -
  -    // Check to see if the information requested has been processed, and, 
  -    // if not, advance the iterator until we the information has been 
  -    // processed.
  -    while (info == NOTPROCESSED)
  -    {
  -      Node node = nextNode();
  -
  -      info = m_info.elementAt(base + offsetValue);
  -    }
  -
  -    return info;
  -  }
  -
  -  // ========= DTM Implementation Control Functions. ==============
  -
  -  /**
  -   * Set a suggested parse block size for the parser.
  -   *
  -   * @param blockSizeSuggestion Suggested size of the parse blocks, in bytes.
  -   */
  -  public void setParseBlockSize(int blockSizeSuggestion){}
  -
  -  /**
  -   * Set an implementation dependent feature.
  -   * <p>
  -   * %REVIEW% Do we really expect to set features on DTMs?
  -   *
  -   * @param featureId A feature URL.
  -   * @param state true if this feature should be on, false otherwise.
  -   */
  -  public void setFeature(String featureId, boolean state){}
  -
  -  // ========= Document Navigation Functions =========
  -
  -  /**
  -   * Given a node handle, test if it has child nodes.
  -   * <p> %REVIEW% This is obviously useful at the DOM layer, where it
  -   * would permit testing this without having to create a proxy
  -   * node. It's less useful in the DTM API, where
  -   * (dtm.getFirstChild(nodeHandle)!=DTM.NULL) is just as fast and
  -   * almost as self-evident. But it's a convenience, and eases porting
  -   * of DOM code to DTM.  </p>
  -   *
  -   * @param nodeHandle int Handle of the node.
  -   * @return int true if the given node has child nodes.
  -   */
  -  public boolean hasChildNodes(int nodeHandle)
  -  {
  -
  -    // %REVIEW% This may not be OK if there is an entity child?
  -    Node node = getNode(nodeHandle);
  -
  -    return node.hasChildNodes();
  -  }
  -
  -  /**
  -   * Given a node handle, get the handle of the node's first child.
  -   * If not yet resolved, waits for more nodes to be added to the document and
  -   * tries again.
  -   *
  -   * @param nodeHandle int Handle of the node.
  -   * @return int DTM node-number of first child, or DTM.NULL to indicate none exists.
  -   */
  -  public int getFirstChild(int nodeHandle)
  -  {
  -
  -    int identity = nodeHandle & m_mask;
  -    int firstChild = getNodeInfo(identity, OFFSET_FIRSTCHILD);
  -
  -    return firstChild | m_dtmIdent;
  -  }
  -
  -  /**
  -   * Given a node handle, advance to its last child.
  -   * If not yet resolved, waits for more nodes to be added to the document and
  -   * tries again.
  -   *
  -   * @param nodeHandle int Handle of the node.
  -   * @return int Node-number of last child,
  -   * or DTM.NULL to indicate none exists.
  -   */
  -  public int getLastChild(int nodeHandle)
  -  {
  -
  -    int identity = nodeHandle & m_mask;
  -    int child = getNodeInfo(identity, OFFSET_FIRSTCHILD);
  -    int lastChild = DTM.NULL;
  -
  -    while (child != DTM.NULL)
  -    {
  -      lastChild = child;
  -      child = getNodeInfo(child, OFFSET_NEXTSIBLING);
  -    }
  -
  -    return lastChild | m_dtmIdent;
  -  }
  -
  -  /**
      * Retrieves an attribute node by by qualified name and namespace URI.
      *
      * @param nodeHandle int Handle of the node upon which to look up this attribute..
  @@ -672,442 +514,49 @@
      * @return The attribute node handle with the specified name (
      *   <code>nodeName</code>) or <code>DTM.NULL</code> if there is no such
      *   attribute.
  -   */
  -  public int getAttributeNode(int nodeHandle, String namespaceURI,
  -                              String name)
  -  {
  -
  -    // %OPT% This is probably slower than it needs to be.
  -    if (null == namespaceURI)
  -      namespaceURI = "";
  -
  -    int type = getNodeType(nodeHandle);
  -
  -    if (DTM.ELEMENT_NODE == type)
  -    {
  -
  -      // Assume that attributes immediately follow the element.
  -      int identity = nodeHandle & m_mask;
  -
  -      while (DTM.NULL != (identity = getNextNodeIdentity(identity)))
  -      {
  -        // Assume this can not be null.
  -        type = getNodeType(identity);
  -
  -        if (type == DTM.ATTRIBUTE_NODE)
  -        {
  -          Node node = lookupNode(identity);
  -          String nodeuri = node.getNamespaceURI();
  -
  -          if (null == nodeuri)
  -            nodeuri = "";
  -
  -          String nodelocalname = node.getLocalName();
  -
  -          if (nodeuri.equals(namespaceURI) && name.equals(nodelocalname))
  -            return identity | m_dtmIdent;
  -        }
  -        else if (DTM.NAMESPACE_NODE != type)
  -        {
  -          break;
  -        }
  -      }
  -    }
  -
  -    return DTM.NULL;
  -  }
  -
  -  /**
  -   * Given a node handle, get the index of the node's first attribute.
  -   *
  -   * @param nodeHandle int Handle of the node.
  -   * @return Handle of first attribute, or DTM.NULL to indicate none exists.
  -   */
  -  public int getFirstAttribute(int nodeHandle)
  -  {
  -
  -    int type = getNodeType(nodeHandle);
  -
  -    if (DTM.ELEMENT_NODE == type)
  -    {
  -
  -      // Assume that attributes and namespaces immediately follow the element.
  -      int identity = nodeHandle & m_mask;
  -
  -      while (DTM.NULL != (identity = getNextNodeIdentity(identity)))
  -      {
  -        // Assume this can not be null.
  -        type = getNodeType(identity);
  -
  -        if (type == DTM.ATTRIBUTE_NODE)
  -        {
  -          return identity | m_dtmIdent;
  -        }
  -        else if (DTM.NAMESPACE_NODE != type)
  -        {
  -          break;
  -        }
  -      }
  -    }
  -
  -    return DTM.NULL;
  -  }
  -
  -  /**
  -   * Given a node handle, advance to its next sibling.
  -   * If not yet resolved, waits for more nodes to be added to the document and
  -   * tries again.
  -   * @param nodeHandle int Handle of the node.
  -   * @return int Node-number of next sibling,
  -   * or DTM.NULL to indicate none exists.
  -   */
  -  public int getNextSibling(int nodeHandle)
  -  {
  -
  -    int identity = nodeHandle & m_mask;
  -    int nextSibling = getNodeInfo(identity, OFFSET_NEXTSIBLING);
  -
  -    return nextSibling | m_dtmIdent;
  -  }
  -
  -  /**
  -   * Given a node handle, find its preceeding sibling.
  -   * WARNING: DTM is asymmetric; this operation is resolved by search, and is
  -   * relatively expensive.
  -   *
  -   * @param nodeHandle the id of the node.
  -   * @return int Node-number of the previous sib,
  -   * or DTM.NULL to indicate none exists.
  -   */
  -  public int getPreviousSibling(int nodeHandle)
  -  {
  -
  -    int firstChild = getNodeInfo(nodeHandle & m_mask, OFFSET_PREVSIBLING);
  -
  -    return firstChild | m_dtmIdent;
  -  }
  -
  -  /**
  -   * Given a node handle, advance to the next attribute. If an
  -   * element, we advance to its first attribute; if an attr, we advance to
  -   * the next attr on the same node.
  -   *
  -   * @param nodeHandle int Handle of the node.
  -   * @return int DTM node-number of the resolved attr,
  -   * or DTM.NULL to indicate none exists.
  -   */
  -  public int getNextAttribute(int nodeHandle)
  -  {
  -
  -    int type = getNodeType(nodeHandle);
  -
  -    if (DTM.ATTRIBUTE_NODE == type)
  -    {
  -
  -      // Assume that attributes and namespace nodes immediately follow the element.
  -      int identity = nodeHandle & m_mask;
  -
  -      while (DTM.NULL != (identity = getNextNodeIdentity(identity)))
  -      {
  -        type = getNodeType(identity);
  -
  -        if (type == DTM.ATTRIBUTE_NODE)
  -        {
  -          return identity | m_dtmIdent;
  -        }
  -        else if (type != DTM.NAMESPACE_NODE)
  -        {
  -          break;
  -        }
  -      }
  -    }
  -
  -    return DTM.NULL;
  -  }
  -  
  -  private Vector m_namespaceLists = null; // on demand
  -  
  -  private NodeVector getNamespaceList(int baseHandle)
  -  {
  -    if(null == m_namespaceLists)
  -      m_namespaceLists = new Vector();
  -    else
  -    {
  -      int n = m_namespaceLists.size();
  -      for (int i = (n-1); i >= 0; i--) 
  -      {
  -        NodeVector ivec = (NodeVector)m_namespaceLists.elementAt(i);
  -        if(ivec.elementAt(0) == baseHandle)
  -          return ivec;
  -      }
  -    }
  -    NodeVector ivec = buildNamespaceList(baseHandle);
  -    m_namespaceLists.addElement(ivec);
  -    return ivec;
  -  }
  -  
  -  private NodeVector buildNamespaceList(int baseHandle)
  -  {
  -    NodeVector ivec = new NodeVector(7);
  -    ivec.addElement(-1);  // for base handle.
  -    
  -    int nodeHandle = baseHandle;
  -    int type = getNodeType(baseHandle);
  -
  -    int namespaceHandle = DTM.NULL;
  -
  -    if (DTM.ELEMENT_NODE == type)
  -    {
  -      // We have to return in document order, so we actually want to find the 
  -      // first namespace decl of the last element that has a namespace decl.
  -
  -      // Assume that attributes and namespaces immediately follow the element.
  -      int identity = nodeHandle & m_mask;
  -      
  -      while (DTM.NULL != identity)
  -      {
  -        identity = getNextNodeIdentity(identity);
  -        
  -        type = (DTM.NULL == identity) ? -1 : getNodeType(identity);
  -
  -        if (type == DTM.NAMESPACE_NODE)
  -        {
  -          namespaceHandle = identity | m_dtmIdent;
  -          ivec.insertInOrder(namespaceHandle);
  -        }
  -        else if (DTM.ATTRIBUTE_NODE != type)
  -        {
  -          if(identity > 0)
  -          {
  -            nodeHandle = getParent(nodeHandle);
  -            // System.out.println("parent: "+nodeHandle);
  -            if(nodeHandle == DTM.NULL)
  -              break;
  -            identity = nodeHandle & m_mask;
  -            if(identity == 0)
  -              break;
  -          }
  -          else
  -            break;
  -        }
  -      }
  -    }
  -    ivec.setElementAt(baseHandle, 0);
  -    return ivec;
  -  }
  -
  -  
  -  /**
  -   * Given a node handle, get the index of the node's first child.
  -   * If not yet resolved, waits for more nodes to be added to the document and
  -   * tries again
  -   *
  -   * @param nodeHandle handle to node, which should probably be an element
  -   *                   node, but need not be.
  -   *
  -   * @param inScope    true if all namespaces in scope should be returned,
  -   *                   false if only the namespace declarations should be
  -   *                   returned.
  -   * @return handle of first namespace, or DTM.NULL to indicate none exists.
  -   */
  -  public int getFirstNamespaceNode(int nodeHandle, boolean inScope)
  -  {
  -
  -    int type = getNodeType(nodeHandle);
  -
  -    if (DTM.ELEMENT_NODE == type)
  -    {
  -      if(inScope)
  -      {
  -        NodeVector namespaces = getNamespaceList(nodeHandle);
  -        int n = namespaces.size();
  -        if(n > 1)
  -          return namespaces.elementAt(1);
  -      }
  -      else
  -      {
  -        // Assume that attributes and namespaces immediately follow the element.
  -        int identity = nodeHandle & m_mask;
  -  
  -        while (DTM.NULL != (identity = getNextNodeIdentity(identity)))
  -        {
  -          // Assume this can not be null.
  -          type = getNodeType(identity);
  -  
  -          if (type == DTM.NAMESPACE_NODE)
  -          {
  -            return identity | m_dtmIdent;
  -          }
  -          else if (DTM.ATTRIBUTE_NODE != type)
  -          {
  -            break;
  -          }
  -        }
  -      }
  -    }
  -
  -    return DTM.NULL;
  -  }
  -
  -
  -  /**
  -   * Given a namespace handle, advance to the next namespace.
  -   *
  -   * @param baseHandle handle to original node from where the first namespace 
  -   * was relative to (needed to return nodes in document order).
  -   * @param namespaceHandle handle to node which must be of type
  -   * NAMESPACE_NODE.
  -   * @return handle of next namespace, or DTM.NULL to indicate none exists.
  -   */
  -  public int getNextNamespaceNode(int baseHandle, int nodeHandle, boolean inScope)
  -  {
  -    int type = getNodeType(nodeHandle);
  -
  -    if (DTM.NAMESPACE_NODE == type)
  -    {
  -      if(inScope)
  -      {
  -        NodeVector namespaces = getNamespaceList(baseHandle);
  -        int n = namespaces.size();
  -        for (int i = 1; i < n; i++) // start from 1 on purpose 
  -        {
  -          if(nodeHandle == namespaces.elementAt(i))
  -          {
  -            if(i+1 < n)
  -              return namespaces.elementAt(i+1);
  -          }
  -        }
  -      }
  -      else
  -      {
  -        // Assume that attributes and namespace nodes immediately follow the element.
  -        int identity = nodeHandle & m_mask;
  -  
  -        while (DTM.NULL != (identity = getNextNodeIdentity(identity)))
  -        {
  -          type = getNodeType(identity);
  -  
  -          if (type == DTM.NAMESPACE_NODE)
  -          {
  -            return identity | m_dtmIdent;
  -          }
  -          else if (type != DTM.ATTRIBUTE_NODE)
  -          {
  -            break;
  -          }
  -        }
  -      }
  -    }
  -
  -    return DTM.NULL;
  -  }
  -
  -  /**
  -   * Given a node handle, advance to its next descendant.
  -   * If not yet resolved, waits for more nodes to be added to the document and
  -   * tries again.
  -   *
  -   * @param subtreeRootNodeHandle
  -   *
  -   * NEEDSDOC @param subtreeRootHandle
  -   * @param nodeHandle int Handle of the node.
  -   * @return handle of next descendant,
  -   * or DTM.NULL to indicate none exists.
  -   */
  -  public int getNextDescendant(int subtreeRootHandle, int nodeHandle)
  -  {
  -
  -    // %TBD%
  -    return 0;
  -  }
  -
  -  /**
  -   * Given a node handle, advance to the next node on the following axis.
  -   *
  -   * @param axisContextHandle the start of the axis that is being traversed.
  -   * @param nodeHandle
  -   * @return handle of next sibling,
  -   * or DTM.NULL to indicate none exists.
  -   */
  -  public int getNextFollowing(int axisContextHandle, int nodeHandle)
  -  {
  -
  -    // %TBD%
  -    return 0;
  -  }
  -
  -  /**
  -   * Given a node handle, advance to the next node on the preceding axis.
  -   *
  -   * @param axisContextHandle the start of the axis that is being traversed.
  -   * @param nodeHandle the id of the node.
  -   * @return int Node-number of preceding sibling,
  -   * or DTM.NULL to indicate none exists.
  -   */
  -  public int getNextPreceding(int axisContextHandle, int nodeHandle)
  -  {
  -
  -    // %TBD%
  -    return 0;
  -  }
  -
  -  /**
  -   * Given a node handle, find its parent node.
  -   *
  -   * @param nodeHandle the id of the node.
  -   * @return int Node-number of parent,
  -   * or DTM.NULL to indicate none exists.
  -   */
  -  public int getParent(int nodeHandle)
  -  {
  -
  -    int identity = nodeHandle & m_mask;
  -    // System.out.println("identity: "+identity);
  -    if(identity > 0)
  -    {
  -      int parent = getNodeInfo(identity, OFFSET_PARENT);
  -  
  -      return parent | m_dtmIdent;
  -    }
  -    else
  -      return DTM.NULL;
  -  }
  -
  -  /**
  -   *  Given a node handle, find the owning document node.
  -   *
  -   *  @param nodeHandle the id of the node.
  -   *  @return int Node handle of document, which should always be valid.
      */
  -  public int getDocument()
  +  public int getAttributeNode(int nodeHandle, String namespaceURI,
  +                              String name)
     {
  -    return m_dtmIdent;
  -  }
   
  -  /**
  -   * Given a node handle, find the owning document node.  This has the exact
  -   * same semantics as the DOM Document method of the same name, in that if
  -   * the nodeHandle is a document node, it will return NULL.
  -   *
  -   * <p>%REVIEW% Since this is DOM-specific, it may belong at the DOM
  -   * binding layer. Included here as a convenience function and to
  -   * aid porting of DOM code to DTM.</p>
  -   *
  -   * @param nodeHandle the id of the node.
  -   * @return int Node handle of owning document, or -1 if the nodeHandle is
  -   *             a document.
  -   */
  -  public int getOwnerDocument(int nodeHandle)
  -  {
  +    // %OPT% This is probably slower than it needs to be.
  +    if (null == namespaceURI)
  +      namespaceURI = "";
   
       int type = getNodeType(nodeHandle);
   
  -    if (DTM.DOCUMENT_NODE == type)
  +    if (DTM.ELEMENT_NODE == type)
       {
  -      return DTM.NULL;
  +
  +      // Assume that attributes immediately follow the element.
  +      int identity = nodeHandle & m_mask;
  +
  +      while (DTM.NULL != (identity = getNextNodeIdentity(identity)))
  +      {
  +        // Assume this can not be null.
  +        type = getNodeType(identity);
  +
  +        if (type == DTM.ATTRIBUTE_NODE)
  +        {
  +          Node node = lookupNode(identity);
  +          String nodeuri = node.getNamespaceURI();
  +
  +          if (null == nodeuri)
  +            nodeuri = "";
  +
  +          String nodelocalname = node.getLocalName();
  +
  +          if (nodeuri.equals(namespaceURI) && name.equals(nodelocalname))
  +            return identity | m_dtmIdent;
  +        }
  +        else if (DTM.NAMESPACE_NODE != type)
  +        {
  +          break;
  +        }
  +      }
       }
   
  -    return getDocument();
  +    return DTM.NULL;
     }
   
     /**
  @@ -1197,112 +646,6 @@
       }
     }
   
  -
  -  /**
  -   * Get number of character array chunks in
  -   * the string-value of a node.
  -   * (see http://www.w3.org/TR/xpath#data-model
  -   * for the definition of a node's string-value).
  -   * Note that a single text node may have multiple text chunks.
  -   *
  -   * @param nodeHandle The node ID.
  -   *
  -   * @return number of character array chunks in
  -   *         the string-value of a node.
  -   */
  -  public int getStringValueChunkCount(int nodeHandle)
  -  {
  -
  -    // %TBD%
  -    error("getStringValueChunkCount not yet supported!");
  -    return 0;
  -  }
  -
  -  /**
  -   * Get a character array chunk in the string-value of a node.
  -   * (see http://www.w3.org/TR/xpath#data-model
  -   * for the definition of a node's string-value).
  -   * Note that a single text node may have multiple text chunks.
  -   *
  -   * @param nodeHandle The node ID.
  -   * @param chunkIndex Which chunk to get.
  -   * @param startAndLen An array of 2 where the start position and length of
  -   *                    the chunk will be returned.
  -   *
  -   * @return The character array reference where the chunk occurs.
  -   */
  -  public char[] getStringValueChunk(int nodeHandle, int chunkIndex,
  -                                    int[] startAndLen)
  -  {
  -
  -    // %TBD%
  -    error("getStringValueChunk not yet supported!");
  -    return null;
  -  }
  -
  -  /**
  -   * Given a node handle, return an ID that represents the node's expanded name.
  -   *
  -   * @param nodeHandle The handle to the node in question.
  -   *
  -   * @return the expanded-name id of the node.
  -   */
  -  public int getExpandedNameID(int nodeHandle)
  -  {
  -
  -    int identity = nodeHandle & m_mask;
  -    int expandedNameID = getNodeInfo(identity, OFFSET_EXPANDEDNAMEID);
  -    return expandedNameID;
  -  }
  -
  -  /**
  -   * Given an expanded name, return an ID.  If the expanded-name does not
  -   * exist in the internal tables, the entry will be created, and the ID will
  -   * be returned.  Any additional nodes that are created that have this
  -   * expanded name will use this ID.
  -   *
  -   * @param nodeHandle The handle to the node in question.
  -   *
  -   * NEEDSDOC @param namespace
  -   * NEEDSDOC @param localName
  -   *
  -   * @return the expanded-name id of the node.
  -   */
  -  public int getExpandedNameID(String namespace, String localName, int type)
  -  {
  -
  -    ExpandedNameTable ent = m_mgr.getExpandedNameTable(this);
  -
  -    return ent.getExpandedNameID(namespace, localName, type);
  -  }
  -
  -  /**
  -   * Given an expanded-name ID, return the local name part.
  -   *
  -   * @param ExpandedNameID an ID that represents an expanded-name.
  -   * @return String Local name of this node.
  -   */
  -  public String getLocalNameFromExpandedNameID(int ExpandedNameID)
  -  {
  -    ExpandedNameTable ent = m_mgr.getExpandedNameTable(this);
  -
  -    return ent.getLocalName(ExpandedNameID);
  -  }
  -
  -  /**
  -   * Given an expanded-name ID, return the namespace URI part.
  -   *
  -   * @param ExpandedNameID an ID that represents an expanded-name.
  -   * @return String URI value of this node's namespace, or null if no
  -   * namespace was resolved.
  -   */
  -  public String getNamespaceFromExpandedNameID(int ExpandedNameID)
  -  {
  -    ExpandedNameTable ent = m_mgr.getExpandedNameTable(this);
  -
  -    return ent.getNamespace(ExpandedNameID);
  -  }
  -
     /**
      * Given a node handle, return its DOM-style node name. This will
      * include names such as #text or #document.
  @@ -1521,154 +864,7 @@
       return node.getNodeValue();
     }
   
  -  /**
  -   * Given a node handle, return its DOM-style node type.
  -   * <p>
  -   * %REVIEW% Generally, returning short is false economy. Return int?
  -   *
  -   * @param nodeHandle The node id.
  -   * @return int Node type, as per the DOM's Node._NODE constants.
  -   */
  -  public short getNodeType(int nodeHandle)
  -  {
  -
  -    int identity = nodeHandle & m_mask;
  -    short type = (short) getNodeInfo(identity, OFFSET_TYPE);
  -
  -    return type;
  -  }
  -
  -  /**
  -   * <meta name="usage" content="internal"/>
  -   * Get the depth level of this node in the tree (equals 1 for
  -   * a parentless node).
  -   *
  -   * @param nodeHandle The node id.
  -   * @return the number of ancestors, plus one
  -   */
  -  public short getLevel(int nodeHandle)
  -  {
  -
  -    int identity = nodeHandle & m_mask;
  -
  -    // Apparently, the axis walker stuff requires levels to count from 1.
  -    return (short) (getNodeInfo(identity, OFFSET_LEVEL)+1);
  -  }
  -
  -  // ============== Document query functions ============== 
  -
  -  /**
  -   * Tests whether DTM DOM implementation implements a specific feature and
  -   * that feature is supported by this node.
  -   *
  -   * @param feature The name of the feature to test.
  -   * @param versionThis is the version number of the feature to test.
  -   *   If the version is not
  -   *   specified, supporting any version of the feature will cause the
  -   *   method to return <code>true</code>.
  -   * NEEDSDOC @param version
  -   * @return Returns <code>true</code> if the specified feature is
  -   *   supported on this node, <code>false</code> otherwise.
  -   */
  -  public boolean isSupported(String feature, String version)
  -  {
  -
  -    // %TBD%
  -    return false;
  -  }
  -
  -  /**
  -   * Return the base URI of the document entity. If it is not known
  -   * (because the document was parsed from a socket connection or from
  -   * standard input, for example), the value of this property is unknown.
  -   *
  -   * @param nodeHandle The node id, which can be any valid node handle.
  -   * @return the document base URI String object or null if unknown.
  -   */
  -  public String getDocumentBaseURI(int nodeHandle)
  -  {
  -
  -    // %REVIEW%  OK? -sb
  -    return m_documentBaseURI;
  -  }
  -
  -  /**
  -   * Return the system identifier of the document entity. If
  -   * it is not known, the value of this property is unknown.
  -   *
  -   * @param nodeHandle The node id, which can be any valid node handle.
  -   * @return the system identifier String object or null if unknown.
  -   */
  -  public String getDocumentSystemIdentifier(int nodeHandle)
  -  {
  -
  -    // %REVIEW%  OK? -sb
  -    return m_documentBaseURI;
  -  }
  -
  -  /**
  -   * Return the name of the character encoding scheme
  -   *        in which the document entity is expressed.
  -   *
  -   * @param nodeHandle The node id, which can be any valid node handle.
  -   * @return the document encoding String object.
  -   */
  -  public String getDocumentEncoding(int nodeHandle)
  -  {
  -
  -    // %REVIEW%  OK??  -sb
  -    return "UTF-8";
  -  }
  -
  -  /**
  -   * Return an indication of the standalone status of the document,
  -   *        either "yes" or "no". This property is derived from the optional
  -   *        standalone document declaration in the XML declaration at the
  -   *        beginning of the document entity, and has no value if there is no
  -   *        standalone document declaration.
  -   *
  -   * @param nodeHandle The node id, which can be any valid node handle.
  -   * @return the document standalone String object, either "yes", "no", or null.
  -   */
  -  public String getDocumentStandalone(int nodeHandle)
  -  {
  -    return null;
  -  }
  -
  -  /**
  -   * Return a string representing the XML version of the document. This
  -   * property is derived from the XML declaration optionally present at the
  -   * beginning of the document entity, and has no value if there is no XML
  -   * declaration.
  -   *
  -   * @param the document handle
  -   *
  -   * NEEDSDOC @param documentHandle
  -   *
  -   * @return the document version String object.
  -   */
  -  public String getDocumentVersion(int documentHandle)
  -  {
  -    return null;
  -  }
  -
  -  /**
  -   * Return an indication of
  -   * whether the processor has read the complete DTD. Its value is a
  -   * boolean. If it is false, then certain properties (indicated in their
  -   * descriptions below) may be unknown. If it is true, those properties
  -   * are never unknown.
  -   *
  -   * @return <code>true</code> if all declarations were processed;
  -   *         <code>false</code> otherwise.
  -   */
  -  public boolean getDocumentAllDeclarationsProcessed()
  -  {
   
  -    // %REVIEW% OK?
  -    return true;
  -  }
  -
     /**
      *   A document type declaration information item has the following properties:
      *
  @@ -1869,97 +1065,6 @@
       return url;
     }
   
  -  // ============== Boolean methods ================
  -
  -  /**
  -   * Return true if the xsl:strip-space or xsl:preserve-space was processed
  -   * during construction of the DTM document.
  -   *
  -   * <p>%REVEIW% Presumes a 1:1 mapping from DTM to Document, since
  -   * we aren't saying which Document to query...?</p>
  -   *
  -   * NEEDSDOC ($objectName$) @return
  -   */
  -  public boolean supportsPreStripping()
  -  {
  -
  -    // %TBD%
  -    return false;
  -  }
  -
  -  /**
  -   * Figure out whether nodeHandle2 should be considered as being later
  -   * in the document than nodeHandle1, in Document Order as defined
  -   * by the XPath model. This may not agree with the ordering defined
  -   * by other XML applications.
  -   * <p>
  -   * There are some cases where ordering isn't defined, and neither are
  -   * the results of this function -- though we'll generally return true.
  -   *
  -   * TODO: Make sure this does the right thing with attribute nodes!!!
  -   *
  -   * @param node1 DOM Node to perform position comparison on.
  -   * @param node2 DOM Node to perform position comparison on .
  -   *
  -   * NEEDSDOC @param nodeHandle1
  -   * NEEDSDOC @param nodeHandle2
  -   *
  -   * @return false if node2 comes before node1, otherwise return true.
  -   * You can think of this as
  -   * <code>(node1.documentOrderPosition &lt;= node2.documentOrderPosition)</code>.
  -   */
  -  public boolean isNodeAfter(int nodeHandle1, int nodeHandle2)
  -  {
  -
  -      int index1 = nodeHandle1 & m_mask;
  -      int index2 = nodeHandle2 & m_mask;
  -
  -      return index1 <= index2;
  -  }
  -
  -  /**
  -   *     2. [element content whitespace] A boolean indicating whether the
  -   *        character is white space appearing within element content (see [XML],
  -   *        2.10 "White Space Handling"). Note that validating XML processors are
  -   *        required by XML 1.0 to provide this information. If there is no
  -   *        declaration for the containing element, this property has no value for
  -   *        white space characters. If no declaration has been read, but the [all
  -   *        declarations processed] property of the document information item is
  -   *        false (so there may be an unread declaration), then the value of this
  -   *        property is unknown for white space characters. It is always false for
  -   *        characters that are not white space.
  -   *
  -   * @param nodeHandle the node ID.
  -   * @return <code>true</code> if the character data is whitespace;
  -   *         <code>false</code> otherwise.
  -   */
  -  public boolean isCharacterElementContentWhitespace(int nodeHandle)
  -  {
  -
  -    // %TBD%
  -    return false;
  -  }
  -
  -  /**
  -   *    10. [all declarations processed] This property is not strictly speaking
  -   *        part of the infoset of the document. Rather it is an indication of
  -   *        whether the processor has read the complete DTD. Its value is a
  -   *        boolean. If it is false, then certain properties (indicated in their
  -   *        descriptions below) may be unknown. If it is true, those properties
  -   *        are never unknown.
  -   *
  -   * @param the document handle
  -   *
  -   * @param documentHandle A node handle that must identify a document.
  -   * @return <code>true</code> if all declarations were processed;
  -   *         <code>false</code> otherwise.
  -   */
  -  public boolean isDocumentAllDeclarationsProcessed(int documentHandle)
  -  {
  -
  -    return true;
  -  }
  -
     /**
      *     5. [specified] A flag indicating whether this attribute was actually
      *        specified in the start-tag of its element, or was defaulted from the
  @@ -2053,9 +1158,9 @@
         String str = node.getNodeValue();
         ch.characters(str.toCharArray(), 0, str.length());
         break;
  -//    case Node.PROCESSING_INSTRUCTION_NODE :
  +//    /* case Node.PROCESSING_INSTRUCTION_NODE :
   //      // warning(XPATHErrorResources.WG_PARSING_AND_PREPARING);        
  -//      break;
  +//      break; */
       default :
         // ignore
         break;
  @@ -2095,90 +1200,4 @@
       }
     }
   
  -  // ==== Construction methods (may not be supported by some implementations!) =====
  -
  -  /**
  -   * Append a child to the end of the document. Please note that the node
  -   * is always cloned if it is owned by another document.
  -   *
  -   * <p>%REVIEW% "End of the document" needs to be defined more clearly.
  -   * Does it become the last child of the Document? Of the root element?</p>
  -   *
  -   * @param newChild Must be a valid new node handle.
  -   * @param clone true if the child should be cloned into the document.
  -   * @param cloneDepth if the clone argument is true, specifies that the
  -   *                   clone should include all it's children.
  -   */
  -  public void appendChild(int newChild, boolean clone, boolean cloneDepth){}
  -
  -  /**
  -   * Append a text node child that will be constructed from a string,
  -   * to the end of the document.
  -   *
  -   * <p>%REVIEW% "End of the document" needs to be defined more clearly.
  -   * Does it become the last child of the Document? Of the root element?</p>
  -   *
  -   * @param str Non-null reverence to a string.
  -   */
  -  public void appendTextChild(String str){}
  -  
  -  /**
  -   * Simple error for asserts and the like.
  -   */
  -  protected void error(String msg)
  -  {
  -    throw new DTMException(msg);
  -  }
  -  
  -    /**
  -   * Find out whether or not to strip whispace nodes.  
  -   *
  -   *
  -   * @return whether or not to strip whispace nodes.
  -   */
  -  protected boolean getShouldStripWhitespace()
  -  {
  -    return m_shouldStripWS;
  -  }
  -
  -  /**
  -   * Set whether to strip whitespaces and push in current value of   
  -   * m_shouldStripWS in m_shouldStripWhitespaceStack.
  -   *
  -   * @param shouldStrip Flag indicating whether to strip whitespace nodes
  -   */
  -  protected void pushShouldStripWhitespace(boolean shouldStrip)
  -  {
  -
  -    m_shouldStripWS = shouldStrip;
  -
  -    if(null != m_shouldStripWhitespaceStack)
  -      m_shouldStripWhitespaceStack.push(shouldStrip);
  -  }
  -
  -  /**
  -   * Set whether to strip whitespaces at this point by popping out  
  -   * m_shouldStripWhitespaceStack. 
  -   *
  -   */
  -  protected void popShouldStripWhitespace()
  -  {
  -    if(null != m_shouldStripWhitespaceStack)
  -      m_shouldStripWS = m_shouldStripWhitespaceStack.popAndTop();
  -  }
  -
  -  /**
  -   * Set whether to strip whitespaces and set the top of the stack to 
  -   * the current value of m_shouldStripWS.  
  -   *
  -   *
  -   * @param shouldStrip Flag indicating whether to strip whitespace nodes
  -   */
  -  protected void setShouldStripWhitespace(boolean shouldStrip)
  -  {
  -    
  -    m_shouldStripWS = shouldStrip;
  -    if(null != m_shouldStripWhitespaceStack)
  -      m_shouldStripWhitespaceStack.setTop(shouldStrip);
  -  }
   }
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.1.2.1   +1880 -0   xml-xalan/java/src/org/apache/xml/dtm/sax2dtm/Attic/SAX2DTM.java
  
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: xalan-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: xalan-cvs-help@xml.apache.org