sboag       01/05/05 19:09:57

  Modified:    java/src/org/apache/xalan/extensions Tag: DTM_EXP
                        ExtensionHandlerGeneral.java MethodResolver.java
               java/src/org/apache/xalan/processor Tag: DTM_EXP
                        CompilingStylesheetHandler.java
                        TransformerFactoryImpl.java
               java/src/org/apache/xalan/stree Tag: DTM_EXP Parent.java
                        SourceTreeHandler.java StreeDOMBuilder.java
               java/src/org/apache/xalan/templates Tag: DTM_EXP
                        ElemApplyTemplates.java ElemElement.java
                        ElemExtensionCall.java ElemForEach.java
                        ElemNumber.java ElemPI.java
                        ElemTemplateElement.java FuncDocument.java
               java/src/org/apache/xalan/trace Tag: DTM_EXP
                        PrintTraceListener.java TraceManager.java
               java/src/org/apache/xalan/transformer Tag: DTM_EXP
                        NodeSorter.java ResultTreeHandler.java
                        StackGuard.java TransformSnapshotImpl.java
                        TransformerImpl.java
               java/src/org/apache/xml/dtm Tag: DTM_EXP
                        CoroutineSAXParser.java DTM.java
                        DTMConstructor.java DTMDocumentImpl.java
                        DTMIterator.java DTMManager.java
                        DTMManagerDefault.java DTMTreeWalker.java
                        ExpandedNameTable.java TestDTM.java
               java/src/org/apache/xml/dtm/dom2dtm Tag: DTM_EXP
                        DOM2DTM.java UnitTest.java
               java/src/org/apache/xml/utils Tag: DTM_EXP DOMBuilder.java
                        NodeVector.java
               java/src/org/apache/xpath Tag: DTM_EXP NodeSet.java
                        SourceTreeManager.java XPathContext.java
               java/src/org/apache/xpath/axes Tag: DTM_EXP AxesWalker.java
                        DescendantIterator.java FilterExprWalker.java
                        FollowingWalker.java LocPathIterator.java
                        NamespaceWalker.java PrecedingWalker.java
                        PredicatedNodeTest.java ReverseAxesWalker.java
                        UnionPathIterator.java
               java/src/org/apache/xpath/compiler Tag: DTM_EXP
                        Compiler.java
               java/src/org/apache/xpath/functions Tag: DTM_EXP
                        FuncCurrent.java FuncId.java FuncLast.java
                        FunctionDef1Arg.java
               java/src/org/apache/xpath/objects Tag: DTM_EXP XNodeSet.java
               java/src/org/apache/xpath/operations Tag: DTM_EXP
                        Variable.java
               java/src/org/apache/xpath/patterns Tag: DTM_EXP
                        NodeTest.java
  Log:
  Periodic check-in.  Basic axis tests (1-113, haven't been updated for
  for a month or so) run correctly with DOM2DTM on top of Stree.
  Should test axis traversal, some positional tests, strip-space, basic
  match patterns, and rough tree management.  I don't think result
  tree fragments, and multiple documents will work yet.  Also, extensions
  are not yet operational.
  
  Revision  Changes    Path
  No                   revision
  
  
  No                   revision
  
  
  1.10.2.2  +3 -3      
xml-xalan/java/src/org/apache/xalan/extensions/ExtensionHandlerGeneral.java
  
  Index: ExtensionHandlerGeneral.java
  ===================================================================
  RCS file: 
/home/cvs/xml-xalan/java/src/org/apache/xalan/extensions/ExtensionHandlerGeneral.java,v
  retrieving revision 1.10.2.1
  retrieving revision 1.10.2.2
  diff -u -r1.10.2.1 -r1.10.2.2
  --- ExtensionHandlerGeneral.java      2001/04/10 18:44:37     1.10.2.1
  +++ ExtensionHandlerGeneral.java      2001/05/06 02:09:22     1.10.2.2
  @@ -355,7 +355,7 @@
       Object result = null;
       XSLProcessorContext xpc = new XSLProcessorContext(transformer, 
stylesheetTree);
   
  -    // %TBD%
  +    // %DTBD%
   //    try
       {
         Vector argv = new Vector(2);
  @@ -363,11 +363,11 @@
         argv.addElement(xpc);
         argv.addElement(element);
   
  -      // %TBD% This wants an ExpressionContext.
  +      // %DTBD% This wants an ExpressionContext.
   //      result = callFunction(localPart, argv, methodKey,
   //                            transformer.getXPathContext());
       }
  -    // %TBD%
  +    // %DTBD%
   //    catch (XPathProcessorException e)
   //    {
   //
  
  
  
  1.19.2.2  +5 -5      
xml-xalan/java/src/org/apache/xalan/extensions/MethodResolver.java
  
  Index: MethodResolver.java
  ===================================================================
  RCS file: 
/home/cvs/xml-xalan/java/src/org/apache/xalan/extensions/MethodResolver.java,v
  retrieving revision 1.19.2.1
  retrieving revision 1.19.2.2
  diff -u -r1.19.2.1 -r1.19.2.2
  --- MethodResolver.java       2001/04/10 18:44:37     1.19.2.1
  +++ MethodResolver.java       2001/05/06 02:09:22     1.19.2.2
  @@ -732,14 +732,14 @@
             {
               return ((XRTreeFrag) xobj).asNodeIterator();
             }
  -          // %TBD%
  +          // %DTBD%
   //          else if (javaClass == NodeList.class)
   //          {
   //            return ((XRTreeFrag) xobj).convertToNodeset();
   //          }
             // Same comment as above
             // else if(Node.class.isAssignableFrom(javaClass))
  -          // %TBD%
  +          // %DTBD%
   //          else if(javaClass == Node.class)
   //          {
   //            return xobj.rtree().getFirstChild();
  @@ -756,7 +756,7 @@
             {
               return convertDoubleToNumber(xobj.num(), javaClass);
             }
  -          // %TBD%
  +          // %DTBD%
   //          else
   //          {
   //            Node child = xobj.rtree().getFirstChild();
  @@ -793,7 +793,7 @@
             {
               // Xalan ensures that nodeset() always returns an
               // iterator positioned at the beginning.
  -            // %TBD%
  +            // %DTBD%
   //            NodeIterator ni = xobj.nodeset();
   //            return ni.nextNode(); // may be null.
             }
  @@ -809,7 +809,7 @@
             {
               return convertDoubleToNumber(xobj.num(), javaClass);
             }
  -          // %TBD%
  +          // %DTBD%
   //          else
   //          {
   //            Node child = xobj.nodeset().nextNode();
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.23.2.2  +3 -3      
xml-xalan/java/src/org/apache/xalan/processor/CompilingStylesheetHandler.java
  
  Index: CompilingStylesheetHandler.java
  ===================================================================
  RCS file: 
/home/cvs/xml-xalan/java/src/org/apache/xalan/processor/CompilingStylesheetHandler.java,v
  retrieving revision 1.23.2.1
  retrieving revision 1.23.2.2
  diff -u -r1.23.2.1 -r1.23.2.2
  --- CompilingStylesheetHandler.java   2001/04/10 18:44:41     1.23.2.1
  +++ CompilingStylesheetHandler.java   2001/05/06 02:09:23     1.23.2.2
  @@ -533,7 +533,7 @@
                   // Literal value, can fully resolve at compile time.
                   // Exception won't be thrown, but we've gotta catch
   //                try{
  -                  // %TBD% ??
  +                  // %XTBD% ??
   //                    avtValueExpression=makeQuotedString(
   //                        avt.evaluate(null,null,null)
   //                        );
  @@ -632,7 +632,7 @@
                   // Recurse, since attrsets can reference attrsets
                   compileUseAttrSet(attrSet,body,interpretVector);
                       
  -                // %TBD%    
  +                // %XTBD%    
   //                ElemAttribute attr = 
(ElemAttribute)attrSet.getFirstChild();
   //                while(null != attr)
   //                {
  @@ -649,7 +649,7 @@
     String compileAVTvalue(org.apache.xalan.templates.AVT avt,StringBuffer 
body,Vector interpretVector)
     {
         // Literal string is easy -- except for potential of " within "".
  -      // %TBD%
  +      // %XTBD%
   //      if(avt.isContextInsensitive())
   //          try
   //          {
  
  
  
  1.28.2.1  +1 -1      
xml-xalan/java/src/org/apache/xalan/processor/TransformerFactoryImpl.java
  
  Index: TransformerFactoryImpl.java
  ===================================================================
  RCS file: 
/home/cvs/xml-xalan/java/src/org/apache/xalan/processor/TransformerFactoryImpl.java,v
  retrieving revision 1.28
  retrieving revision 1.28.2.1
  diff -u -r1.28 -r1.28.2.1
  --- TransformerFactoryImpl.java       2001/03/12 02:12:44     1.28
  +++ TransformerFactoryImpl.java       2001/05/06 02:09:23     1.28.2.1
  @@ -147,7 +147,7 @@
           {
             Properties props = new Properties();
   
  -          is = Process.class.getResourceAsStream(file);
  +          is = TransformerFactoryImpl.class.getResourceAsStream(file);
   
             // get a buffered version
             BufferedInputStream bis = new BufferedInputStream(is);
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.21.2.2  +0 -44     xml-xalan/java/src/org/apache/xalan/stree/Parent.java
  
  Index: Parent.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xalan/stree/Parent.java,v
  retrieving revision 1.21.2.1
  retrieving revision 1.21.2.2
  diff -u -r1.21.2.1 -r1.21.2.2
  --- Parent.java       2001/04/10 18:44:42     1.21.2.1
  +++ Parent.java       2001/05/06 02:09:25     1.21.2.2
  @@ -360,50 +360,6 @@
   
       m_last = child;
   
  -    // getDocumentImpl().getLevelIndexer().insertNode(child);
  -    if (Node.ELEMENT_NODE == child.getNodeType())
  -    {
  -      SourceTreeHandler sh = doc.getSourceTreeHandler();
  -
  -      if ((null != sh) && sh.m_shouldCheckWhitespace)
  -      {
  -        TransformerImpl transformer = sh.getTransformerImpl();
  -
  -        if (null != transformer)
  -        {
  -          StylesheetRoot stylesheet = transformer.getStylesheet();
  -
  -//          try
  -          {
  -            ElementImpl elem = (ElementImpl) child;
  -            if(null == doc.m_xpathContext)
  -              doc.m_xpathContext = new org.apache.xpath.XPathContext(doc);
  -              // %TBD%
  -            WhiteSpaceInfo info = null;
  -//              stylesheet.getWhiteSpaceInfo(doc.m_xpathContext,
  -//                                           elem);
  -            boolean shouldStrip;
  -
  -            if (null == info)
  -            {
  -              shouldStrip = sh.getShouldStripWhitespace();
  -            }
  -            else
  -            {
  -              shouldStrip = info.getShouldStripSpace();
  -            }
  -
  -            sh.setShouldStripWhitespace(shouldStrip);
  -          }
  -//          catch (TransformerException se)
  -//          {
  -//
  -//            // TODO: Diagnostics
  -//          }
  -        }
  -      }
  -    }
  -
       return newChild;
     }
   
  
  
  
  1.35.2.2  +31 -18    
xml-xalan/java/src/org/apache/xalan/stree/SourceTreeHandler.java
  
  Index: SourceTreeHandler.java
  ===================================================================
  RCS file: 
/home/cvs/xml-xalan/java/src/org/apache/xalan/stree/SourceTreeHandler.java,v
  retrieving revision 1.35.2.1
  retrieving revision 1.35.2.2
  diff -u -r1.35.2.1 -r1.35.2.2
  --- SourceTreeHandler.java    2001/04/10 18:44:42     1.35.2.1
  +++ SourceTreeHandler.java    2001/05/06 02:09:25     1.35.2.2
  @@ -64,6 +64,8 @@
   
   import org.xml.sax.ContentHandler;
   
  +import org.apache.xml.dtm.DTM;
  +import org.apache.xml.dtm.DTMManager;
   import org.apache.xml.utils.DOMBuilder;
   import org.apache.xml.utils.XMLCharacterRecognizer;
   import org.apache.xml.utils.BoolStack;
  @@ -92,6 +94,7 @@
   import javax.xml.transform.sax.TransformerHandler;
   import javax.xml.transform.Result;
   import javax.xml.transform.ErrorListener;
  +import javax.xml.transform.dom.DOMSource;
   
   
   /**
  @@ -131,6 +134,8 @@
   
       xctxt.setDOMHelper(new StreeDOMHelper());
       
  +    DTMManager mgr = m_transformer.getXPathContext().getDTMManager();
  +    DTM dtm;
       if(doFragment)
       {
         m_root = new DocumentFragmentImpl(1024);
  @@ -140,6 +145,10 @@
       {
         m_root = new DocumentImpl(this);
       }
  +    DOMSource ds = new DOMSource(m_root);
  +    dtm = mgr.getDTM(ds, false, transformer);
  +    
  +    m_DTMroot = dtm.getDocument();
   
       m_initedRoot = false;
       m_shouldCheckWhitespace =
  @@ -171,6 +180,15 @@
     /** The root of the source document          */
     private DocImpl m_root;
   
  +  /** The DTM root for the DTM2DOM **/
  +  private int m_DTMroot;
  +  
  +  /** Get the DTM root for the DTM2DOM **/
  +  public int getDTMRoot()
  +  {
  +    return m_DTMroot;
  +  }
  +
     /** If this is non-null, the fragment where the nodes will be added. */
     private DocumentFragment m_docFrag;
   
  @@ -402,11 +420,8 @@
               
             }
           } 
  -        // %TBD?%        
  -//        if(null != m_docFrag)
  -//          m_transformer.setSourceTreeDocForThread(m_docFrag);
  -//        else
  -//          m_transformer.setSourceTreeDocForThread(m_root);
  +        
  +        m_transformer.setSourceTreeDocForThread(m_DTMroot);
   
           Thread t = m_transformer.createTransformThread();
   
  @@ -414,7 +429,7 @@
   
           int cpriority = Thread.currentThread().getPriority();
   
  -        // t.setPriority(cpriority-1);
  +        t.setPriority(cpriority-1);
           t.setPriority(cpriority);
           t.start();
         }
  @@ -448,16 +463,15 @@
   
         if (!m_useMultiThreading && (null != m_transformer) && 
m_shouldTransformAtEnd)
         {
  -          // %TBD?%
  -//        try
  -//        {
  -//          // m_transformer.transformNode(m_root);
  -//        }
  -//        catch(TransformerException te)
  -//        {
  -//          // te.printStackTrace();
  -//          throw new org.xml.sax.SAXException(te);
  -//        }
  +        try
  +        {
  +          m_transformer.transformNode(m_DTMroot);
  +        }
  +        catch(TransformerException te)
  +        {
  +          // te.printStackTrace();
  +          throw new org.xml.sax.SAXException(te);
  +        }
         }
       }
   
  @@ -1010,8 +1024,7 @@
       
       m_inputSource = new StreamSource(baseID);
       
  -          // %TBD?%
  -//    stm.putDocumentInCache(m_root, m_inputSource);
  +    stm.putDocumentInCache(m_DTMroot, m_inputSource);
     }
     
     /**
  
  
  
  1.15.2.2  +1 -2      
xml-xalan/java/src/org/apache/xalan/stree/StreeDOMBuilder.java
  
  Index: StreeDOMBuilder.java
  ===================================================================
  RCS file: 
/home/cvs/xml-xalan/java/src/org/apache/xalan/stree/StreeDOMBuilder.java,v
  retrieving revision 1.15.2.1
  retrieving revision 1.15.2.2
  diff -u -r1.15.2.1 -r1.15.2.2
  --- StreeDOMBuilder.java      2001/04/10 18:44:42     1.15.2.1
  +++ StreeDOMBuilder.java      2001/05/06 02:09:26     1.15.2.2
  @@ -217,8 +217,7 @@
       }
       
       append(elem);
  -    // %TBD%
  -//    m_elemStack.push(elem);
  +    m_elemStack.push(elem);
   
       m_currentNode = elem;
     }
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.13.2.2  +1 -1      
xml-xalan/java/src/org/apache/xalan/templates/ElemApplyTemplates.java
  
  Index: ElemApplyTemplates.java
  ===================================================================
  RCS file: 
/home/cvs/xml-xalan/java/src/org/apache/xalan/templates/ElemApplyTemplates.java,v
  retrieving revision 1.13.2.1
  retrieving revision 1.13.2.2
  diff -u -r1.13.2.1 -r1.13.2.2
  --- ElemApplyTemplates.java   2001/04/10 18:44:45     1.13.2.1
  +++ ElemApplyTemplates.java   2001/05/06 02:09:27     1.13.2.2
  @@ -192,7 +192,7 @@
           if (!m_isDefaultTemplate)
           {
             if(((null == mode) && (null != m_mode) ) ||
  -              !mode.equals(m_mode))
  +              ((null != mode) && !mode.equals(m_mode)))
             {
               pushMode = true;
               transformer.pushMode(m_mode);
  
  
  
  1.18.2.2  +2 -1      
xml-xalan/java/src/org/apache/xalan/templates/ElemElement.java
  
  Index: ElemElement.java
  ===================================================================
  RCS file: 
/home/cvs/xml-xalan/java/src/org/apache/xalan/templates/ElemElement.java,v
  retrieving revision 1.18.2.1
  retrieving revision 1.18.2.2
  diff -u -r1.18.2.1 -r1.18.2.2
  --- ElemElement.java  2001/04/10 18:44:47     1.18.2.1
  +++ ElemElement.java  2001/05/06 02:09:27     1.18.2.2
  @@ -277,10 +277,11 @@
       if ((null != nodeName) /* && (indexOfNSSep >= 0) */)
       {
         prefix = (indexOfNSSep > 0) ? nodeName.substring(0, indexOfNSSep) : "";
  -
  +      
         // Catch the exception this may cause. We don't want to stop 
processing.
         try
         {
  +        // Maybe temporary, until I get this worked out.  test: axes59
           nodeNamespace = getNamespaceForPrefix(prefix);
   
           if (null == nodeNamespace && indexOfNSSep <= 0)
  
  
  
  1.24.2.2  +1 -1      
xml-xalan/java/src/org/apache/xalan/templates/ElemExtensionCall.java
  
  Index: ElemExtensionCall.java
  ===================================================================
  RCS file: 
/home/cvs/xml-xalan/java/src/org/apache/xalan/templates/ElemExtensionCall.java,v
  retrieving revision 1.24.2.1
  retrieving revision 1.24.2.2
  diff -u -r1.24.2.1 -r1.24.2.2
  --- ElemExtensionCall.java    2001/04/10 18:44:47     1.24.2.1
  +++ ElemExtensionCall.java    2001/05/06 02:09:28     1.24.2.2
  @@ -386,7 +386,7 @@
      * @throws TransformerException
      */
     public String getAttribute(
  -          String rawName, int sourceNode /* %TBD% Node varient? */, 
TransformerImpl transformer)
  +          String rawName, int sourceNode /* %DTBD% Node varient? */, 
TransformerImpl transformer)
               throws TransformerException
     {
   
  
  
  
  1.20.2.2  +2 -3      
xml-xalan/java/src/org/apache/xalan/templates/ElemForEach.java
  
  Index: ElemForEach.java
  ===================================================================
  RCS file: 
/home/cvs/xml-xalan/java/src/org/apache/xalan/templates/ElemForEach.java,v
  retrieving revision 1.20.2.1
  retrieving revision 1.20.2.2
  diff -u -r1.20.2.1 -r1.20.2.2
  --- ElemForEach.java  2001/04/10 18:44:47     1.20.2.1
  +++ ElemForEach.java  2001/05/06 02:09:28     1.20.2.2
  @@ -270,8 +270,7 @@
   
       try
       {
  -      // %TBD%
  -//      sorter.sort(sourceNodes, keys, xctxt);
  +      sorter.sort(sourceNodes, keys, xctxt);
         sourceNodes.setCurrentPos(0);
       }
       finally
  @@ -455,7 +454,7 @@
                 transformer.getTraceManager().fireTraceEvent(template);
   
               // And execute the child templates.
  -            // %TBD% ???
  +            // %XTBD% ???
   //            if (template.isCompiledTemplate())
   //              template.execute(transformer, child, mode);
   //            else
  
  
  
  1.18.2.2  +1 -1      
xml-xalan/java/src/org/apache/xalan/templates/ElemNumber.java
  
  Index: ElemNumber.java
  ===================================================================
  RCS file: 
/home/cvs/xml-xalan/java/src/org/apache/xalan/templates/ElemNumber.java,v
  retrieving revision 1.18.2.1
  retrieving revision 1.18.2.2
  diff -u -r1.18.2.1 -r1.18.2.2
  --- ElemNumber.java   2001/04/10 18:44:48     1.18.2.1
  +++ ElemNumber.java   2001/05/06 02:09:28     1.18.2.2
  @@ -1000,7 +1000,7 @@
           //Locale.getDefault().getDisplayCountry());
           if (null == locale)
           {
  -          // %TBD%
  +          // %DTBD%
   //          transformer.getMsgMgr().warn(this, null, contextNode,
   //                                       
XSLTErrorResources.WG_LOCALE_NOT_FOUND,
   //                                       new Object[]{ langValue });  
//"Warning: Could not find locale for xml:lang="+langValue);
  
  
  
  1.9.2.2   +1 -1      xml-xalan/java/src/org/apache/xalan/templates/ElemPI.java
  
  Index: ElemPI.java
  ===================================================================
  RCS file: 
/home/cvs/xml-xalan/java/src/org/apache/xalan/templates/ElemPI.java,v
  retrieving revision 1.9.2.1
  retrieving revision 1.9.2.2
  diff -u -r1.9.2.1 -r1.9.2.2
  --- ElemPI.java       2001/04/10 18:44:48     1.9.2.1
  +++ ElemPI.java       2001/05/06 02:09:28     1.9.2.2
  @@ -161,7 +161,7 @@
   
       if (piName.equalsIgnoreCase("xml"))
       {
  -      // %TBD%
  +      // %DTBD%
   //      error(XSLTErrorResources.ER_PROCESSINGINSTRUCTION_NAME_CANT_BE_XML); 
 //"processing-instruction name can not be 'xml'");
       }
       else if (!isValidNCName(piName))
  
  
  
  1.38.2.2  +14 -10    
xml-xalan/java/src/org/apache/xalan/templates/ElemTemplateElement.java
  
  Index: ElemTemplateElement.java
  ===================================================================
  RCS file: 
/home/cvs/xml-xalan/java/src/org/apache/xalan/templates/ElemTemplateElement.java,v
  retrieving revision 1.38.2.1
  retrieving revision 1.38.2.2
  diff -u -r1.38.2.1 -r1.38.2.2
  --- ElemTemplateElement.java  2001/04/10 18:44:49     1.38.2.1
  +++ ElemTemplateElement.java  2001/05/06 02:09:29     1.38.2.2
  @@ -106,7 +106,7 @@
    *
    * @see Stylesheet
    */
  -public class ElemTemplateElement /* %TBD% extends UnImplNode */
  +public class ElemTemplateElement /* %DTBD% extends UnImplNode */
           implements PrefixResolver, Serializable, SourceLocator, 
                      WhitespaceStrippingElementMatcher
   {
  @@ -308,7 +308,7 @@
     
   
     // Implemented DOM Element methods.
  -// %TBD%
  +// %DTBD%
   //  /**
   //   * Add a child to the child list.
   //   * NOTE: This presumes the child did not previously have a parent.
  @@ -405,7 +405,7 @@
       return org.w3c.dom.Node.ELEMENT_NODE;
     }
   
  -  // %TBD%
  +  // %DTBD%
   //  /**
   //   * Return the nodelist (same reference).
   //   *
  @@ -453,7 +453,7 @@
       return childETE;
     }
   
  -  // %TBD%
  +  // %DTBD%
   //  /**
   //   * Replace the old child with a new child.
   //   *
  @@ -578,7 +578,7 @@
   //    return node;
   //  }  // item(int):Node
   
  -  // %TBD%
  +  // %DTBD%
   //  /**
   //   * Get the stylesheet owner.
   //   *
  @@ -823,6 +823,10 @@
      */
     public String getNamespaceForPrefix(String prefix)
     {
  +//    if (null != prefix && prefix.equals("xmlns"))
  +//    {
  +//      return Constants.S_XMLNAMESPACEURI;
  +//    }
   
       Vector nsDecls = m_declaredPrefixes;
   
  @@ -1128,7 +1132,7 @@
      */
     protected ElemTemplateElement m_parentNode;
   
  -  // %TBD%
  +  // %DTBD%
   //  /**
   //   * Get the parent as a Node.
   //   *
  @@ -1155,7 +1159,7 @@
      */
     ElemTemplateElement m_nextSibling;
   
  -  // %TBD%
  +  // %DTBD%
   //  /**
   //   * Get the next sibling (as a Node) or return null.
   //   *
  @@ -1166,7 +1170,7 @@
   //    return m_nextSibling;
   //  }
   
  -  // %TBD%
  +  // %DTBD%
   //  /**
   //   * Get the previous sibling (as a Node) or return null.
   //   * Note that this may be expensive if the parent has many kids;
  @@ -1246,7 +1250,7 @@
      */
     ElemTemplateElement m_firstChild;
   
  -  // %TBD%
  +  // %DTBD%
   //  /**
   //   * Get the first child as a Node.
   //   *
  @@ -1267,7 +1271,7 @@
       return m_firstChild;
     }
   
  -  // %TBD%
  +  // %DTBD%
   //  /**
   //   * Get the last child.
   //   *
  
  
  
  1.19.2.2  +1 -1      
xml-xalan/java/src/org/apache/xalan/templates/FuncDocument.java
  
  Index: FuncDocument.java
  ===================================================================
  RCS file: 
/home/cvs/xml-xalan/java/src/org/apache/xalan/templates/FuncDocument.java,v
  retrieving revision 1.19.2.1
  retrieving revision 1.19.2.2
  diff -u -r1.19.2.1 -r1.19.2.2
  --- FuncDocument.java 2001/04/10 18:44:52     1.19.2.1
  +++ FuncDocument.java 2001/05/06 02:09:29     1.19.2.2
  @@ -181,7 +181,7 @@
         base = xctxt.getNamespaceContext().getBaseIdentifier();
       }
   
  -    XNodeSet nodes = new XNodeSet();
  +    XNodeSet nodes = new XNodeSet(xctxt.getDTMManager());
   //    NodeSet mnl = nodes.mutableNodeset();
       DTMIterator iterator = (XObject.CLASS_NODESET == arg.getType())
                               ? arg.nodeset() : null;
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.6.2.2   +2 -2      
xml-xalan/java/src/org/apache/xalan/trace/PrintTraceListener.java
  
  Index: PrintTraceListener.java
  ===================================================================
  RCS file: 
/home/cvs/xml-xalan/java/src/org/apache/xalan/trace/PrintTraceListener.java,v
  retrieving revision 1.6.2.1
  retrieving revision 1.6.2.2
  diff -u -r1.6.2.1 -r1.6.2.2
  --- PrintTraceListener.java   2001/04/10 18:45:00     1.6.2.1
  +++ PrintTraceListener.java   2001/05/06 02:09:31     1.6.2.2
  @@ -215,7 +215,7 @@
         if (ev.m_selection.getType() == ev.m_selection.CLASS_NODESET)
         {
           m_pw.println();
  -        // %TBD%
  +        // %DTBD%
   //        NodeIterator nl = ev.m_selection.nodeset();
   //        if(nl instanceof ContextNodeList)
   //        {
  @@ -223,7 +223,7 @@
   //          {
   //            nl = ((ContextNodeList)nl).cloneWithReset();
   //          }
  -//          catch(CloneNotSupportedException cnse)
  +//          catch(CloneNotSupportedException cnse)S
   //          {
   //            m_pw.println("     [Can't trace nodelist because it it threw a 
CloneNotSupportedException]");
   //            return;
  
  
  
  1.7.2.2   +2 -2      
xml-xalan/java/src/org/apache/xalan/trace/TraceManager.java
  
  Index: TraceManager.java
  ===================================================================
  RCS file: 
/home/cvs/xml-xalan/java/src/org/apache/xalan/trace/TraceManager.java,v
  retrieving revision 1.7.2.1
  retrieving revision 1.7.2.2
  diff -u -r1.7.2.1 -r1.7.2.2
  --- TraceManager.java 2001/04/10 18:45:00     1.7.2.1
  +++ TraceManager.java 2001/05/06 02:09:32     1.7.2.2
  @@ -165,7 +165,7 @@
     public void fireTraceEvent(ElemTemplateElement styleNode)
     {
   
  -  // %TBD%
  +  // %DTBD%
   //    if (hasTraceListeners())
   //    {
   //      fireTraceEvent(new TracerEvent(m_transformer, sourceNode, mode,
  @@ -210,7 +210,7 @@
               throws javax.xml.transform.TransformerException
     {
   
  -  // %TBD%
  +  // %DTBD%
   //    if (hasTraceListeners())
   //      fireSelectedEvent(new SelectionEvent(m_transformer, sourceNode,
   //                                           styleNode, attributeName, xpath,
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.9.2.2   +4 -4      
xml-xalan/java/src/org/apache/xalan/transformer/NodeSorter.java
  
  Index: NodeSorter.java
  ===================================================================
  RCS file: 
/home/cvs/xml-xalan/java/src/org/apache/xalan/transformer/NodeSorter.java,v
  retrieving revision 1.9.2.1
  retrieving revision 1.9.2.2
  diff -u -r1.9.2.1 -r1.9.2.2
  --- NodeSorter.java   2001/04/10 18:45:03     1.9.2.1
  +++ NodeSorter.java   2001/05/06 02:09:33     1.9.2.2
  @@ -114,14 +114,14 @@
      *
      * @throws javax.xml.transform.TransformerException
      */
  -  public void sort(NodeVector v, Vector keys, XPathContext support)
  +  public void sort(DTMIterator v, Vector keys, XPathContext support)
             throws javax.xml.transform.TransformerException
     {
   
       m_keys = keys;
   
       // QuickSort2(v, 0, v.size() - 1 );
  -    int n = v.size();
  +    int n = v.getLength();
   
       // Create a vector of node compare elements
       // based on the input vector of nodes
  @@ -129,7 +129,7 @@
   
       for (int i = 0; i < n; i++)
       {
  -      NodeCompareElem elem = new NodeCompareElem(v.elementAt(i));
  +      NodeCompareElem elem = new NodeCompareElem(v.item(i));
   
         nodes.addElement(elem);
       }
  @@ -141,7 +141,7 @@
       // return sorted vector of nodes
       for (int i = 0; i < n; i++)
       {
  -      v.setElementAt(((NodeCompareElem) nodes.elementAt(i)).m_node, i);
  +      v.setItem(((NodeCompareElem) nodes.elementAt(i)).m_node, i);
       }
   
       // old code...
  
  
  
  1.37.2.2  +4 -4      
xml-xalan/java/src/org/apache/xalan/transformer/ResultTreeHandler.java
  
  Index: ResultTreeHandler.java
  ===================================================================
  RCS file: 
/home/cvs/xml-xalan/java/src/org/apache/xalan/transformer/ResultTreeHandler.java,v
  retrieving revision 1.37.2.1
  retrieving revision 1.37.2.2
  diff -u -r1.37.2.1 -r1.37.2.2
  --- ResultTreeHandler.java    2001/04/10 18:45:03     1.37.2.1
  +++ ResultTreeHandler.java    2001/05/06 02:09:34     1.37.2.2
  @@ -1000,7 +1000,7 @@
         {
   
           for (int namespace = dtm.getFirstNamespaceNode(src, true);
  -             DTM.NULL != namespace; namespace = 
dtm.getNextNamespaceNode(namespace, true))
  +             DTM.NULL != namespace; namespace = 
dtm.getNextNamespaceNode(src, namespace, true))
           {
             String prefix = dtm.getPrefix(namespace);
             String desturi = getURI(prefix);
  @@ -1365,7 +1365,7 @@
      */
     public org.w3c.dom.Node getCurrentNode()
     {
  -    // %TBD% Need DTM2DOM stuff
  +    // %DTBD% Need DTM2DOM stuff
       return null;
   //    QueuedStartElement qe = getQueuedElem();
   //    if(null != qe && qe.isPending)
  @@ -1425,7 +1425,7 @@
      */
     public org.w3c.dom.Node getMatchedNode()
     {
  -    // %TBD% Need DTM2DOM stuff
  +    // %DTBD% Need DTM2DOM stuff
       return null;
   //    QueuedStartElement qe = getQueuedElem();
   //    if(null != qe && qe.isPending)
  @@ -1441,7 +1441,7 @@
      */
     public org.w3c.dom.traversal.NodeIterator getContextNodeList()
     {
  -    // %TBD% Need DTM2DOM stuff
  +    // %DTBD% Need DTM2DOM stuff
       return null;
   //    QueuedStartElement qe = getQueuedElem();
   //    if(null != qe && qe.isPending)
  
  
  
  1.5.2.2   +1 -1      
xml-xalan/java/src/org/apache/xalan/transformer/StackGuard.java
  
  Index: StackGuard.java
  ===================================================================
  RCS file: 
/home/cvs/xml-xalan/java/src/org/apache/xalan/transformer/StackGuard.java,v
  retrieving revision 1.5.2.1
  retrieving revision 1.5.2.2
  diff -u -r1.5.2.1 -r1.5.2.2
  --- StackGuard.java   2001/04/10 18:45:03     1.5.2.1
  +++ StackGuard.java   2001/05/06 02:09:35     1.5.2.2
  @@ -177,7 +177,7 @@
     {
   
       // for the moment, these diagnostics are really bad...
  -    // %TBD% We need an execution context.
  +    // %DTBD% We need an execution context.
   //    if (m_sourceXML instanceof Text)
   //    {
   //      Text tx = (Text) m_sourceXML;
  
  
  
  1.1.2.1   +14 -4     
xml-xalan/java/src/org/apache/xalan/transformer/TransformSnapshotImpl.java
  
  Index: TransformSnapshotImpl.java
  ===================================================================
  RCS file: 
/home/cvs/xml-xalan/java/src/org/apache/xalan/transformer/TransformSnapshotImpl.java,v
  retrieving revision 1.1
  retrieving revision 1.1.2.1
  diff -u -r1.1 -r1.1.2.1
  --- TransformSnapshotImpl.java        2001/03/28 04:42:01     1.1
  +++ TransformSnapshotImpl.java        2001/05/06 02:09:35     1.1.2.1
  @@ -56,8 +56,16 @@
      * org.apache.xalan.transformer.TransformState interface,  
      * so a tool can discover the matched template, and matched 
      * node. */
  -  private NodeVector m_currentMatchTemplates = new NodeVector();
  +  private Stack m_currentMatchTemplates = new Stack();
   
  +  /** A node vector used as a stack to track the current 
  +   * ElemTemplate that was matched, as well as the node that 
  +   * was matched.  Needed for the 
  +   * org.apache.xalan.transformer.TransformState interface,  
  +   * so a tool can discover the matched template, and matched 
  +   * node. */
  +  private NodeVector m_currentMatchNodes = new NodeVector();
  +
     /**
      * The table of counters for xsl:number support.
      * @see ElemNumber
  @@ -121,7 +129,8 @@
     
         m_currentTemplateRuleIsNull = 
(BoolStack)transformer.m_currentTemplateRuleIsNull.clone();
         m_currentTemplateElements = 
(NodeVector)transformer.m_currentTemplateElements.clone();
  -      m_currentMatchTemplates = 
(NodeVector)transformer.m_currentMatchTemplates.clone();
  +      m_currentMatchTemplates = 
(Stack)transformer.m_currentMatchTemplates.clone();
  +      m_currentMatchNodes = 
(NodeVector)transformer.m_currentMatchedNodes.clone();
         m_countersTable = (CountersTable)transformer.m_countersTable.clone();
         m_attrSetStack = (Stack)transformer.m_attrSetStack.clone();
       }
  @@ -164,8 +173,9 @@
         xpc.setAxesIteratorStackStacks((Stack)m_axesIteratorStack.clone());
     
         transformer.m_currentTemplateRuleIsNull = 
(BoolStack)m_currentTemplateRuleIsNull.clone();
  -      transformer.m_currentTemplateElements = 
(NodeVector)m_currentTemplateElements.clone();
  -      transformer.m_currentMatchTemplates = 
(NodeVector)m_currentMatchTemplates.clone();
  +      transformer.m_currentTemplateElements = 
(Stack)m_currentTemplateElements.clone();
  +      transformer.m_currentMatchTemplates = 
(Stack)m_currentMatchTemplates.clone();
  +      transformer.m_currentMatchedNodes = 
(NodeVector)m_currentMatchNodes.clone();
         transformer.m_countersTable = (CountersTable)m_countersTable.clone();
         transformer.m_attrSetStack = (Stack)m_attrSetStack.clone();
       }
  
  
  
  1.90.2.2  +153 -145  
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.1
  retrieving revision 1.90.2.2
  diff -u -r1.90.2.1 -r1.90.2.2
  --- TransformerImpl.java      2001/04/10 18:45:04     1.90.2.1
  +++ TransformerImpl.java      2001/05/06 02:09:35     1.90.2.2
  @@ -128,6 +128,8 @@
   //import org.w3c.dom.Node;
   import org.apache.xml.dtm.DTM;
   import org.apache.xml.dtm.DTMIterator;
  +import org.apache.xml.dtm.DTMManager;
  +import org.apache.xml.dtm.DTMWSFilter;
   
   // SAX2 Imports
   import org.xml.sax.ContentHandler;
  @@ -171,7 +173,7 @@
    * representation of the transformation execution.</p>
    */
   public class TransformerImpl extends Transformer
  -        implements Runnable /* %TBD% , TransformState */
  +        implements Runnable, DTMWSFilter /* %TBD% , TransformState */
   {
     // Synch object to gaurd against setting values from the TrAX interface 
     // or reentry while the transform is going on.
  @@ -256,15 +258,23 @@
      * ElemTemplateElement.  Needed for the 
      * org.apache.xalan.transformer.TransformState interface,  
      * so a tool can discover the calling template. */
  -  NodeVector m_currentTemplateElements = new NodeVector(64);
  +  Stack m_currentTemplateElements = new Stack();
   
     /** A node vector used as a stack to track the current 
  -   * ElemTemplate that was matched, as well as the node that 
  -   * was matched.  Needed for the 
  +   * ElemTemplate that was matched.
  +   * Needed for the 
      * org.apache.xalan.transformer.TransformState interface,  
  -   * so a tool can discover the matched template, and matched 
  +   * so a tool can discover the matched template
  +   */
  +  Stack m_currentMatchTemplates = new Stack();
  +  
  +  /** A node vector used as a stack to track the current 
  +   * node that was matched.
  +   * Needed for the 
  +   * org.apache.xalan.transformer.TransformState interface,  
  +   * so a tool can discover the matched 
      * node. */
  -  NodeVector m_currentMatchTemplates = new NodeVector();
  +  NodeVector m_currentMatchedNodes = new NodeVector();
   
     /**
      * The root of a linked set of stylesheets.
  @@ -357,10 +367,12 @@
      */
     private boolean m_isTransformDone = false;
     
  -  // %TODO% Doc
  +  /** Flag to to tell if the tranformer needs to be reset. */
     private boolean m_hasBeenReset = false;
     
  -  // %TODO% Doc
  +  /**
  +   * A stack of current template modes.
  +   */
     private Stack m_modes = new Stack();
     
     //==========================================================
  @@ -409,6 +421,7 @@
         getXPathContext().getVarStack().setSize(1);
         m_currentTemplateElements.removeAllElements();
         m_currentMatchTemplates.removeAllElements();
  +      m_currentMatchedNodes.removeAllElements();
     
         m_resultTreeHandler = null;
         m_outputTarget = null;
  @@ -605,31 +618,37 @@
           sth.setInputSource(source);
           sth.setUseMultiThreading(true);
   
  -        // %TBD%
  -//        Node doc = sth.getRoot();
  -//
  -//        if (null != doc)
  -//        {
  -//          SourceTreeManager stm = getXPathContext().getSourceTreeManager();
  -//          stm.putDocumentInCache(doc, source);
  -//
  -//          m_xmlSource = source;
  -//          m_doc = doc;
  -//
  -//          if (isParserEventsOnMain())
  -//          {
  -//            m_isTransformDone = false;
  -//
  -//            getXPathContext().getPrimaryReader().parse(xmlSource);
  -//          }
  -//          else
  -//          {
  -//            Thread t = createTransformThread();
  -//  //            m_reportInPostExceptionFromThread = false;
  -//            t.start();
  -//            transformNode(doc);
  -//          }
  -//        }
  +        int doc = sth.getDTMRoot();
  +
  +        if (DTM.NULL != doc)
  +        {
  +          SourceTreeManager stm = getXPathContext().getSourceTreeManager();
  +          // stm.putDocumentInCache(doc, source);
  +
  +          m_xmlSource = source;
  +          // m_doc = doc;
  +
  +          if (isParserEventsOnMain())
  +          {
  +            m_isTransformDone = false;
  +            try
  +            {
  +            getXPathContext().getPrimaryReader().parse(xmlSource);
  +            }
  +            catch(Exception e)
  +            {
  +              e.printStackTrace();
  +            }
  +          }
  +          else
  +          {
  +            Thread t = createTransformThread();
  +//            m_reportInPostExceptionFromThread = false;
  +            t.start();
  +            
  +            // transformNode(doc);
  +          }
  +        }
         }
         else
         {
  @@ -1071,7 +1090,7 @@
       // If the Result object contains a Node, then create 
       // a ContentHandler that will add nodes to the input node.
       // %TBD%
  -//    Node outputNode = null;
  +    int outputNode = DTM.NULL;
       if(outputTarget instanceof DOMResult)
       {
         // %TBD%
  @@ -1612,7 +1631,7 @@
   
            int sourceNode = xctxt.getCurrentNode();
          // Use result tree fragment
  -       // %TBD% Make sure current node is pushed.
  +       // %REVIEW% Make sure current node is pushed.
           int df = transformToRTF(xslParamElement);
   
           var = new XRTreeFrag(xctxt.createDTMIterator(df));
  @@ -1786,90 +1805,53 @@
             ElemTemplateElement templateParent)
               throws TransformerException
     {
  -    // %TBD%
  -    return 0;
  -//    // XPathContext xctxt = getXPathContext();
  -//    // Document docFactory = xctxt.getDOMHelper().getDOMFactory();
  -//    ContentHandler rtfHandler;
  -//    DocumentFragment resultFragment;
  -//    
  -//    // If this is an Stree instance, handle it with SourceTreeHandler
  -//    // and bypass the whole DOM process.
  -//    boolean isSTree = (sourceNode instanceof org.apache.xalan.stree.Child);
  -//    if (isSTree)
  -//    {      
  -//      rtfHandler = new SourceTreeHandler(this, true);
  -//      ((SourceTreeHandler)rtfHandler).setUseMultiThreading(false);
  -//      ((SourceTreeHandler)rtfHandler).setShouldTransformAtEnd(false);
  -//      // Create a ResultTreeFrag object.
  -//      resultFragment = 
(DocumentFragment)((SourceTreeHandler)rtfHandler).getRoot();
  -//      // 
((org.apache.xalan.stree.DocumentFragmentImpl)resultFragment).setComplete(true);
     
  -//    }     
  -//    else
  -//    {
  -//      if (null == m_docBuilder)
  -//      {
  -//        try
  -//        {
  -//          DocumentBuilderFactory dfactory =
  -//                                 DocumentBuilderFactory.newInstance();
  -//
  -//          dfactory.setNamespaceAware(true);
  -//          dfactory.setValidating(true);
  -//
  -//          m_docBuilder = dfactory.newDocumentBuilder();
  -//        }
  -//        catch (ParserConfigurationException pce)
  -//        {
  -//          throw new TransformerException(pce);  //"createDocument() not 
supported in XPathContext!");
  -//
  -//          // return null;
  -//        }
  -//      }     
  -//      Document docFactory = m_docBuilder.newDocument();
  -//      // Create a ResultTreeFrag object.
  -//      resultFragment = docFactory.createDocumentFragment();           
  -//      // Create a DOMBuilder object that will handle the SAX events 
  -//      // and build the ResultTreeFrag nodes.
  -//      rtfHandler = new DOMBuilder(docFactory, resultFragment);
  -//    }
  -//
  -//    // Save the current result tree handler.
  -//    ResultTreeHandler savedRTreeHandler = this.m_resultTreeHandler;
  -//
  -//    // And make a new handler for the RTF.
  -//    m_resultTreeHandler = new ResultTreeHandler(this, rtfHandler);
  -//    ResultTreeHandler rth = m_resultTreeHandler;
  -//
  -//    try
  -//    {
  -//      rth.startDocument();
  -//  
  -//      try
  -//      {
  -//        // Do the transformation of the child elements.
  -//        executeChildTemplates(templateParent, sourceNode, mode, true);
  -//        
  -//        // Make sure everything is flushed!
  -//        rth.flushPending();
  -//      }
  -//      finally
  -//      {      
  -//        rth.endDocument();
  -//      }
  -//    }
  -//    catch(org.xml.sax.SAXException se)
  -//    {
  -//      throw new TransformerException(se);
  -//    }
  -//
  -//    finally
  -//    {
  -//    // Restore the previous result tree handler.
  -//    this.m_resultTreeHandler = savedRTreeHandler;
  -//    }
  -//    
  -//    return resultFragment;
  +    // XPathContext xctxt = getXPathContext();
  +    // Document docFactory = xctxt.getDOMHelper().getDOMFactory();
  +    ContentHandler rtfHandler;
  +    int resultFragment = DTM.NULL;
  +    
  +    rtfHandler = new SourceTreeHandler(this, true);
  +    ((SourceTreeHandler)rtfHandler).setUseMultiThreading(false);
  +    ((SourceTreeHandler)rtfHandler).setShouldTransformAtEnd(false);
  +    // Create a ResultTreeFrag object.
  +    resultFragment = ((SourceTreeHandler)rtfHandler).getDTMRoot();
  +
  +    // Save the current result tree handler.
  +    ResultTreeHandler savedRTreeHandler = this.m_resultTreeHandler;
  +
  +    // And make a new handler for the RTF.
  +    m_resultTreeHandler = new ResultTreeHandler(this, rtfHandler);
  +    ResultTreeHandler rth = m_resultTreeHandler;
  +
  +    try
  +    {
  +      rth.startDocument();
  +  
  +      try
  +      {
  +        // Do the transformation of the child elements.
  +        executeChildTemplates(templateParent, true);
  +        
  +        // Make sure everything is flushed!
  +        rth.flushPending();
  +      }
  +      finally
  +      {      
  +        rth.endDocument();
  +      }
  +    }
  +    catch(org.xml.sax.SAXException se)
  +    {
  +      throw new TransformerException(se);
  +    }
  +
  +    finally
  +    {
  +      // Restore the previous result tree handler.
  +      this.m_resultTreeHandler = savedRTreeHandler;
  +    }
  +    
  +    return resultFragment;
     }
   
   
  @@ -1932,7 +1914,7 @@
         }
         else
         {
  -
  +        // Leave Commented.  -sb
           // serializer.setWriter(sw);
           // serializer.setOutputFormat(m_textformat);
           // ContentHandler shandler = serializer.asContentHandler();
  @@ -2026,7 +2008,7 @@
         try
         {
           xctxt.setNamespaceContext(xslInstruction);
  -        // %TBD%
  +
           QName mode = this.getMode();
           template = m_stylesheetRoot.getTemplateComposed(xctxt, child, mode, 
maxImportLevel,
                                     m_quietConflictWarnings);
  @@ -2104,10 +2086,6 @@
   
           m_xcontext.setSAXLocator(template);
   
  -        // %TBD% ??
  -//        if (template.isCompiledTemplate())
  -//          template.execute(this, child, mode);
  -//        else
           executeChildTemplates(template, true);
         }
       }
  @@ -2202,9 +2180,8 @@
       // Check for infinite loops if we have to.
       boolean check = (m_stackGuard.m_recursionLimit > -1);
   
  -    // %TBD%
  -//    if (check)
  -//      getStackGuard().push(elem, sourceNode);
  +    if (check)
  +      getStackGuard().push(elem, xctxt.getCurrentNode());
   
       // We need to push an element frame in the variables stack, 
       // so all the variables can be popped at once when we're done.
  @@ -2226,8 +2203,7 @@
           if(!shouldAddAttrs && t.getXSLToken() == 
Constants.ELEMNAME_ATTRIBUTE)
             continue;
           xctxt.setSAXLocator(t);
  -        // %TBD% NodeVector may not work for this purpose anymore
  -//        m_currentTemplateElements.setTail(t);
  +        m_currentTemplateElements.setElementAt(t, 
m_currentTemplateElements.size()-1);
           t.execute(this);
         }
       }
  @@ -2354,8 +2330,7 @@
      */
     public void pushElemTemplateElement(ElemTemplateElement elem)
     {
  -        // %TBD% NodeVector may not work for this purpose anymore
  -//    m_currentTemplateElements.push(elem);
  +     m_currentTemplateElements.push(elem);
     }
   
     /**
  @@ -2375,8 +2350,7 @@
      */
     public void setCurrentElement(ElemTemplateElement e)
     {
  -        // %TBD% NodeVector may not work for this purpose anymore
  -//    m_currentTemplateElements.setTail(e);
  +    m_currentTemplateElements.setElementAt(e, 
m_currentTemplateElements.size()-1);
     }
   
     /**
  @@ -2388,9 +2362,7 @@
      */
     public ElemTemplateElement getCurrentElement()
     {
  -        // %TBD% NodeVector may not work for this purpose anymore
  -      return null;
  -//    return (ElemTemplateElement) m_currentTemplateElements.peepTail();
  +    return (ElemTemplateElement) m_currentTemplateElements.peek();
     }
   
     /**
  @@ -2438,8 +2410,8 @@
      */
     public void pushPairCurrentMatched(ElemTemplateElement template, int child)
     {
  -        // %TBD% NodeVector may not work for this purpose anymore
  -//    m_currentMatchTemplates.pushPair(template, child);
  +    m_currentMatchTemplates.push(template);
  +    m_currentMatchedNodes.push(child);
     }
   
     /**
  @@ -2447,7 +2419,8 @@
      */
     public void popCurrentMatched()
     {
  -    m_currentMatchTemplates.popPair();
  +    m_currentMatchTemplates.pop();
  +    m_currentMatchedNodes.pop();
     }
   
     /**
  @@ -2461,9 +2434,7 @@
      */
     public ElemTemplate getMatchedTemplate()
     {
  -        // %TBD% NodeVector may not work for this purpose anymore
  -      return null;
  -//    return (ElemTemplate) m_currentMatchTemplates.peepTailSub1();
  +    return (ElemTemplate) m_currentMatchTemplates.peek();
     }
   
     /**
  @@ -2475,7 +2446,7 @@
      */
     public int getMatchedNode()
     {
  -    return m_currentMatchTemplates.peepTail();
  +    return m_currentMatchedNodes.peepTail();
     }
   
     /**
  @@ -2985,7 +2956,7 @@
   
       try
       {
  -      // Node n = ((SourceTreeHandler)getInputContentHandler()).getRoot();
  +      // int n = ((SourceTreeHandler)getInputContentHandler()).getDTMRoot();
         // transformNode(n);
         if (isParserEventsOnMain())
         {
  @@ -2997,6 +2968,7 @@
           }
           catch (Exception e)
           {
  +          // e.printStackTrace();
             // Strange that the other catch won't catch this...
             postExceptionFromThread(e);
           }
  @@ -3018,6 +2990,7 @@
       }
       catch (Exception e)
       {
  +      // e.printStackTrace();
         postExceptionFromThread(e);
       }
     }
  @@ -3041,6 +3014,41 @@
     public void stopTransformation()
     {
     }
  +  
  +  /**
  +   * Test whether whitespace-only text nodes are visible in the logical 
  +   * view of <code>DTM</code>. Normally, this function
  +   * will be called by the implementation of <code>DTM</code>; 
  +   * it is not normally called directly from
  +   * user code.
  +   * 
  +   * @param elementHandle int Handle of the element.
  +   * @return one of NOTSTRIP, STRIP, or INHERIT.
  +   */
  +  public short getShouldStripSpace(int elementHandle)
  +  {
  +    try
  +    {      
  +      org.apache.xalan.templates.WhiteSpaceInfo info = 
  +        m_stylesheetRoot.getWhiteSpaceInfo(m_xcontext, elementHandle);
  +         
  +      if (null == info)
  +      {
  +        return DTMWSFilter.INHERIT;
  +      }
  +      else
  +      {
  +        // System.out.println("getShouldStripSpace: 
"+info.getShouldStripSpace());
  +        return info.getShouldStripSpace() ? DTMWSFilter.STRIP : 
DTMWSFilter.NOTSTRIP;
  +      }
  +    }
  +    catch (TransformerException se)
  +    {
  +      return DTMWSFilter.INHERIT;
  +    }
  +
  +  }
  +
     
   }  // end TransformerImpl class
   
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.1.2.4   +169 -166  
xml-xalan/java/src/org/apache/xml/dtm/Attic/CoroutineSAXParser.java
  
  Index: CoroutineSAXParser.java
  ===================================================================
  RCS file: 
/home/cvs/xml-xalan/java/src/org/apache/xml/dtm/Attic/CoroutineSAXParser.java,v
  retrieving revision 1.1.2.3
  retrieving revision 1.1.2.4
  diff -u -r1.1.2.3 -r1.1.2.4
  --- CoroutineSAXParser.java   2001/04/22 22:08:27     1.1.2.3
  +++ CoroutineSAXParser.java   2001/05/06 02:09:39     1.1.2.4
  @@ -108,23 +108,23 @@
      * %TBD% whether we should consider supporting SAX1
      */
     public CoroutineSAXParser(CoroutineManager co, int appCoroutine,
  -                         org.xml.sax.XMLReader parser) {
  +                            org.xml.sax.XMLReader parser) {
       xmlreader=parser;
       xmlreader.setContentHandler(this);
   
       // Not supported by all SAX2 parsers:
       try 
         {
  -     xmlreader.setProperty("http://xml.org/sax/properties/lexical-handler";,
  -                           this);
  +        
xmlreader.setProperty("http://xml.org/sax/properties/lexical-handler";,
  +                              this);
         }
       catch(SAXNotRecognizedException e)
         {
  -     // Nothing we can do about it
  +        // Nothing we can do about it
         }
       catch(SAXNotSupportedException e)
         {
  -     // Nothing we can do about it
  +        // Nothing we can do about it
         }
   
       eventcounter=frequency;
  @@ -189,8 +189,8 @@
     {
       if(--eventcounter<=0)
         {
  -     co_yield(true);
  -     eventcounter=frequency;
  +        co_yield(true);
  +        eventcounter=frequency;
         }
       if(clientContentHandler!=null)
         clientContentHandler.characters(ch,start,length);
  @@ -211,8 +211,8 @@
     {
       if(--eventcounter<=0)
         {
  -     co_yield(true);
  -     eventcounter=frequency;
  +        co_yield(true);
  +        eventcounter=frequency;
         }
       if(clientContentHandler!=null)
         clientContentHandler.endElement(namespaceURI,localName,qName);
  @@ -222,8 +222,8 @@
     {
       if(--eventcounter<=0)
         {
  -     co_yield(true);
  -     eventcounter=frequency;
  +        co_yield(true);
  +        eventcounter=frequency;
         }
       if(clientContentHandler!=null)
         clientContentHandler.endPrefixMapping(prefix);
  @@ -233,8 +233,8 @@
     {
       if(--eventcounter<=0)
         {
  -     co_yield(true);
  -     eventcounter=frequency;
  +        co_yield(true);
  +        eventcounter=frequency;
         }
       if(clientContentHandler!=null)
         clientContentHandler.ignorableWhitespace(ch,start,length);
  @@ -244,8 +244,8 @@
     {
       if(--eventcounter<=0)
         {
  -     co_yield(true);
  -     eventcounter=frequency;
  +        co_yield(true);
  +        eventcounter=frequency;
         }
       if(clientContentHandler!=null)
         clientContentHandler.processingInstruction(target,data);
  @@ -254,8 +254,8 @@
     {
       if(--eventcounter<=0)
         {
  -     co_yield(true);
  -     eventcounter=frequency;
  +        co_yield(true);
  +        eventcounter=frequency;
         }
       if(clientContentHandler!=null)
         clientContentHandler.setDocumentLocator(locator);
  @@ -265,8 +265,8 @@
     {
       if(--eventcounter<=0)
         {
  -     co_yield(true);
  -     eventcounter=frequency;
  +        co_yield(true);
  +        eventcounter=frequency;
         }
       if(clientContentHandler!=null)
         clientContentHandler.skippedEntity(name);
  @@ -276,8 +276,8 @@
     {
       if(--eventcounter<=0)
         {
  -     co_yield(true);
  -     eventcounter=frequency;
  +        co_yield(true);
  +        eventcounter=frequency;
         }
       if(clientContentHandler!=null)
         clientContentHandler.startDocument();
  @@ -288,8 +288,8 @@
     {
       if(--eventcounter<=0)
         {
  -     co_yield(true);
  -     eventcounter=frequency;
  +        co_yield(true);
  +        eventcounter=frequency;
         }
       if(clientContentHandler!=null)
         clientContentHandler.startElement(namespaceURI, localName, qName, 
atts);
  @@ -299,8 +299,8 @@
     {
       if(--eventcounter<=0)
         {
  -     co_yield(true);
  -     eventcounter=frequency;
  +        co_yield(true);
  +        eventcounter=frequency;
         }
       if(clientContentHandler!=null)
         clientContentHandler.startPrefixMapping(prefix,uri);
  @@ -385,8 +385,8 @@
       
       if(--eventcounter<=0)
         {
  -     co_yield(true);
  -     eventcounter=frequency;
  +        co_yield(true);
  +        eventcounter=frequency;
         }
     }
     
  @@ -416,37 +416,37 @@
       Object arg= notYetDone ? Boolean.TRUE : Boolean.FALSE;
       try
         {
  -     arg = fCoroutineManager.co_resume(arg, fParserCoroutine, fAppCoroutine);
  -     
  -     if (arg == null) {
  -       fCoroutineManager.co_exit_to(arg, fParserCoroutine, fAppCoroutine);
  -       throw shutdownException;
  -     }
  -
  -     else if (arg instanceof Boolean) {
  -       boolean keepgoing = ((Boolean)arg).booleanValue();
  -       if (!keepgoing)
  -         throw stopException;
  -       }
  -
  -     else // Unexpected!
  -       {
  -         System.err.println(
  -               "Active CoroutineSAXParser: unexpected resume parameter, "
  -               +arg.getClass
  -               ()+" with value=\""+arg+'"');
  -         System.err.println("\tStopping parser rather than risk deadlock");
  -         throw new RuntimeException("Coroutine parameter error ("+arg+')');
  -       }
  +        arg = fCoroutineManager.co_resume(arg, fParserCoroutine, 
fAppCoroutine);
  +        
  +        if (arg == null) {
  +          fCoroutineManager.co_exit_to(arg, fParserCoroutine, fAppCoroutine);
  +          throw shutdownException;
  +        }
  +
  +        else if (arg instanceof Boolean) {
  +          boolean keepgoing = ((Boolean)arg).booleanValue();
  +          if (!keepgoing)
  +            throw stopException;
  +          }
  +
  +        else // Unexpected!
  +          {
  +            System.err.println(
  +                  "Active CoroutineSAXParser: unexpected resume parameter, "
  +                  +arg.getClass
  +                  ()+" with value=\""+arg+'"');
  +            System.err.println("\tStopping parser rather than risk 
deadlock");
  +            throw new RuntimeException("Coroutine parameter error 
("+arg+')');
  +          }
   
         }
       catch(java.lang.NoSuchMethodException e)
         {
  -     // Shouldn't happen unless we've miscoded our coroutine logic
  -     // "Shut down the garbage smashers on the detention level!"
  -     e.printStackTrace(System.err);
  -     fCoroutineManager.co_exit(fParserCoroutine);
  -     throw shutdownException;
  +        // Shouldn't happen unless we've miscoded our coroutine logic
  +        // "Shut down the garbage smashers on the detention level!"
  +        e.printStackTrace(System.err);
  +        fCoroutineManager.co_exit(fParserCoroutine);
  +        throw shutdownException;
         }
     }
   
  @@ -471,69 +471,69 @@
     public void run() {
       try 
         {
  -     for(Object arg=fCoroutineManager.co_entry_pause(fParserCoroutine);
  -         true;
  -         arg=fCoroutineManager.co_resume(arg, fParserCoroutine, 
fAppCoroutine))
  -       {
  -         
  -         // Shut down requested.
  -         if (arg == null) {
  -           if(DEBUG)System.out.println("CoroutineSAXParser at-rest shutdown 
requested");
  -           fCoroutineManager.co_exit_to(arg, fParserCoroutine, 
fAppCoroutine);
  -           break;
  -         }
  -         
  -         // Start-Parse requested
  -         // For the duration of this operation, all coroutine handshaking
  -         // will occur in the co_yield method. That's the nice thing about
  -         // coroutines; they give us a way to hand off control from the
  -         // middle of a synchronous method.
  -         if (arg instanceof InputSource) {
  -           try {
  -           if(DEBUG)System.out.println("Inactive CoroutineSAXParser new 
parse "+arg);
  -             xmlreader.parse((InputSource)arg);
  -             arg=Boolean.TRUE;
  -           }
  -
  -           catch (SAXException ex) {
  -             Exception inner=ex.getException();
  -             if(inner instanceof UserRequestedStopException){
  -               if(DEBUG)System.out.println("Active CoroutineSAXParser user 
stop exception");
  -               arg=Boolean.FALSE;
  -             }
  -             else if(inner instanceof UserRequestedShutdownException){
  -               if(DEBUG)System.out.println("Active CoroutineSAXParser user 
shutdown exception");
  -               break;
  -             }
  -             else {
  -               if(DEBUG)System.out.println("Active CoroutineSAXParser 
UNEXPECTED SAX exception: "+ex);
  -               arg=ex;                 
  -             }
  -             
  -           }
  -           catch(Exception ex)
  -             {                   
  -               if(DEBUG)System.out.println("Active CoroutineSAXParser 
non-SAX exception: "+ex);
  -               arg = ex;
  -             }
  -           
  -         }
  -
  -         else // Unexpected!
  -           {
  -             System.err.println(
  -               "Inactive CoroutineSAXParser: unexpected resume parameter, "
  -               +arg.getClass()+" with value=\""+arg+'"');
  -           }
  +        for(Object arg=fCoroutineManager.co_entry_pause(fParserCoroutine);
  +            true;
  +            arg=fCoroutineManager.co_resume(arg, fParserCoroutine, 
fAppCoroutine))
  +          {
  +            
  +            // Shut down requested.
  +            if (arg == null) {
  +              if(DEBUG)System.out.println("CoroutineSAXParser at-rest 
shutdown requested");
  +              fCoroutineManager.co_exit_to(arg, fParserCoroutine, 
fAppCoroutine);
  +              break;
  +            }
  +            
  +            // Start-Parse requested
  +            // For the duration of this operation, all coroutine handshaking
  +            // will occur in the co_yield method. That's the nice thing about
  +            // coroutines; they give us a way to hand off control from the
  +            // middle of a synchronous method.
  +            if (arg instanceof InputSource) {
  +              try {
  +              if(DEBUG)System.out.println("Inactive CoroutineSAXParser new 
parse "+arg);
  +                xmlreader.parse((InputSource)arg);
  +                arg=Boolean.TRUE;
  +              }
  +
  +              catch (SAXException ex) {
  +                Exception inner=ex.getException();
  +                if(inner instanceof UserRequestedStopException){
  +                  if(DEBUG)System.out.println("Active CoroutineSAXParser 
user stop exception");
  +                  arg=Boolean.FALSE;
  +                }
  +                else if(inner instanceof UserRequestedShutdownException){
  +                  if(DEBUG)System.out.println("Active CoroutineSAXParser 
user shutdown exception");
  +                  break;
  +                }
  +                else {
  +                  if(DEBUG)System.out.println("Active CoroutineSAXParser 
UNEXPECTED SAX exception: "+ex);
  +                  arg=ex;              
  +                }
  +                
  +              }
  +              catch(Exception ex)
  +                {
  +                  if(DEBUG)System.out.println("Active CoroutineSAXParser 
non-SAX exception: "+ex);
  +                  arg = ex;
  +                }
  +              
  +            }
  +
  +            else // Unexpected!
  +              {
  +                System.err.println(
  +                  "Inactive CoroutineSAXParser: unexpected resume parameter, 
"
  +                  +arg.getClass()+" with value=\""+arg+'"');
  +              }
   
  -       } // end while
  +          } // end while
         } // end try
       catch(java.lang.NoSuchMethodException e)
         {
  -     // Shouldn't happen unless we've miscoded our coroutine logic
  -     // "CPO, shut down the garbage smashers on the detention level!"
  -     e.printStackTrace(System.err);
  -     fCoroutineManager.co_exit(fParserCoroutine);
  +        // Shouldn't happen unless we've miscoded our coroutine logic
  +        // "CPO, shut down the garbage smashers on the detention level!"
  +        e.printStackTrace(System.err);
  +        fCoroutineManager.co_exit(fParserCoroutine);
         }
     }
   
  @@ -542,14 +542,10 @@
     class UserRequestedStopException extends RuntimeException
     {
     }
  -  UserRequestedStopException stopException=new UserRequestedStopException();
     
  -  /** Used so co_yield can return control to run for coroutine thread
  -   * termination.  */
  -  class UserRequestedShutdownException extends RuntimeException
  -  {
  -  }
  -  UserRequestedShutdownException shutdownException=new 
UserRequestedShutdownException();
  +  UserRequestedStopException stopException=new UserRequestedStopException();
  +    
  +  UserRequestedShutdownException shutdownException = new 
UserRequestedShutdownException();
   
     //================================================================
     /** Simple unit test. Attempt coroutine parsing of document indicated
  @@ -566,8 +562,8 @@
       int appCoroutine = co.co_joinCoroutineSet(-1);
       if (appCoroutine == -1)
         {
  -     System.out.println("ERROR: Couldn't allocate coroutine number.\n");
  -     return;
  +        System.out.println("ERROR: Couldn't allocate coroutine number.\n");
  +        return;
         }
       CoroutineSAXParser parser=
         new CoroutineSAXParser(co, appCoroutine, theSAXParser);
  @@ -582,58 +578,65 @@
       // Tell coroutine to begin parsing, run while parsing is in progress
       for(int arg=0;arg<args.length;++arg)
         {
  -     try
  -       {
  -         InputSource source = new InputSource(args[arg]);
  -         Object result=null;
  -         Boolean more=Boolean.TRUE;
  -         for(result = co.co_resume(source, appCoroutine, parserCoroutine);
  -             (result instanceof Boolean && ((Boolean)result)==Boolean.TRUE);
  -             result = co.co_resume(more, appCoroutine, parserCoroutine))
  -           {
  -             System.out.println("\nSome parsing successful, trying more.\n");
  -         
  -             // Special test: Terminate parsing early.
  -             if(arg+1<args.length && "!".equals(args[arg+1]))
  -               {
  -                 ++arg;
  -                 more=Boolean.FALSE;
  -               }
  -         
  -           }
  -     
  -         if (result instanceof Boolean && ((Boolean)result)==Boolean.FALSE)
  -           {
  -             System.out.println("\nParser ended (EOF or on request).\n");
  -           }
  -         else if (result == null) {
  -           System.out.println("\nUNEXPECTED: Parser says shut down 
prematurely.\n");
  -         }
  -         else if (result instanceof Exception) {
  -           System.out.println("\nParser threw exception:");
  -           ((Exception)result).printStackTrace();
  -         }
  -
  -       }
  -     catch(java.lang.NoSuchMethodException e)
  -       {
  -         System.out.println("\nUNEXPECTED Coroutine not resolved:");
  -         e.printStackTrace();
  -       }
  +        try
  +          {
  +            InputSource source = new InputSource(args[arg]);
  +            Object result=null;
  +            Boolean more=Boolean.TRUE;
  +            for(result = co.co_resume(source, appCoroutine, parserCoroutine);
  +                (result instanceof Boolean && 
((Boolean)result)==Boolean.TRUE);
  +                result = co.co_resume(more, appCoroutine, parserCoroutine))
  +              {
  +                System.out.println("\nSome parsing successful, trying 
more.\n");
  +            
  +                // Special test: Terminate parsing early.
  +                if(arg+1<args.length && "!".equals(args[arg+1]))
  +                  {
  +                    ++arg;
  +                    more=Boolean.FALSE;
  +                  }
  +            
  +              }
  +        
  +            if (result instanceof Boolean && 
((Boolean)result)==Boolean.FALSE)
  +              {
  +                System.out.println("\nParser ended (EOF or on request).\n");
  +              }
  +            else if (result == null) {
  +              System.out.println("\nUNEXPECTED: Parser says shut down 
prematurely.\n");
  +            }
  +            else if (result instanceof Exception) {
  +              System.out.println("\nParser threw exception:");
  +              ((Exception)result).printStackTrace();
  +            }
  +
  +          }
  +        catch(java.lang.NoSuchMethodException e)
  +          {
  +            System.out.println("\nUNEXPECTED Coroutine not resolved:");
  +            e.printStackTrace();
  +          }
         }
   
       try
         {
  -     System.out.println("Requesting parser shutdown");
  -     Object result = co.co_resume(null, appCoroutine, parserCoroutine);
  -     if(result!=null)
  -       System.out.println("\nUNEXPECTED: Parser co-shutdown answers 
"+result);
  +        System.out.println("Requesting parser shutdown");
  +        Object result = co.co_resume(null, appCoroutine, parserCoroutine);
  +        if(result!=null)
  +          System.out.println("\nUNEXPECTED: Parser co-shutdown answers 
"+result);
         }
       catch(java.lang.NoSuchMethodException e)
         {
  -     System.out.println("\nUNEXPECTED Coroutine not resolved:");
  -     e.printStackTrace();
  +        System.out.println("\nUNEXPECTED Coroutine not resolved:");
  +        e.printStackTrace();
         }
     }
  +  
  +  /** Used so co_yield can return control to run for coroutine thread
  +   * termination.  */
  +  class UserRequestedShutdownException extends RuntimeException
  +  {
  +  }
  +
     
   } // class CoroutineSAXParser
  
  
  
  1.1.2.11  +5 -3      xml-xalan/java/src/org/apache/xml/dtm/Attic/DTM.java
  
  Index: DTM.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xml/dtm/Attic/DTM.java,v
  retrieving revision 1.1.2.10
  retrieving revision 1.1.2.11
  diff -u -r1.1.2.10 -r1.1.2.11
  --- DTM.java  2001/04/27 18:12:06     1.1.2.10
  +++ DTM.java  2001/05/06 02:09:39     1.1.2.11
  @@ -153,7 +153,7 @@
     /** The node is a <code>namespace node</code>. Note that this is not
      * currently a node type defined by the DOM API.
      * */
  -  public static final short NAMESPACE_NODE             = 113;
  +  public static final short NAMESPACE_NODE             = 13;
     
     // ========= DTM Implementation Control Functions. ==============
   
  @@ -281,12 +281,14 @@
      * Given a namespace handle, advance to the next namespace in the same 
scope
      * (local or local-plus-inherited, as selected by getFirstNamespaceNode)
      * 
  +   * @param baseHandle handle to original node from where the first child 
  +   * 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 namespaceHandle, boolean inScope);
  +  public int getNextNamespaceNode(int baseHandle, int namespaceHandle, 
boolean inScope);
   
     /** Lightweight subtree-walker. Given a node handle, find the next
      * node in document order. (Preorder left-to-right traversal).  The
  @@ -432,7 +434,7 @@
      *
      * @return the expanded-name id of the node.
      */
  -  public int getExpandedNameID(String namespace, String localName);
  +  public int getExpandedNameID(String namespace, String localName, int type);
     
     /**
      * Given an expanded-name ID, return the local name part.
  
  
  
  1.1.2.2   +25 -25    
xml-xalan/java/src/org/apache/xml/dtm/Attic/DTMConstructor.java
  
  Index: DTMConstructor.java
  ===================================================================
  RCS file: 
/home/cvs/xml-xalan/java/src/org/apache/xml/dtm/Attic/DTMConstructor.java,v
  retrieving revision 1.1.2.1
  retrieving revision 1.1.2.2
  diff -u -r1.1.2.1 -r1.1.2.2
  --- DTMConstructor.java       2001/04/26 17:50:00     1.1.2.1
  +++ DTMConstructor.java       2001/05/06 02:09:40     1.1.2.2
  @@ -131,7 +131,7 @@
      * @return a non-null DTM reference.
      */
     public DTM getDTM(javax.xml.transform.Source source,
  -                             boolean unique){
  +                             boolean unique, DTMWSFilter whiteSpaceFilter){
         DTM dtmImpl;
         Integer iobj = null;
   
  @@ -161,8 +161,8 @@
             dtmAllocList.insertElementAt(dtmImpl, iobj.intValue());
         }
   
  -                     // ### shs:  startDocument and initDocument not 
declared in DTM interface
  -                     /*
  +                        // ### shs:  startDocument and initDocument not 
declared in DTM interface
  +                        /*
         if (iobj==null) dtmImpl.startDocument(0);
         else {
             dtmSymbolTable.put(dtmImpl,iobj);
  @@ -172,7 +172,7 @@
         }
         // %TBD%  note - need to determine how to load the source content, 
perhaps by
         //               passing the source object in the startDocument method
  -                     */
  +                        */
         return dtmImpl;
     }
   
  @@ -194,7 +194,7 @@
         // DTMManager register method call
         // ###yst: end comment modification
         if (dtmIndex == 0) 
  -                             return getDTM(null, false);
  +                                return getDTM(null, false, null);
         // managed DTM
         return (DTM)dtmAllocList.elementAt(dtmIndex);
     }
  @@ -204,9 +204,9 @@
      * @return a non-null DTM reference.
      */
     public DTM createDocumentFragment() {
  -             //  NEEDS to be worked ON!
  -             return null;
  -     }
  +                //  NEEDS to be worked ON!
  +                return null;
  +        }
   
     /**
      * Release a DTM either to a lru pool, or completely remove reference.
  @@ -230,7 +230,7 @@
             // remove completely, let it be garbage collected naturally
             if (shouldHardDelete) return true;
             else {
  -                                             // ###shs  Reset not declared 
in DTM interface
  +                                                // ###shs  Reset not 
declared in DTM interface
                 //dtm.reset();
                 dtmReuseList.addElement(dtm);
                 return false;
  @@ -251,9 +251,9 @@
      * @return The newly created <code>DTMIterator</code>.
      */
     public DTMIterator createDTMIterator(Object xpathCompiler, int pos) {
  -             // NEEDS TO BE WORKED ON!
  -             return null;
  -     }
  +                // NEEDS TO BE WORKED ON!
  +                return null;
  +        }
   
     /**
      * Create a new <code>DTMIterator</code> based on an XPath
  @@ -269,9 +269,9 @@
      * @return The newly created <code>DTMIterator</code>.
      */
     public DTMIterator createDTMIterator(String xpathString, PrefixResolver 
presolver) {
  -             // NEEDS TO BE WORKED ON!
  -             return null;
  -     }
  +                // NEEDS TO BE WORKED ON!
  +                return null;
  +        }
   
     /**
      * Create a new <code>DTMIterator</code> based only on a whatToShow and
  @@ -291,10 +291,10 @@
      * @return The newly created <code>DTMIterator</code>.
      */
     public DTMIterator createDTMIterator(int whatToShow, DTMFilter filter, 
  -                                                                             
                                                                         
boolean entityReferenceExpansion) {
  -             // NEEDS TO BE WORKED ON!
  -             return null;
  -     }
  +                                                                             
                                                                            
boolean entityReferenceExpansion) {
  +                // NEEDS TO BE WORKED ON!
  +                return null;
  +        }
   
     /**
      * Create a new <code>DTMIterator</code> that holds exactly one node.
  @@ -304,9 +304,9 @@
      * @return The newly created <code>DTMIterator</code>.
      */
     public DTMIterator createDTMIterator(int node) {
  -             // NEEDS TO BE WORKED ON!
  -             return null;
  -     }
  +                // NEEDS TO BE WORKED ON!
  +                return null;
  +        }
   
       // -------------------- private methods --------------------
   
  @@ -330,9 +330,9 @@
        * %TBD% Doc
        */
       public int getDTMIdentity(DTM dtm){
  -                     // NEEDS TO BE WORKED ON!
  -                     return -1;
  -             }
  +                        // NEEDS TO BE WORKED ON!
  +                        return -1;
  +                }
   
       /**
        * %TBD% Doc
  
  
  
  1.1.2.4   +1358 
-1354xml-xalan/java/src/org/apache/xml/dtm/Attic/DTMDocumentImpl.java
  
  Index: DTMDocumentImpl.java
  ===================================================================
  RCS file: 
/home/cvs/xml-xalan/java/src/org/apache/xml/dtm/Attic/DTMDocumentImpl.java,v
  retrieving revision 1.1.2.3
  retrieving revision 1.1.2.4
  diff -u -r1.1.2.3 -r1.1.2.4
  --- DTMDocumentImpl.java      2001/04/27 18:12:08     1.1.2.3
  +++ DTMDocumentImpl.java      2001/05/06 02:09:40     1.1.2.4
  @@ -89,1384 +89,1388 @@
    */
   public class DTMDocumentImpl implements DTM {
   
  -     // ###  Removed constants since defined in DTM interface
  +        // ###  Removed constants since defined in DTM interface
   
  -     int m_docHandle = NULL;          // masked document handle for this dtm 
document
  -     int m_docElement = NULL;         // nodeHandle to the root of the 
actual dtm doc content
  +        int m_docHandle = NULL;               // masked document handle for 
this dtm document
  +        int m_docElement = NULL;      // nodeHandle to the root of the 
actual dtm doc content
   
  -     // Context for parse-and-append operations
  -     int currentParent = 0;                  // current parent - default is 
document root
  -     int previousSibling = 0;                // previous sibling - no 
previous sibling
  -     protected int m_currentNode = -1;               // current node
  -     protected Stack m_elemStack = new Stack();       // element stack
  -     private boolean previousSiblingWasParent = false;
  -     // Local cache for record-at-a-time fetch
  -     int gotslot[] = new int[4];
  -
  -     // endDocument recieved?
  -     private boolean done = false;
  -     boolean m_isError = false;
  -
  -     private final boolean DEBUG = true;
  -
  -     // ========= DTM data structure declarations. ==============
  -
  -     // nodes array: integer array blocks to hold the first level reference 
of the nodes,
  -     // each reference slot is addressed by a nodeHandle index value
  -     ChunkedIntArray nodes = new ChunkedIntArray(4);
  -
  -     // text/comment table: string buffer to hold the text string values of 
the document,
  -     // each of which is addressed by the absolute offset and length in the 
buffer
  -     private FastStringBuffer m_char = new FastStringBuffer();
  -
  -     // node name table, name space table, attribute name table, and prefix 
name table
  -     // are can be defined as DTMStringPool(s).  But may be substituted with 
better data
  -     // structure that can support the DTMStringPool interface in the future.
  -
  -     private DTMStringPool m_elementNames = new DTMStringPool();
  -     private DTMStringPool m_nsNames = new DTMStringPool();
  -     private DTMStringPool m_attributeNames = new DTMStringPool();
  -     private DTMStringPool m_prefixNames = new DTMStringPool();
  -
  -     /**
  -              * Construct a DTM.
  -              */
  -     public DTMDocumentImpl(){
  -             initDocument(0);                 // clear nodes and document 
handle
  -     }
  -
  -     /**
  -      * Wrapper for ChunkedIntArray.append, to automatically update the
  -      * previous sibling's "next" reference (if necessary) and periodically
  -      * wake a reader who may have encountered incomplete data and entered
  -      * a wait state.
  -      * @param w0 int As in ChunkedIntArray.append
  -      * @param w1 int As in ChunkedIntArray.append
  -      * @param w2 int As in ChunkedIntArray.append
  -      * @param w3 int As in ChunkedIntArray.append
  -      * @return int As in ChunkedIntArray.append
  -      * @see ChunkedIntArray.append
  -      */
  -     private final int appendNode(int w0, int w1, int w2, int w3)
  -     {
  -             // A decent compiler will probably inline this.
  -             int slotnumber = nodes.appendSlot(w0, w1, w2, w3);
  -
  -             if (DEBUG) System.out.println(slotnumber+": "+w0+" "+w1+" 
"+w2+" "+w3);
  -
  -             if (previousSiblingWasParent)
  -                     nodes.writeEntry(previousSibling,2,slotnumber);
  -
  -             previousSiblingWasParent = false;       // Set the default; 
endElement overrides
  -
  -             return slotnumber;
  -     }
  -
  -     // ========= 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) {};
  -
  -     /**
  -      * Set a reference pointer to the element name symbol table.
  -      *
  -      * @param poolRef DTMStringPool reference to an instance of table.
  -      */
  -     void setElementNameTable(DTMStringPool poolRef) {
  -             m_elementNames = poolRef;
  -     }
  -
  -     /**
  -      * Get a reference pointer to the element name symbol table.
  -      *
  -      * @return DTMStringPool reference to an instance of table.
  -      */
  -     DTMStringPool getElementNameTable() {
  -             return m_elementNames;
  -     }
  -
  -     /**
  -      * Set a reference pointer to the namespace URI symbol table.
  -      *
  -      * @param poolRef DTMStringPool reference to an instance of table.
  -      */
  -     void setNsNameTable(DTMStringPool poolRef) {
  -             m_nsNames = poolRef;
  -     }
  -
  -     /**
  -      * Get a reference pointer to the namespace URI symbol table.
  -      *
  -      * @return DTMStringPool reference to an instance of table.
  -      */
  -     DTMStringPool getNsNameTable() {
  -       return m_nsNames;
  -     }
  -
  -     /**
  -      * Set a reference pointer to the attribute name symbol table.
  -      *
  -      * @param poolRef DTMStringPool reference to an instance of table.
  -      */
  +        // Context for parse-and-append operations
  +        int currentParent = 0;                       // current parent - 
default is document root
  +        int previousSibling = 0;             // previous sibling - no 
previous sibling
  +        protected int m_currentNode = -1;            // current node
  +        protected Stack m_elemStack = new Stack();    // element stack
  +        private boolean previousSiblingWasParent = false;
  +        // Local cache for record-at-a-time fetch
  +        int gotslot[] = new int[4];
  +
  +        // endDocument recieved?
  +        private boolean done = false;
  +        boolean m_isError = false;
  +
  +        private final boolean DEBUG = true;
  +
  +        // ========= DTM data structure declarations. ==============
  +
  +        // nodes array: integer array blocks to hold the first level 
reference of the nodes,
  +        // each reference slot is addressed by a nodeHandle index value
  +        ChunkedIntArray nodes = new ChunkedIntArray(4);
  +
  +        // text/comment table: string buffer to hold the text string values 
of the document,
  +        // each of which is addressed by the absolute offset and length in 
the buffer
  +        private FastStringBuffer m_char = new FastStringBuffer();
  +
  +        // node name table, name space table, attribute name table, and 
prefix name table
  +        // are can be defined as DTMStringPool(s).  But may be substituted 
with better data
  +        // structure that can support the DTMStringPool interface in the 
future.
  +
  +        private DTMStringPool m_elementNames = new DTMStringPool();
  +        private DTMStringPool m_nsNames = new DTMStringPool();
  +        private DTMStringPool m_attributeNames = new DTMStringPool();
  +        private DTMStringPool m_prefixNames = new DTMStringPool();
  +
  +        /**
  +                 * Construct a DTM.
  +                 */
  +        public DTMDocumentImpl(){
  +                initDocument(0);              // clear nodes and document 
handle
  +        }
  +
  +        /**
  +         * Wrapper for ChunkedIntArray.append, to automatically update the
  +         * previous sibling's "next" reference (if necessary) and 
periodically
  +         * wake a reader who may have encountered incomplete data and entered
  +         * a wait state.
  +         * @param w0 int As in ChunkedIntArray.append
  +         * @param w1 int As in ChunkedIntArray.append
  +         * @param w2 int As in ChunkedIntArray.append
  +         * @param w3 int As in ChunkedIntArray.append
  +         * @return int As in ChunkedIntArray.append
  +         * @see ChunkedIntArray.append
  +         */
  +        private final int appendNode(int w0, int w1, int w2, int w3)
  +        {
  +                // A decent compiler will probably inline this.
  +                int slotnumber = nodes.appendSlot(w0, w1, w2, w3);
  +
  +                if (DEBUG) System.out.println(slotnumber+": "+w0+" "+w1+" 
"+w2+" "+w3);
  +
  +                if (previousSiblingWasParent)
  +                        nodes.writeEntry(previousSibling,2,slotnumber);
  +
  +                previousSiblingWasParent = false;    // Set the default; 
endElement overrides
  +
  +                return slotnumber;
  +        }
  +
  +        // ========= 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) {};
  +
  +        /**
  +         * Set a reference pointer to the element name symbol table.
  +         *
  +         * @param poolRef DTMStringPool reference to an instance of table.
  +         */
  +        void setElementNameTable(DTMStringPool poolRef) {
  +                m_elementNames = poolRef;
  +        }
  +
  +        /**
  +         * Get a reference pointer to the element name symbol table.
  +         *
  +         * @return DTMStringPool reference to an instance of table.
  +         */
  +        DTMStringPool getElementNameTable() {
  +                return m_elementNames;
  +        }
  +
  +        /**
  +         * Set a reference pointer to the namespace URI symbol table.
  +         *
  +         * @param poolRef DTMStringPool reference to an instance of table.
  +         */
  +        void setNsNameTable(DTMStringPool poolRef) {
  +                m_nsNames = poolRef;
  +        }
  +
  +        /**
  +         * Get a reference pointer to the namespace URI symbol table.
  +         *
  +         * @return DTMStringPool reference to an instance of table.
  +         */
  +        DTMStringPool getNsNameTable() {
  +          return m_nsNames;
  +        }
  +
  +        /**
  +         * Set a reference pointer to the attribute name symbol table.
  +         *
  +         * @param poolRef DTMStringPool reference to an instance of table.
  +         */
           void setAttributeNameTable(DTMStringPool poolRef) {
  -             m_attributeNames = poolRef;
  -     }
  +                m_attributeNames = poolRef;
  +        }
   
  -     /**
  -      * Get a reference pointer to the attribute name symbol table.
  -      *
  -      * @return DTMStringPool reference to an instance of table.
  -      */
  +        /**
  +         * Get a reference pointer to the attribute name symbol table.
  +         *
  +         * @return DTMStringPool reference to an instance of table.
  +         */
           DTMStringPool getAttributeNameTable() {
  -             return m_attributeNames;
  -     }
  +                return m_attributeNames;
  +        }
   
  -     /**
  -      * Set a reference pointer to the prefix name symbol table.
  -      *
  -      * @param poolRef DTMStringPool reference to an instance of table.
  -      */
  -     void setPrefixNameTable(DTMStringPool poolRef) {
  -             m_prefixNames = poolRef;
  -     }
  -
  -     /**
  -      * Get a reference pointer to the prefix name symbol table.
  -      *
  -      * @return DTMStringPool reference to an instance of table.
  -      */
  -     DTMStringPool getPrefixNameTable() {
  -             return m_prefixNames;
  -     }
  -
  -     /**
  -      * Set a reference pointer to the content-text repository
  -      *
  -      * @param bufferRef FastStringBuffer reference to an instance of
  -      * buffer
  -      */
  -     void setContentBuffer(FastStringBuffer buffer) {
  -             m_char = buffer;
  -     }
  -
  -     /**
  -      * Get a reference pointer to the content-text repository
  -      *
  -      * @return FastStringBuffer reference to an instance of buffer
  -      */
  -     FastStringBuffer getContentBuffer() {
  -             return m_char;
  -     }
  -
  -     // ========= Document Handler Functions =========
  -
  -     /**
  -      * Receive notification of the beginning of a dtm document.
  -      *
  -      * The DTMManager will invoke this method when the dtm is created.
  -      *
  -      * @param docHandle int the handle for the DTM document.
  -      */
  -     protected final void initDocument(int docHandle)
  -     {
  -             // save masked DTM document handle
  -             m_docHandle = docHandle;
  -             // Initialize the doc -- no parent, no next-sib
  -             nodes.writeSlot(0,DOCUMENT_NODE,-1,-1,0);
  -             // wait for the first startElement to create the doc root node
  -     }
  -
  -     /**
  -      * Receive hint of the end of a document.
  -      *
  -      * <p>The content handler will invoke this method only once, and it will
  -      * be the last method invoked during the parse.  The handler shall not
  -      * not invoke this method until it has either abandoned parsing
  -      * (because of an unrecoverable error) or reached the end of
  -      * input.</p>
  -      */
  -     public void documentEnd()
  -     {
  -
  -             // %TBD% may need to notice the last slot number and slot count 
to avoid
  -             // residule data from provious use of this DTM
  -     }
  -
  -     /**
  -      * Receive notification of the beginning of a document.
  -      *
  -      * <p>The SAX parser will invoke this method only once, before any
  -      * other methods in this interface.</p>
  -      */
  -     public void reset()
  -     {
  -
  -             // %TBD% reset slot 0 to indicate ChunkedIntArray reuse or wait 
for
  -             //       the next initDocument().
  -         m_docElement = NULL;         // reset nodeHandle to the root of the 
actual dtm doc content
  -     }
  -
  -     /**
  -      * Factory method; creates an Element node in this document.
  -      *
  -      * The node created will be chained according to its natural order of 
request
  -      * received.  %TBD% It can be rechained later via the optional DTM 
writable interface.
  -      *
  -      * <p>The XML content handler will invoke elementEnd() method after all
  -      * of the element's content are processed in order to give DTM the 
indication
  -      * to prepare and patch up parent and sibling node pointers.</p>
  -      *
  -      * <p>The following interface for createElement will use an index value 
corresponds
  -      * to the symbol entry in the DTMDStringPool based symbol tables.</p>
  -      *
  -      * @param nsIndex The namespace of the node
  -      * @param nameIndex The element name.
  -      * @see #endElement
  -      * @see org.xml.sax.Attributes
  -      * @return nodeHandle int of the element created
  -      */
  -     public int createElement(int nsIndex, int nameIndex, Attributes atts)
  -     {
  -             // do document root node creation here on the first element, 
create nodes for
  -             // this element and its attributes, store the element, 
namespace, and attritute
  -             // name indexes to the nodes array, keep track of the current 
node and parent
  -             // element used
  +        /**
  +         * Set a reference pointer to the prefix name symbol table.
  +         *
  +         * @param poolRef DTMStringPool reference to an instance of table.
  +         */
  +        void setPrefixNameTable(DTMStringPool poolRef) {
  +                m_prefixNames = poolRef;
  +        }
  +
  +        /**
  +         * Get a reference pointer to the prefix name symbol table.
  +         *
  +         * @return DTMStringPool reference to an instance of table.
  +         */
  +        DTMStringPool getPrefixNameTable() {
  +                return m_prefixNames;
  +        }
  +
  +        /**
  +         * Set a reference pointer to the content-text repository
  +         *
  +         * @param bufferRef FastStringBuffer reference to an instance of
  +         * buffer
  +         */
  +        void setContentBuffer(FastStringBuffer buffer) {
  +                m_char = buffer;
  +        }
  +
  +        /**
  +         * Get a reference pointer to the content-text repository
  +         *
  +         * @return FastStringBuffer reference to an instance of buffer
  +         */
  +        FastStringBuffer getContentBuffer() {
  +                return m_char;
  +        }
  +
  +        // ========= Document Handler Functions =========
  +
  +        /**
  +         * Receive notification of the beginning of a dtm document.
  +         *
  +         * The DTMManager will invoke this method when the dtm is created.
  +         *
  +         * @param docHandle int the handle for the DTM document.
  +         */
  +        protected final void initDocument(int docHandle)
  +        {
  +                // save masked DTM document handle
  +                m_docHandle = docHandle;
  +                // Initialize the doc -- no parent, no next-sib
  +                nodes.writeSlot(0,DOCUMENT_NODE,-1,-1,0);
  +                // wait for the first startElement to create the doc root 
node
  +        }
  +
  +        /**
  +         * Receive hint of the end of a document.
  +         *
  +         * <p>The content handler will invoke this method only once, and it 
will
  +         * be the last method invoked during the parse.  The handler shall 
not
  +         * not invoke this method until it has either abandoned parsing
  +         * (because of an unrecoverable error) or reached the end of
  +         * input.</p>
  +         */
  +        public void documentEnd()
  +        {
   
  +                // %TBD% may need to notice the last slot number and slot 
count to avoid
  +                // residule data from provious use of this DTM
  +        }
  +
  +        /**
  +         * Receive notification of the beginning of a document.
  +         *
  +         * <p>The SAX parser will invoke this method only once, before any
  +         * other methods in this interface.</p>
  +         */
  +        public void reset()
  +        {
  +
  +                // %TBD% reset slot 0 to indicate ChunkedIntArray reuse or 
wait for
  +                //       the next initDocument().
  +            m_docElement = NULL;      // reset nodeHandle to the root of the 
actual dtm doc content
  +        }
  +
  +        /**
  +         * Factory method; creates an Element node in this document.
  +         *
  +         * The node created will be chained according to its natural order 
of request
  +         * received.  %TBD% It can be rechained later via the optional DTM 
writable interface.
  +         *
  +         * <p>The XML content handler will invoke elementEnd() method after 
all
  +         * of the element's content are processed in order to give DTM the 
indication
  +         * to prepare and patch up parent and sibling node pointers.</p>
  +         *
  +         * <p>The following interface for createElement will use an index 
value corresponds
  +         * to the symbol entry in the DTMDStringPool based symbol tables.</p>
  +         *
  +         * @param nsIndex The namespace of the node
  +         * @param nameIndex The element name.
  +         * @see #endElement
  +         * @see org.xml.sax.Attributes
  +         * @return nodeHandle int of the element created
  +         */
  +        public int createElement(int nsIndex, int nameIndex, Attributes atts)
  +        {
  +                // do document root node creation here on the first element, 
create nodes for
  +                // this element and its attributes, store the element, 
namespace, and attritute
  +                // name indexes to the nodes array, keep track of the 
current node and parent
  +                // element used
  +
           // W0  High:  Namespace  Low:  Node Type
  -             int w0 = (nsIndex << 16) | ELEMENT_NODE;
  -             // W1: Parent
  -             int w1 = currentParent;
  -             // W2: Next  (initialized as 0)
  -             int w2 = 0;
  -             // W3: Tagname
  -             int w3 = nameIndex;
  -             int ourslot = nodes.appendSlot(w0, w1, w2, w3);
  -             currentParent = ourslot;
  -             previousSibling = 0;
  -             createAttributes(atts);
  +                int w0 = (nsIndex << 16) | ELEMENT_NODE;
  +                // W1: Parent
  +                int w1 = currentParent;
  +                // W2: Next  (initialized as 0)
  +                int w2 = 0;
  +                // W3: Tagname
  +                int w3 = nameIndex;
  +                int ourslot = nodes.appendSlot(w0, w1, w2, w3);
  +                currentParent = ourslot;
  +                previousSibling = 0;
  +                createAttributes(atts);
   
  -         // set the root element pointer when creating the first element node
  -         if (m_docElement == NULL)
  +            // set the root element pointer when creating the first element 
node
  +            if (m_docElement == NULL)
               m_docElement = ourslot;
   
  -         return ourslot;
  -     }
  +            return ourslot;
  +        }
   
  -     /**
  -      *
  -      */
  -     public void createAttributes(Attributes atts) {
  -             int atLength = (null == atts) ? 0 : atts.getLength(), ourslot = 
NULL;
  -             for (int i=0; i < atLength; i++) {
  -                     String qname = atts.getQName(i);
  -                     int colonpos = qname.indexOf(":");
  -                     String attName = qname.substring(colonpos+1);
  -                     int w0 = 0;
  -                     if (colonpos > 0) {
  -                             String prefix = qname.substring(0, colonpos);
  -                             if (prefix.equals("xml")) {
  -                                     //w0 = ATTRIBUTE_NODE |
  -                                     //      
(org.apache.xalan.templates.Constants.S_XMLNAMESPACEURI << 16);
  -                             } else {
  -                                     //w0 = ATTRIBUTE_NODE |
  -                             }
  -                     } else {
  -                             w0 = ATTRIBUTE_NODE;
  -                     }
  -                     // W1:  Parent
  -                     int w1 = currentParent;
  -                     // W2:  Next (not yet resolved)
  -                     int w2 = 0;
  -                     // W3:  Tag name
  -                     int w3 = m_attributeNames.stringToIndex(attName);
  -                     // Add node
  -                     ourslot = appendNode(w0, w1, w2, w3);
  -                     previousSibling = ourslot;      // Should attributes be 
previous siblings
  -
  -
  -                     // W0: Node Type
  -                     w0 = TEXT_NODE;
  -                     // W1: Parent
  -                     w1 = ourslot;
  -                     // W2: Start Position within buffer
  -                     w2 = m_char.length();
  -                     m_char.append(atts.getValue(i));
  -                     // W3: Length
  -                     w3 = m_char.length() - w2;
  -                     ourslot = appendNode(w0, w1, w2, w3);
  -                     previousSibling = ourslot;
  -                     // Attrs are Parents
  -                     previousSiblingWasParent = true;
  -             }
  -     }
  +        /**
  +         *
  +         */
  +        public void createAttributes(Attributes atts) {
  +                int atLength = (null == atts) ? 0 : atts.getLength(), 
ourslot = NULL;
  +                for (int i=0; i < atLength; i++) {
  +                        String qname = atts.getQName(i);
  +                        int colonpos = qname.indexOf(":");
  +                        String attName = qname.substring(colonpos+1);
  +                        int w0 = 0;
  +                        if (colonpos > 0) {
  +                                String prefix = qname.substring(0, colonpos);
  +                                if (prefix.equals("xml")) {
  +                                        //w0 = ATTRIBUTE_NODE |
  +                                        //   
(org.apache.xalan.templates.Constants.S_XMLNAMESPACEURI << 16);
  +                                } else {
  +                                        //w0 = ATTRIBUTE_NODE |
  +                                }
  +                        } else {
  +                                w0 = ATTRIBUTE_NODE;
  +                        }
  +                        // W1:  Parent
  +                        int w1 = currentParent;
  +                        // W2:  Next (not yet resolved)
  +                        int w2 = 0;
  +                        // W3:  Tag name
  +                        int w3 = m_attributeNames.stringToIndex(attName);
  +                        // Add node
  +                        ourslot = appendNode(w0, w1, w2, w3);
  +                        previousSibling = ourslot;   // Should attributes be 
previous siblings
  +
  +
  +                        // W0: Node Type
  +                        w0 = TEXT_NODE;
  +                        // W1: Parent
  +                        w1 = ourslot;
  +                        // W2: Start Position within buffer
  +                        w2 = m_char.length();
  +                        m_char.append(atts.getValue(i));
  +                        // W3: Length
  +                        w3 = m_char.length() - w2;
  +                        ourslot = appendNode(w0, w1, w2, w3);
  +                        previousSibling = ourslot;
  +                        // Attrs are Parents
  +                        previousSiblingWasParent = true;
  +                }
  +        }
   
       // Factory method to create an Element node not associated with a given 
name space
       // using String value parameters passed in from a content handler or 
application
  -     /**
  -      * Factory method; creates an Element node not associated with a given 
name space in this document.
  -      *
  -      * The node created will be chained according to its natural order of 
request
  -      * received.  %TBD% It can be rechained later via the optional DTM 
writable interface.
  -      *
  -      * <p>The XML content handler or application will invoke elementEnd() 
method after all
  -      * of the element's content are processed in order to give DTM the 
indication
  -      * to prepare and patch up parent and sibling node pointers.</p>
  -      *
  -      * <p>The following parameters for createElement contains raw string 
values for name
  -      * symbols used in an Element node.</p>
  -      *
  -      * @param name String the element name, including the prefix if any.
  -      * @param atts The attributes attached to the element, if any.
  -      * @see #endElement
  -      * @see org.xml.sax.Attributes
  -      */
  -     public int createElement(String name, Attributes atts)
  -     {
  +        /**
  +         * Factory method; creates an Element node not associated with a 
given name space in this document.
  +         *
  +         * The node created will be chained according to its natural order 
of request
  +         * received.  %TBD% It can be rechained later via the optional DTM 
writable interface.
  +         *
  +         * <p>The XML content handler or application will invoke 
elementEnd() method after all
  +         * of the element's content are processed in order to give DTM the 
indication
  +         * to prepare and patch up parent and sibling node pointers.</p>
  +         *
  +         * <p>The following parameters for createElement contains raw string 
values for name
  +         * symbols used in an Element node.</p>
  +         *
  +         * @param name String the element name, including the prefix if any.
  +         * @param atts The attributes attached to the element, if any.
  +         * @see #endElement
  +         * @see org.xml.sax.Attributes
  +         */
  +        public int createElement(String name, Attributes atts)
  +        {
           // This method wraps around the index valued interface of the 
createElement interface.
           // The raw string values are stored into the current DTM name symbol 
tables.  The method
           // method will then use the index values returned to invoke the 
other createElement()
  -         // onverted to index values modified to match a
  -         // method.
  -         int nsIndex = NULL;
  -         int nameIndex = m_elementNames.stringToIndex(name);
  -         // note - there should be no prefix separator in the name because 
it is not associated
  -         // with a name space
  +            // onverted to index values modified to match a
  +            // method.
  +            int nsIndex = NULL;
  +            int nameIndex = m_elementNames.stringToIndex(name);
  +            // note - there should be no prefix separator in the name 
because it is not associated
  +            // with a name space
   
  -                     return createElement(nsIndex, nameIndex, atts);
  -     }
  +                        return createElement(nsIndex, nameIndex, atts);
  +        }
   
       // Factory method to create an Element node associated with a given name 
space
       // using String value parameters passed in from a content handler or 
application
  -     /**
  -      * Factory method; creates an Element node associated with a given name 
space in this document.
  -      *
  -      * The node created will be chained according to its natural order of 
request
  -      * received.  %TBD% It can be rechained later via the optional DTM 
writable interface.
  -      *
  -      * <p>The XML content handler or application will invoke elementEnd() 
method after all
  -      * of the element's content are processed in order to give DTM the 
indication
  -      * to prepare and patch up parent and sibling node pointers.</p>
  -      *
  -      * <p>The following parameters for createElementNS contains raw string 
values for name
  -      * symbols used in an Element node.</p>
  -      *
  -      * @param ns String the namespace of the node
  -      * @param name String the element name, including the prefix if any.
  -      * @param atts The attributes attached to the element, if any.
  -      * @see #endElement
  -      * @see org.xml.sax.Attributes
  -      */
  -     public int createElementNS(String ns, String name, Attributes atts)
  -     {
  +        /**
  +         * Factory method; creates an Element node associated with a given 
name space in this document.
  +         *
  +         * The node created will be chained according to its natural order 
of request
  +         * received.  %TBD% It can be rechained later via the optional DTM 
writable interface.
  +         *
  +         * <p>The XML content handler or application will invoke 
elementEnd() method after all
  +         * of the element's content are processed in order to give DTM the 
indication
  +         * to prepare and patch up parent and sibling node pointers.</p>
  +         *
  +         * <p>The following parameters for createElementNS contains raw 
string values for name
  +         * symbols used in an Element node.</p>
  +         *
  +         * @param ns String the namespace of the node
  +         * @param name String the element name, including the prefix if any.
  +         * @param atts The attributes attached to the element, if any.
  +         * @see #endElement
  +         * @see org.xml.sax.Attributes
  +         */
  +        public int createElementNS(String ns, String name, Attributes atts)
  +        {
           // This method wraps around the index valued interface of the 
createElement interface.
           // The raw string values are stored into the current DTM name symbol 
tables.  The method
           // method will then use the index values returned to invoke the 
other createElement()
  -         // onverted to index values modified to match a
  -         // method.
  -         int nsIndex = m_nsNames.stringToIndex(ns);
  -         int nameIndex = m_elementNames.stringToIndex(name);
  -         // The prefixIndex is not needed by the indexed interface of the 
createElement method
  -         int prefixSep = name.indexOf(":");
  -         int prefixIndex = m_prefixNames.stringToIndex(name.substring(0, 
prefixSep));
  -                     return createElement(nsIndex, nameIndex, atts);
  -     }
  -
  -     /**
  -      * Receive an indication for the end of an element.
  -      *
  -      * <p>The XML content handler will invoke this method at the end of 
every
  -      * element in the XML document to give hint its time to pop up the 
current
  -      * element and parent and patch up parent and sibling pointers if 
necessary
  -      *
  -      * <p>%tbd% The following interface may need to be modified to match a
  -      * coordinated access to the DTMDStringPool based symbol tables.</p>
  -              *
  -      * @param ns the namespace of the element
  -      * @param localName The local part of the qualified name of the element
  -      * @param name The element name
  -      */
  -     public void elementEnd(String ns, String name)
  -     {
  -             // pop up the stacks
  -
  -             //
  -             if ((previousSibling != 0) && previousSiblingWasParent)
  -                     nodes.writeEntry(previousSibling, 2, -1);
  -
  -             // Pop parentage
  -             int thisElement = currentParent;
  -             nodes.readSlot(currentParent, gotslot);
  -             currentParent = gotslot[1];
  -
  -             // The element just being finished will be
  -             // the previous sibling for the next operation
  -             previousSibling = thisElement;
  -             previousSiblingWasParent = true;
  -
  -             // Pop a level of namespace table
  -             // namespaceTable.removeLastElem();
  -     }
  -
  -     /**
  -      * Factory method; creates a Text node in this document.
  -      *
  -      * The node created will be chained according to its natural order of 
request
  -      * received.  %TBD% It can be rechained later via the optional DTM 
writable interface.
  -      *
  -      * @param text String The characters text string from the XML document.
  -      * @return int DTM node-number of the text node created
  -      */
  -     public int createTextNode(String text)
  -       throws DTMException
  -     {
  -             // wraps around the index value based createTextNode method
  -         return createTextNode(text.toCharArray(), 0, text.length());
  -     }
  -
  -     /**
  -      * Factory method; creates a Text node in this document.
  -      *
  -      * The node created will be chained according to its natural order of 
request
  -      * received.  %TBD% It can be rechained later via the optional DTM 
writable interface.
  -      *
  -      * @param ch The characters from the XML document.
  -      * @param start The start position in the array.
  -      * @param length The number of characters to read from the array.
  -      */
  -     public int createTextNode(char ch[], int start, int length)
  -     throws DTMException
  -     {
  -             m_char.append(ch, start, length);               // store the 
chunk to the text/comment string table
  -
  -             // create a Text Node
  -             // %TBD% may be possible to combine with appendNode()to replace 
the next chunk of code
  -             int w0 = TEXT_NODE;
  -             // W1: Parent
  -             int w1 = currentParent;
  -             // W2: Start position within m_char
  -             int w2 = charStringStart;
  -             // W3: Length of the full string
  -             int w3 = length;
  -             int ourslot = appendNode(w0, w1, w2, w3);
  -             previousSibling = ourslot;
  -
  -             charStringStart=m_char.length();
  -             charStringLength = 0;
  -             return ourslot;
  -     }
  -
  -     /**
  -      * Factory method; creates a Comment node in this document.
  -      *
  -      * The node created will be chained according to its natural order of 
request
  -      * received.  %TBD% It can be rechained later via the optional DTM 
writable interface.
  -      *
  -      * @param text String The characters text string from the XML document.
  -      * @return int DTM node-number of the text node created
  -      */
  -     public int createComment(String text)
  -       throws DTMException
  -     {
  -             // wraps around the index value based createTextNode method
  -         return createComment(text.toCharArray(), 0, text.length());
  -     }
  -
  -     /**
  -      * Factory method; creates a Comment node in this document.
  -      *
  -      * The node created will be chained according to its natural order of 
request
  -      * received.  %TBD% It can be rechained later via the optional DTM 
writable interface.
  -      *
  -      * @param ch An array holding the characters in the comment.
  -      * @param start The starting position in the array.
  -      * @param length The number of characters to use from the array.
  -      * @see DTMException
  -      */
  -     public int createComment(char ch[], int start, int length)
  -     throws DTMException
  -     {
  -             m_char.append(ch, start, length);               // store the 
comment string to the text/comment string table
  -
  -             // create a Comment Node
  -             // %TBD% may be possible to combine with appendNode()to replace 
the next chunk of code
  -             int w0 = COMMENT_NODE;
  -             // W1: Parent
  -             int w1 = currentParent;
  -             // W2: Start position within m_char
  -             int w2 = charStringStart;
  -             // W3: Length of the full string
  -             int w3 = length;
  -             int ourslot = appendNode(w0, w1, w2, w3);
  -             previousSibling = ourslot;
  -
  -             charStringStart=m_char.length();
  -             charStringLength = 0;
  -             return ourslot;
  -     }
  -
  -     // Counters to keep track of the current text string being accumulated 
with respect
  -     // to the text/comment string table: charStringStart should point to 
the starting
  -     // offset of the string in the table and charStringLength the 
acccumulated length when
  -     // appendAccumulatedText starts, and reset to the end of the table and 
0 at the end
  -     // of appendAccumulatedText for the next set of characters receives
  -     int charStringStart=0,charStringLength=0;
  -
  -     // ========= 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) {
  -             return(getFirstChild(nodeHandle) != NULL);
  -     }
  -
  -     /**
  -      * 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) {
  -             // ###shs worry about tracing/debug later
  -             // Read node into variable
  -             nodes.readSlot(nodeHandle, gotslot);
  -
  -             // type is the last half of first slot
  -             short type = (short) (gotslot[0] & 0xFFFF);
  -
  -             // Check to see if Element or Document node
  -             if ((type == ELEMENT_NODE) || (type == DOCUMENT_NODE) ||
  -                             (type == ENTITY_REFERENCE_NODE)) {
  -                     // In case when Document root is given
  -                     if (nodeHandle == 0) nodeHandle = 1;
  -                     // If there is a kid node it is in the first slot after 
our element node
  -                     // after skipping over attributes);
  -                     int kid = (nodeHandle == 0) ? 2 : nodeHandle+1;
  -                     nodes.readSlot(kid, gotslot);
  -                     // skip attributes, they take up 2 slots in table
  -                     while (ATTRIBUTE_NODE == (gotslot[0] & 0xFFFF)) {
  -                             kid += 2;
  -                             nodes.readSlot(kid, gotslot);
  -                     }
  -                     // If parent slot matches given parent, return kid
  -                     if (gotslot[1] == nodeHandle)   return kid;
  -             }
  -             // No child found
  -             return NULL;
  -     }
  -
  -     /**
  -     * 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) {
  -             // ###shs put trace/debug later
  -             // do not need to test node type since getFirstChild does that
  -             int lastChild = NULL;
  -             for (int nextkid = getFirstChild(nodeHandle); nextkid != NULL;
  -                             nextkid = getNextSibling(nextkid)) {
  -                     lastChild = nextkid;
  -             }
  -             return lastChild;
  -     }
  -
  -     /**
  -      * Retrieves an attribute node by by qualified name and namespace URI.
  -      *
  -      * @param node Handle of the node upon which to look up this attribute.
  -      * @param namespaceURI The namespace URI of the attribute to
  -      *   retrieve, or null.
  -      * @param name The local name of the attribute to
  -      *   retrieve.
  -      * @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 node,String namespaceURI, String name) {
  -             //m_nsNames.stringToIndex(namespaceURI);
  -             return -1;
  -     }
  -
  -     /**
  -      * 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) {
  -             // Should we check if handle is element (do we want sanity 
checks?)
  -             nodes.readSlot(nodeHandle, gotslot);
  -             if (ELEMENT_NODE != (gotslot[0] & 0xFFFF)) {
  -                     return NULL;
  -             }
  -             // First Attribute should be next position in table
  -             nodeHandle++;
  -             nodes.readSlot(nodeHandle, gotslot);
  -             if (ATTRIBUTE_NODE == (gotslot[0] & 0xFFFF)) {
  -                     return nodeHandle;
  -             }
  -             return NULL;
  -     }
  -
  -     /**
  -      * 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) {
  -
  -             return NULL;
  -     }
  -
  -     /**
  -      * Given a node handle, advance to its next sibling.
  -      * %TBD% Remove - 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) {
  -             // Document root has no next sibling
  -             if (nodeHandle == 0)
  -                     return NULL;
  -
  -             short type = (short) (nodes.readEntry(nodeHandle, 0) & 0xFFFF);
  -             if ((type == ELEMENT_NODE) || (type == ATTRIBUTE_NODE) ||
  -                             (type == ENTITY_REFERENCE_NODE)) {
  -                     int nextSib = nodes.readEntry(nodeHandle, 2);
  -                     if (nextSib != 0)
  -                             return nextSib;
  -                     // ###shs must cycle if nextSib is 0...
  -             }
  -             // Next Sibling is in the next position if it shares the same 
parent
  -             int thisParent = nodes.readEntry(nodeHandle, 1);
  -             if (nodes.readEntry(nodeHandle+1, 1) == thisParent)
  -                     return nodeHandle+1;
  -
  -             return NULL;
  -     }
  -
  -     /**
  -      * 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) {
  -             // Document root has no previous sibling
  -             if (nodeHandle <= 1)
  -                     return NULL;
  -
  -             int parent = nodes.readEntry(nodeHandle, 1);
  -             int kid = NULL;
  -             for (int nextkid = getFirstChild(parent); nextkid != nodeHandle;
  -                             nextkid = getNextSibling(nextkid)) {
  -                     kid = nextkid;
  -             }
  -             return kid;
  -     }
  -
  -     /**
  -      * 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) {
  -             short type = (short) (nodes.readEntry(nodeHandle, 0) & 0xFFFF);
  -             if (type == ELEMENT_NODE) {
  -                     return getFirstAttribute(nodeHandle);
  -             } else if (type == ATTRIBUTE_NODE) {
  -                     if (ATTRIBUTE_NODE == (nodes.readEntry(nodeHandle+2, 0) 
& 0xFFFF))
  -                             return nodeHandle+2;
  -             }
  -             return NULL;
  -     }
  -
  -     /**
  -      * Given a namespace handle, advance to the next namespace.
  -      *
  -      * @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 namespaceHandle, boolean inScope) {
  -             // ###shs need to work on namespace
  -             return 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
  -      * @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) {
  -             // Document root - no next-sib
  -             if (nodeHandle == 0)
  -                     return NULL;
  -             while (!m_isError) {
  -                     // Document done and node out of bounds
  -                     if (done && (nodeHandle > nodes.slotsUsed()))
  -                             return NULL;
  -                     if (nodeHandle > subtreeRootHandle) {
  -                             nodes.readSlot(nodeHandle+1, gotslot);
  -                             if (gotslot[2] != 0) {
  -                                     short type = (short) (gotslot[0] & 
0xFFFF);
  -                                     if (type == ATTRIBUTE_NODE) {
  -                                             nodeHandle +=2;
  -                                     } else {
  -                                             int nextParentPos = gotslot[1];
  -                                             if (nextParentPos >= 
subtreeRootHandle)
  -                                                     return nodeHandle+1;
  -                                             else
  -                                                     return NULL;
  -                                     }
  -                             } else if (!done) {
  -                                     // Add wait logic here
  -                             } else
  -                                     return NULL;
  -                     } else {
  -                             nodeHandle++;
  -                     }
  -             }
  -             // Probably should throw error here like orig. instead of 
returning
  -             return NULL;
  -     }
  -
  -     /**
  -      * 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) 
{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) 
{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) {
  -             // Should check to see within range?
  -
  -             // Document Root should not have to be handled differently
  -             return nodes.readEntry(nodeHandle, 1);
  -     }
  -
  -     /**
  -             * 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() {return m_docHandle;}
  -
  -     /**
  -      * 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) {return -1;}
  -
  -
  -     /**
  -      * Get the string-value of a node as a String object
  -      * (see http://www.w3.org/TR/xpath#data-model
  -      * for the definition of a node's string-value).
  -      *
  -      * @param nodeHandle The node ID.
  -      *
  -      * @return A string object that represents the string-value of the 
given node.
  -      */
  -     public String getStringValue(int nodeHandle) {
  -             return null;
  -     }
  -
  -     /**
  -      * 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)
  -     {
  -             /*nodes.readSlot(position, gotslot);
  -             int nodetype=gotslot[0] & 0xFF;  // ###zaj use mask to get node 
type
  -             String value=null;
  -
  -             switch (nodetype) {              // ###zaj todo - document 
nodetypes
  -             case TEXT_NODE:
  -             case CDATA_SECTION_NODE:
  -                     if ((gotslot[0] & TEXT_DTM_POOL) != 0) {
  -                             // ###zaj Will there be any need for flagged 
text. (To check whether
  -                             //        value of this node lives in DTM's 
pool or parser's)
  -                             
value=(String)(localStringPool.elementAt(gotslot[2]));
  -                     } else if (gotslot[3]>0) {
  -                             // ###zaj This code path can possibly be 
simplified.  Have some
  -                             //        questions for YST first.
  -                             //        Will W3 retain the same meaning in 
all cases.
  -                             //        Will we be able to hide chunking so 
that all string
  -                             //        values can be viewed as concatenated.
  -                             // may be able to simplify by keeping chunk 
count in sb
  -                             // This was a multi-charChunk node. Its value 
is the concatenation
  -                             // of those chunks. For efficient future 
access, we will now convert
  -                             // this into a TEXT_DTM_POOL node
  -
  -                             // First, concatenate the chunks to obtain the 
value
  -                             int chunk=gotslot[2],stop=gotslot[3];
  -                             StringBuffer sb=new 
StringBuffer(intToString(charChunks[chunk++]));
  -                             while (chunk<stop)
  -                                     
sb.append(intToString(charChunks[chunk++]));
  -                             value=sb.toString();
  -
  -                             // Add the normalized string to our local pool.
  -                             // ###zaj Is it worth suppressing duplicates? 
if so we can add the code:
  -                             // int 
localStringNumber=localStringPool.indexOf(value);
  -                             // if(-1 == localStringNumber) // Not found
  -                             // {
  -                             localStringPool.addElement(value);
  -                             int localStringNumber=localStringPool.size();
  -                             // }
  -
  -                             // Now back-patch the node. We can get away 
with not protecting
  -                             // this since we assert that DTM's read access 
is single-threaded,
  -                             // and hence nobody else is accessing this node 
right now.
  -                             gotslot[0] |= TEXT_DTM_POOL;
  -                             gotslot[2] = localStringNumber-1;
  -                             
nodes.writeSlot(position,gotslot[0],gotslot[1],gotslot[2],gotslot[3]);
  -                     } else {
  -                             // Single charChunk. Read the value direct from 
the parser's pool.
  -                             value=intToString(gotslot[2]);
  -                     }
  -                     break;
  -             case PROCESSING_INSTRUCTION_NODE:
  -             case COMMENT_NODE:
  -                     value=intToString(gotslot[2]);
  -                     break;
  -             case ATTRIBUTE_NODE:    // Value is in kid(s)
  -             case ELEMENT_NODE:
  -             case ENTITY_REFERENCE_NODE:
  -             default:
  -                     break;
  -             }
  -             return value; */
  -             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) {return new char[0];}
  -
  -     /**
  -      * 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) {return 0;}
  -
  -     /**
  -      * 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.
  -      *
  -      * @return the expanded-name id of the node.
  -      */
  -     public int getExpandedNameID(String namespace, String localName) 
{return 0;}
  -
  -     /**
  -      * 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) 
{return null;}
  -
  -     /**
  -      * 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) 
{return null;}
  -
  -     /**
  -      * Given a node handle, return its DOM-style node name. This will
  -      * include names such as #text or #document.
  -      *
  -      * @param nodeHandle the id of the node.
  -      * @return String Name of this node, which may be an empty string.
  -      * %REVIEW% Document when empty string is possible...
  -      */
  -     public String getNodeName(int nodeHandle) {return null;}
  -
  -     /**
  -      * Given a node handle, return the XPath node name.  This should be
  -      * the name as described by the XPath data model, NOT the DOM-style
  -      * name.
  -      *
  -      * @param nodeHandle the id of the node.
  -      * @return String Name of this node.
  -      */
  -     public String getNodeNameX(int nodeHandle) {return null;}
  -
  -     /**
  -      * Given a node handle, return its DOM-style localname.
  -      * (As defined in Namespaces, this is the portion of the name after any
  -      * colon character)
  -      *
  -      * @param nodeHandle the id of the node.
  -      * @return String Local name of this node.
  -      */
  -     public String getLocalName(int nodeHandle) {return null;}
  -
  -     /**
  -      * Given a namespace handle, return the prefix that the namespace decl 
is
  -      * mapping.
  -      * Given a node handle, return the prefix used to map to the namespace.
  -      *
  -      * <p> %REVIEW% Are you sure you want "" for no prefix?  </p>
  -      *
  -      * @param nodeHandle the id of the node.
  -      * @return String prefix of this node's name, or "" if no explicit
  -      * namespace prefix was given.
  -      */
  -     public String getPrefix(int nodeHandle) {return null;}
  -
  -     /**
  -      * Given a node handle, return its DOM-style namespace URI
  -      * (As defined in Namespaces, this is the declared URI which this node's
  -      * prefix -- or default in lieu thereof -- was mapped to.)
  -      *
  -      * @param nodeHandle the id of the node.
  -      * @return String URI value of this node's namespace, or null if no
  -      * namespace was resolved.
  -      */
  -     public String getNamespaceURI(int nodeHandle) {return null;}
  -
  -     /**
  -      * Given a node handle, return its node value. This is mostly
  -      * as defined by the DOM, but may ignore some conveniences.
  -      * <p>
  -      *
  -      * @param nodeHandle The node id.
  -      * @return String Value of this node, or null if not
  -      * meaningful for this node type.
  -      */
  -     public String getNodeValue(int nodeHandle) {return null;}
  -
  -     /**
  -      * 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) {return 0;}
  -
  -     /**
  -      * <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) {return 0;}
  -
  -     // ============== 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>.
  -      * @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) {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) {return null;}
  -
  -     /**
  -      * 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) {return null;}
  -
  -     /**
  -      * 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) {return null;}
  -
  -     /**
  -      * 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
  -      *
  -      * @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() {return false;}
  -
  -     /**
  -      *   A document type declaration information item has the following 
properties:
  -      *
  -      *     1. [system identifier] The system identifier of the external 
subset, if
  -      *        it exists. Otherwise this property has no value.
  -      *
  -      * @return the system identifier String object, or null if there is 
none.
  -      */
  -     public String getDocumentTypeDeclarationSystemIdentifier() {return 
null;}
  -
  -     /**
  -      * Return the public identifier of the external subset,
  -      * normalized as described in 4.2.2 External Entities [XML]. If there is
  -      * no external subset or if it has no public identifier, this property
  -      * has no value.
  -      *
  -      * @param the document type declaration handle
  -      *
  -      * @return the public identifier String object, or null if there is 
none.
  -      */
  -     public String getDocumentTypeDeclarationPublicIdentifier()
  +            // onverted to index values modified to match a
  +            // method.
  +            int nsIndex = m_nsNames.stringToIndex(ns);
  +            int nameIndex = m_elementNames.stringToIndex(name);
  +            // The prefixIndex is not needed by the indexed interface of the 
createElement method
  +            int prefixSep = name.indexOf(":");
  +            int prefixIndex = m_prefixNames.stringToIndex(name.substring(0, 
prefixSep));
  +                        return createElement(nsIndex, nameIndex, atts);
  +        }
  +
  +        /**
  +         * Receive an indication for the end of an element.
  +         *
  +         * <p>The XML content handler will invoke this method at the end of 
every
  +         * element in the XML document to give hint its time to pop up the 
current
  +         * element and parent and patch up parent and sibling pointers if 
necessary
  +         *
  +         * <p>%tbd% The following interface may need to be modified to match 
a
  +         * coordinated access to the DTMDStringPool based symbol tables.</p>
  +                 *
  +         * @param ns the namespace of the element
  +         * @param localName The local part of the qualified name of the 
element
  +         * @param name The element name
  +         */
  +        public void elementEnd(String ns, String name)
  +        {
  +                // pop up the stacks
  +
  +                //
  +                if ((previousSibling != 0) && previousSiblingWasParent)
  +                        nodes.writeEntry(previousSibling, 2, -1);
  +
  +                // Pop parentage
  +                int thisElement = currentParent;
  +                nodes.readSlot(currentParent, gotslot);
  +                currentParent = gotslot[1];
  +
  +                // The element just being finished will be
  +                // the previous sibling for the next operation
  +                previousSibling = thisElement;
  +                previousSiblingWasParent = true;
  +
  +                // Pop a level of namespace table
  +                // namespaceTable.removeLastElem();
  +        }
  +
  +        /**
  +         * Factory method; creates a Text node in this document.
  +         *
  +         * The node created will be chained according to its natural order 
of request
  +         * received.  %TBD% It can be rechained later via the optional DTM 
writable interface.
  +         *
  +         * @param text String The characters text string from the XML 
document.
  +         * @return int DTM node-number of the text node created
  +         */
  +        public int createTextNode(String text)
  +          throws DTMException
  +        {
  +                // wraps around the index value based createTextNode method
  +            return createTextNode(text.toCharArray(), 0, text.length());
  +        }
  +
  +        /**
  +         * Factory method; creates a Text node in this document.
  +         *
  +         * The node created will be chained according to its natural order 
of request
  +         * received.  %TBD% It can be rechained later via the optional DTM 
writable interface.
  +         *
  +         * @param ch The characters from the XML document.
  +         * @param start The start position in the array.
  +         * @param length The number of characters to read from the array.
  +         */
  +        public int createTextNode(char ch[], int start, int length)
  +        throws DTMException
  +        {
  +                m_char.append(ch, start, length);            // store the 
chunk to the text/comment string table
  +
  +                // create a Text Node
  +                // %TBD% may be possible to combine with appendNode()to 
replace the next chunk of code
  +                int w0 = TEXT_NODE;
  +                // W1: Parent
  +                int w1 = currentParent;
  +                // W2: Start position within m_char
  +                int w2 = charStringStart;
  +                // W3: Length of the full string
  +                int w3 = length;
  +                int ourslot = appendNode(w0, w1, w2, w3);
  +                previousSibling = ourslot;
  +
  +                charStringStart=m_char.length();
  +                charStringLength = 0;
  +                return ourslot;
  +        }
  +
  +        /**
  +         * Factory method; creates a Comment node in this document.
  +         *
  +         * The node created will be chained according to its natural order 
of request
  +         * received.  %TBD% It can be rechained later via the optional DTM 
writable interface.
  +         *
  +         * @param text String The characters text string from the XML 
document.
  +         * @return int DTM node-number of the text node created
  +         */
  +        public int createComment(String text)
  +          throws DTMException
  +        {
  +                // wraps around the index value based createTextNode method
  +            return createComment(text.toCharArray(), 0, text.length());
  +        }
  +
  +        /**
  +         * Factory method; creates a Comment node in this document.
  +         *
  +         * The node created will be chained according to its natural order 
of request
  +         * received.  %TBD% It can be rechained later via the optional DTM 
writable interface.
  +         *
  +         * @param ch An array holding the characters in the comment.
  +         * @param start The starting position in the array.
  +         * @param length The number of characters to use from the array.
  +         * @see DTMException
  +         */
  +        public int createComment(char ch[], int start, int length)
  +        throws DTMException
  +        {
  +                m_char.append(ch, start, length);            // store the 
comment string to the text/comment string table
  +
  +                // create a Comment Node
  +                // %TBD% may be possible to combine with appendNode()to 
replace the next chunk of code
  +                int w0 = COMMENT_NODE;
  +                // W1: Parent
  +                int w1 = currentParent;
  +                // W2: Start position within m_char
  +                int w2 = charStringStart;
  +                // W3: Length of the full string
  +                int w3 = length;
  +                int ourslot = appendNode(w0, w1, w2, w3);
  +                previousSibling = ourslot;
  +
  +                charStringStart=m_char.length();
  +                charStringLength = 0;
  +                return ourslot;
  +        }
  +
  +        // Counters to keep track of the current text string being 
accumulated with respect
  +        // to the text/comment string table: charStringStart should point to 
the starting
  +        // offset of the string in the table and charStringLength the 
acccumulated length when
  +        // appendAccumulatedText starts, and reset to the end of the table 
and 0 at the end
  +        // of appendAccumulatedText for the next set of characters receives
  +        int charStringStart=0,charStringLength=0;
  +
  +        // ========= 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) {
  +                return(getFirstChild(nodeHandle) != NULL);
  +        }
  +
  +        /**
  +         * 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) {
  +                // ###shs worry about tracing/debug later
  +                // Read node into variable
  +                nodes.readSlot(nodeHandle, gotslot);
  +
  +                // type is the last half of first slot
  +                short type = (short) (gotslot[0] & 0xFFFF);
  +
  +                // Check to see if Element or Document node
  +                if ((type == ELEMENT_NODE) || (type == DOCUMENT_NODE) ||
  +                                (type == ENTITY_REFERENCE_NODE)) {
  +                        // In case when Document root is given
  +                        if (nodeHandle == 0) nodeHandle = 1;
  +                        // If there is a kid node it is in the first slot 
after our element node
  +                        // after skipping over attributes);
  +                        int kid = (nodeHandle == 0) ? 2 : nodeHandle+1;
  +                        nodes.readSlot(kid, gotslot);
  +                        // skip attributes, they take up 2 slots in table
  +                        while (ATTRIBUTE_NODE == (gotslot[0] & 0xFFFF)) {
  +                                kid += 2;
  +                                nodes.readSlot(kid, gotslot);
  +                        }
  +                        // If parent slot matches given parent, return kid
  +                        if (gotslot[1] == nodeHandle)        return kid;
  +                }
  +                // No child found
  +                return NULL;
  +        }
  +
  +        /**
  +        * 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) {
  +                // ###shs put trace/debug later
  +                // do not need to test node type since getFirstChild does 
that
  +                int lastChild = NULL;
  +                for (int nextkid = getFirstChild(nodeHandle); nextkid != 
NULL;
  +                                nextkid = getNextSibling(nextkid)) {
  +                        lastChild = nextkid;
  +                }
  +                return lastChild;
  +        }
  +
  +        /**
  +         * Retrieves an attribute node by by qualified name and namespace 
URI.
  +         *
  +         * @param node Handle of the node upon which to look up this 
attribute.
  +         * @param namespaceURI The namespace URI of the attribute to
  +         *   retrieve, or null.
  +         * @param name The local name of the attribute to
  +         *   retrieve.
  +         * @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 node,String namespaceURI, String 
name) {
  +                //m_nsNames.stringToIndex(namespaceURI);
  +                return -1;
  +        }
  +
  +        /**
  +         * 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) {
  +                // Should we check if handle is element (do we want sanity 
checks?)
  +                nodes.readSlot(nodeHandle, gotslot);
  +                if (ELEMENT_NODE != (gotslot[0] & 0xFFFF)) {
  +                        return NULL;
  +                }
  +                // First Attribute should be next position in table
  +                nodeHandle++;
  +                nodes.readSlot(nodeHandle, gotslot);
  +                if (ATTRIBUTE_NODE == (gotslot[0] & 0xFFFF)) {
  +                        return nodeHandle;
  +                }
  +                return NULL;
  +        }
  +
  +        /**
  +         * 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) {
  +
  +                return NULL;
  +        }
  +
  +        /**
  +         * Given a node handle, advance to its next sibling.
  +         * %TBD% Remove - 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) {
  +                // Document root has no next sibling
  +                if (nodeHandle == 0)
  +                        return NULL;
  +
  +                short type = (short) (nodes.readEntry(nodeHandle, 0) & 
0xFFFF);
  +                if ((type == ELEMENT_NODE) || (type == ATTRIBUTE_NODE) ||
  +                                (type == ENTITY_REFERENCE_NODE)) {
  +                        int nextSib = nodes.readEntry(nodeHandle, 2);
  +                        if (nextSib != 0)
  +                                return nextSib;
  +                        // ###shs must cycle if nextSib is 0...
  +                }
  +                // Next Sibling is in the next position if it shares the 
same parent
  +                int thisParent = nodes.readEntry(nodeHandle, 1);
  +                if (nodes.readEntry(nodeHandle+1, 1) == thisParent)
  +                        return nodeHandle+1;
  +
  +                return NULL;
  +        }
  +
  +        /**
  +         * 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) {
  +                // Document root has no previous sibling
  +                if (nodeHandle <= 1)
  +                        return NULL;
  +
  +                int parent = nodes.readEntry(nodeHandle, 1);
  +                int kid = NULL;
  +                for (int nextkid = getFirstChild(parent); nextkid != 
nodeHandle;
  +                                nextkid = getNextSibling(nextkid)) {
  +                        kid = nextkid;
  +                }
  +                return kid;
  +        }
  +
  +        /**
  +         * 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) {
  +                short type = (short) (nodes.readEntry(nodeHandle, 0) & 
0xFFFF);
  +                if (type == ELEMENT_NODE) {
  +                        return getFirstAttribute(nodeHandle);
  +                } else if (type == ATTRIBUTE_NODE) {
  +                        if (ATTRIBUTE_NODE == (nodes.readEntry(nodeHandle+2, 
0) & 0xFFFF))
  +                                return nodeHandle+2;
  +                }
  +                return NULL;
  +        }
  +
  +        /**
  +         * Given a namespace handle, advance to the next namespace.
  +         *
  +         * @param baseHandle handle to original node from where the first 
child 
  +         * 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)
  +        {
  +                // ###shs need to work on namespace
  +                return 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
  +         * @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) {
  +                // Document root - no next-sib
  +                if (nodeHandle == 0)
  +                        return NULL;
  +                while (!m_isError) {
  +                        // Document done and node out of bounds
  +                        if (done && (nodeHandle > nodes.slotsUsed()))
  +                                return NULL;
  +                        if (nodeHandle > subtreeRootHandle) {
  +                                nodes.readSlot(nodeHandle+1, gotslot);
  +                                if (gotslot[2] != 0) {
  +                                        short type = (short) (gotslot[0] & 
0xFFFF);
  +                                        if (type == ATTRIBUTE_NODE) {
  +                                                nodeHandle +=2;
  +                                        } else {
  +                                                int nextParentPos = 
gotslot[1];
  +                                                if (nextParentPos >= 
subtreeRootHandle)
  +                                                        return nodeHandle+1;
  +                                                else
  +                                                        return NULL;
  +                                        }
  +                                } else if (!done) {
  +                                        // Add wait logic here
  +                                } else
  +                                        return NULL;
  +                        } else {
  +                                nodeHandle++;
  +                        }
  +                }
  +                // Probably should throw error here like orig. instead of 
returning
  +                return NULL;
  +        }
  +
  +        /**
  +         * 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) 
{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) 
{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) {
  +                // Should check to see within range?
  +
  +                // Document Root should not have to be handled differently
  +                return nodes.readEntry(nodeHandle, 1);
  +        }
  +
  +        /**
  +                * 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() {return m_docHandle;}
  +
  +        /**
  +         * 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) {return -1;}
  +
  +
  +        /**
  +         * Get the string-value of a node as a String object
  +         * (see http://www.w3.org/TR/xpath#data-model
  +         * for the definition of a node's string-value).
  +         *
  +         * @param nodeHandle The node ID.
  +         *
  +         * @return A string object that represents the string-value of the 
given node.
  +         */
  +        public String getStringValue(int nodeHandle) {
  +                return null;
  +        }
  +
  +        /**
  +         * 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)
  +        {
  +                /*nodes.readSlot(position, gotslot);
  +                int nodetype=gotslot[0] & 0xFF;       // ###zaj use mask to 
get node type
  +                String value=null;
  +
  +                switch (nodetype) {           // ###zaj todo - document 
nodetypes
  +                case TEXT_NODE:
  +                case CDATA_SECTION_NODE:
  +                        if ((gotslot[0] & TEXT_DTM_POOL) != 0) {
  +                                // ###zaj Will there be any need for flagged 
text. (To check whether
  +                                //        value of this node lives in DTM's 
pool or parser's)
  +                                
value=(String)(localStringPool.elementAt(gotslot[2]));
  +                        } else if (gotslot[3]>0) {
  +                                // ###zaj This code path can possibly be 
simplified.  Have some
  +                                //        questions for YST first.
  +                                //        Will W3 retain the same meaning in 
all cases.
  +                                //        Will we be able to hide chunking 
so that all string
  +                                //        values can be viewed as 
concatenated.
  +                                // may be able to simplify by keeping chunk 
count in sb
  +                                // This was a multi-charChunk node. Its 
value is the concatenation
  +                                // of those chunks. For efficient future 
access, we will now convert
  +                                // this into a TEXT_DTM_POOL node
  +
  +                                // First, concatenate the chunks to obtain 
the value
  +                                int chunk=gotslot[2],stop=gotslot[3];
  +                                StringBuffer sb=new 
StringBuffer(intToString(charChunks[chunk++]));
  +                                while (chunk<stop)
  +                                        
sb.append(intToString(charChunks[chunk++]));
  +                                value=sb.toString();
  +
  +                                // Add the normalized string to our local 
pool.
  +                                // ###zaj Is it worth suppressing 
duplicates? if so we can add the code:
  +                                // int 
localStringNumber=localStringPool.indexOf(value);
  +                                // if(-1 == localStringNumber) // Not found
  +                                // {
  +                                localStringPool.addElement(value);
  +                                int localStringNumber=localStringPool.size();
  +                                // }
  +
  +                                // Now back-patch the node. We can get away 
with not protecting
  +                                // this since we assert that DTM's read 
access is single-threaded,
  +                                // and hence nobody else is accessing this 
node right now.
  +                                gotslot[0] |= TEXT_DTM_POOL;
  +                                gotslot[2] = localStringNumber-1;
  +                                
nodes.writeSlot(position,gotslot[0],gotslot[1],gotslot[2],gotslot[3]);
  +                        } else {
  +                                // Single charChunk. Read the value direct 
from the parser's pool.
  +                                value=intToString(gotslot[2]);
  +                        }
  +                        break;
  +                case PROCESSING_INSTRUCTION_NODE:
  +                case COMMENT_NODE:
  +                        value=intToString(gotslot[2]);
  +                        break;
  +                case ATTRIBUTE_NODE: // Value is in kid(s)
  +                case ELEMENT_NODE:
  +                case ENTITY_REFERENCE_NODE:
  +                default:
  +                        break;
  +                }
  +                return value; */
  +                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) {return new char[0];}
  +
  +        /**
  +         * 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) {return 0;}
  +
  +        /**
  +         * 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.
  +         *
  +         * @return the expanded-name id of the node.
  +         */
  +        public int getExpandedNameID(String namespace, String localName, int 
type) {return 0;}
  +
  +        /**
  +         * 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) 
{return null;}
  +
  +        /**
  +         * 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) 
{return null;}
  +
  +        /**
  +         * Given a node handle, return its DOM-style node name. This will
  +         * include names such as #text or #document.
  +         *
  +         * @param nodeHandle the id of the node.
  +         * @return String Name of this node, which may be an empty string.
  +         * %REVIEW% Document when empty string is possible...
  +         */
  +        public String getNodeName(int nodeHandle) {return null;}
  +
  +        /**
  +         * Given a node handle, return the XPath node name.  This should be
  +         * the name as described by the XPath data model, NOT the DOM-style
  +         * name.
  +         *
  +         * @param nodeHandle the id of the node.
  +         * @return String Name of this node.
  +         */
  +        public String getNodeNameX(int nodeHandle) {return null;}
  +
  +        /**
  +         * Given a node handle, return its DOM-style localname.
  +         * (As defined in Namespaces, this is the portion of the name after 
any
  +         * colon character)
  +         *
  +         * @param nodeHandle the id of the node.
  +         * @return String Local name of this node.
  +         */
  +        public String getLocalName(int nodeHandle) {return null;}
  +
  +        /**
  +         * Given a namespace handle, return the prefix that the namespace 
decl is
  +         * mapping.
  +         * Given a node handle, return the prefix used to map to the 
namespace.
  +         *
  +         * <p> %REVIEW% Are you sure you want "" for no prefix?  </p>
  +         *
  +         * @param nodeHandle the id of the node.
  +         * @return String prefix of this node's name, or "" if no explicit
  +         * namespace prefix was given.
  +         */
  +        public String getPrefix(int nodeHandle) {return null;}
  +
  +        /**
  +         * Given a node handle, return its DOM-style namespace URI
  +         * (As defined in Namespaces, this is the declared URI which this 
node's
  +         * prefix -- or default in lieu thereof -- was mapped to.)
  +         *
  +         * @param nodeHandle the id of the node.
  +         * @return String URI value of this node's namespace, or null if no
  +         * namespace was resolved.
  +         */
  +        public String getNamespaceURI(int nodeHandle) {return null;}
  +
  +        /**
  +         * Given a node handle, return its node value. This is mostly
  +         * as defined by the DOM, but may ignore some conveniences.
  +         * <p>
  +         *
  +         * @param nodeHandle The node id.
  +         * @return String Value of this node, or null if not
  +         * meaningful for this node type.
  +         */
  +        public String getNodeValue(int nodeHandle) {return null;}
  +
  +        /**
  +         * 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) {return 0;}
  +
  +        /**
  +         * <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) {return 0;}
  +
  +        // ============== 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>.
  +         * @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) {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) {return null;}
  +
  +        /**
  +         * 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) {return 
null;}
  +
  +        /**
  +         * 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) {return null;}
  +
  +        /**
  +         * 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
  +         *
  +         * @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() {return false;}
  +
  +        /**
  +         *   A document type declaration information item has the following 
properties:
  +         *
  +         *     1. [system identifier] The system identifier of the external 
subset, if
  +         *        it exists. Otherwise this property has no value.
  +         *
  +         * @return the system identifier String object, or null if there is 
none.
  +         */
  +        public String getDocumentTypeDeclarationSystemIdentifier() {return 
null;}
  +
  +        /**
  +         * Return the public identifier of the external subset,
  +         * normalized as described in 4.2.2 External Entities [XML]. If 
there is
  +         * no external subset or if it has no public identifier, this 
property
  +         * has no value.
  +         *
  +         * @param the document type declaration handle
  +         *
  +         * @return the public identifier String object, or null if there is 
none.
  +         */
  +        public String getDocumentTypeDeclarationPublicIdentifier()
           {
  -       return null; // %TBD%
  -     }
  +          return null; // %TBD%
  +        }
   
  -     /**
  -      * Returns the <code>Element</code> whose <code>ID</code> is given by
  -      * <code>elementId</code>. If no such element exists, returns
  -      * <code>DTM.NULL</code>. Behavior is not defined if more than one 
element
  -      * has this <code>ID</code>. Attributes (including those
  -      * with the name "ID") are not of type ID unless so defined by 
DTD/Schema
  -      * information available to the DTM implementation.
  -      * Implementations that do not know whether attributes are of type ID or
  -      * not are expected to return <code>DTM.NULL</code>.
  -      *
  -      * <p>%REVIEW% Presumably IDs are still scoped to a single document,
  -      * and this operation searches only within a single document, right?
  -      * Wouldn't want collisions between DTMs in the same process.</p>
  -      *
  -      * @param elementId The unique <code>id</code> value for an element.
  -      * @return The handle of the matching element.
  -      */
  -     public int getElementById(String elementId) {return 0;}
  -
  -     /**
  -      * The getUnparsedEntityURI function returns the URI of the unparsed
  -      * entity with the specified name in the same document as the context
  -      * node (see [3.3 Unparsed Entities]). It returns the empty string if
  -      * there is no such entity.
  -      * <p>
  -      * XML processors may choose to use the System Identifier (if one
  -      * is provided) to resolve the entity, rather than the URI in the
  -      * Public Identifier. The details are dependent on the processor, and
  -      * we would have to support some form of plug-in resolver to handle
  -      * this properly. Currently, we simply return the System Identifier if
  -      * present, and hope that it a usable URI or that our caller can
  -      * map it to one.
  -      * TODO: Resolve Public Identifiers... or consider changing function 
name.
  -      * <p>
  -      * If we find a relative URI
  -      * reference, XML expects it to be resolved in terms of the base URI
  -      * of the document. The DOM doesn't do that for us, and it isn't
  -      * entirely clear whether that should be done here; currently that's
  -      * pushed up to a higher level of our application. (Note that DOM Level
  -      * 1 didn't store the document's base URI.)
  -      * TODO: Consider resolving Relative URIs.
  -      * <p>
  -      * (The DOM's statement that "An XML processor may choose to
  -      * completely expand entities before the structure model is passed
  -      * to the DOM" refers only to parsed entities, not unparsed, and hence
  -      * doesn't affect this function.)
  -      *
  -      * @param name A string containing the Entity Name of the unparsed
  -      * entity.
  -      *
  -      * @return String containing the URI of the Unparsed Entity, or an
  -      * empty string if no such entity exists.
  -      */
  -     public String getUnparsedEntityURI(String name) {return null;}
  -
  -
  -     // ============== 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>
  -      */
  -     public boolean supportsPreStripping() {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 .
  -      *
  -      * @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) {return 
false;}
  -
  -     /**
  -      *     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) 
{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 false;}
  -
  -     /**
  -      *     5. [specified] A flag indicating whether this attribute was 
actually
  -      *        specified in the start-tag of its element, or was defaulted 
from the
  -      *        DTD.
  -      *
  -      * @param the attribute handle
  -      *
  -      * NEEDSDOC @param attributeHandle
  -      * @return <code>true</code> if the attribute was specified;
  -      *         <code>false</code> if it was defaulted.
  -      */
  -     public boolean isAttributeSpecified(int attributeHandle) {return false;}
  -
  -     // ========== Direct SAX Dispatch, for optimization purposes ========
  -
  -     /**
  -      * Directly call the
  -      * characters method on the passed ContentHandler for the
  -      * string-value of the given node (see 
http://www.w3.org/TR/xpath#data-model
  -      * for the definition of a node's string-value). Multiple calls to the
  -      * ContentHandler's characters methods may well occur for a single call 
to
  -      * this method.
  -      *
  -      * @param nodeHandle The node ID.
  -      * @param ch A non-null reference to a ContentHandler.
  -      *
  -      * @throws org.xml.sax.SAXException
  -      */
  -     public void dispatchCharactersEvents(
  -                                                                             
                                                                        int 
nodeHandle, org.xml.sax.ContentHandler ch)
  -     throws org.xml.sax.SAXException {}
  -
  -     /**
  -      * Directly create SAX parser events from a subtree.
  -      *
  -      * @param nodeHandle The node ID.
  -      * @param ch A non-null reference to a ContentHandler.
  -      *
  -      * @throws org.xml.sax.SAXException
  -      */
  -
  -     public void dispatchToEvents(
  -                                                                             
                                        int nodeHandle, 
org.xml.sax.ContentHandler ch)
  -     throws org.xml.sax.SAXException {}
  -
  -     // ==== 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 reference to a string.
  -      */
  -     public void appendTextChild(String str) {}
  +        /**
  +         * Returns the <code>Element</code> whose <code>ID</code> is given by
  +         * <code>elementId</code>. If no such element exists, returns
  +         * <code>DTM.NULL</code>. Behavior is not defined if more than one 
element
  +         * has this <code>ID</code>. Attributes (including those
  +         * with the name "ID") are not of type ID unless so defined by 
DTD/Schema
  +         * information available to the DTM implementation.
  +         * Implementations that do not know whether attributes are of type 
ID or
  +         * not are expected to return <code>DTM.NULL</code>.
  +         *
  +         * <p>%REVIEW% Presumably IDs are still scoped to a single document,
  +         * and this operation searches only within a single document, right?
  +         * Wouldn't want collisions between DTMs in the same process.</p>
  +         *
  +         * @param elementId The unique <code>id</code> value for an element.
  +         * @return The handle of the matching element.
  +         */
  +        public int getElementById(String elementId) {return 0;}
  +
  +        /**
  +         * The getUnparsedEntityURI function returns the URI of the unparsed
  +         * entity with the specified name in the same document as the context
  +         * node (see [3.3 Unparsed Entities]). It returns the empty string if
  +         * there is no such entity.
  +         * <p>
  +         * XML processors may choose to use the System Identifier (if one
  +         * is provided) to resolve the entity, rather than the URI in the
  +         * Public Identifier. The details are dependent on the processor, and
  +         * we would have to support some form of plug-in resolver to handle
  +         * this properly. Currently, we simply return the System Identifier 
if
  +         * present, and hope that it a usable URI or that our caller can
  +         * map it to one.
  +         * TODO: Resolve Public Identifiers... or consider changing function 
name.
  +         * <p>
  +         * If we find a relative URI
  +         * reference, XML expects it to be resolved in terms of the base URI
  +         * of the document. The DOM doesn't do that for us, and it isn't
  +         * entirely clear whether that should be done here; currently that's
  +         * pushed up to a higher level of our application. (Note that DOM 
Level
  +         * 1 didn't store the document's base URI.)
  +         * TODO: Consider resolving Relative URIs.
  +         * <p>
  +         * (The DOM's statement that "An XML processor may choose to
  +         * completely expand entities before the structure model is passed
  +         * to the DOM" refers only to parsed entities, not unparsed, and 
hence
  +         * doesn't affect this function.)
  +         *
  +         * @param name A string containing the Entity Name of the unparsed
  +         * entity.
  +         *
  +         * @return String containing the URI of the Unparsed Entity, or an
  +         * empty string if no such entity exists.
  +         */
  +        public String getUnparsedEntityURI(String name) {return null;}
  +
  +
  +        // ============== 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>
  +         */
  +        public boolean supportsPreStripping() {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 .
  +         *
  +         * @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) {return 
false;}
  +
  +        /**
  +         *     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) 
{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 false;}
  +
  +        /**
  +         *     5. [specified] A flag indicating whether this attribute was 
actually
  +         *        specified in the start-tag of its element, or was 
defaulted from the
  +         *        DTD.
  +         *
  +         * @param the attribute handle
  +         *
  +         * NEEDSDOC @param attributeHandle
  +         * @return <code>true</code> if the attribute was specified;
  +         *         <code>false</code> if it was defaulted.
  +         */
  +        public boolean isAttributeSpecified(int attributeHandle) {return 
false;}
  +
  +        // ========== Direct SAX Dispatch, for optimization purposes ========
  +
  +        /**
  +         * Directly call the
  +         * characters method on the passed ContentHandler for the
  +         * string-value of the given node (see 
http://www.w3.org/TR/xpath#data-model
  +         * for the definition of a node's string-value). Multiple calls to 
the
  +         * ContentHandler's characters methods may well occur for a single 
call to
  +         * this method.
  +         *
  +         * @param nodeHandle The node ID.
  +         * @param ch A non-null reference to a ContentHandler.
  +         *
  +         * @throws org.xml.sax.SAXException
  +         */
  +        public void dispatchCharactersEvents(
  +                                                                             
                                                                           int 
nodeHandle, org.xml.sax.ContentHandler ch)
  +        throws org.xml.sax.SAXException {}
  +
  +        /**
  +         * Directly create SAX parser events from a subtree.
  +         *
  +         * @param nodeHandle The node ID.
  +         * @param ch A non-null reference to a ContentHandler.
  +         *
  +         * @throws org.xml.sax.SAXException
  +         */
  +
  +        public void dispatchToEvents(
  +                                                                             
                                           int nodeHandle, 
org.xml.sax.ContentHandler ch)
  +        throws org.xml.sax.SAXException {}
  +
  +        // ==== 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 reference to a string.
  +         */
  +        public void appendTextChild(String str) {}
   
     // ==== BUILDER methods (should probably replace above construction 
methods) =====
   
  @@ -1523,7 +1527,7 @@
      * but I'm not sure we can refuse to accept it.
      * */
     void appendNSDeclaration(int prefixIndex, int namespaceIndex,
  -                        boolean isID)
  +                           boolean isID)
     {
       // %TBD%
     }
  @@ -1544,8 +1548,8 @@
      * @param contentLength int Length of node's content in m_char.
      * */
     void appendAttribute(int namespaceIndex, int localNameIndex, int 
prefixIndex,
  -                    boolean isID,
  -                    int contentStart, int contentLength)
  +                       boolean isID,
  +                       int contentStart, int contentLength)
     {
       // %TBD%
     }
  
  
  
  1.1.2.6   +16 -1     
xml-xalan/java/src/org/apache/xml/dtm/Attic/DTMIterator.java
  
  Index: DTMIterator.java
  ===================================================================
  RCS file: 
/home/cvs/xml-xalan/java/src/org/apache/xml/dtm/Attic/DTMIterator.java,v
  retrieving revision 1.1.2.5
  retrieving revision 1.1.2.6
  diff -u -r1.1.2.5 -r1.1.2.6
  --- DTMIterator.java  2001/04/26 19:14:36     1.1.2.5
  +++ DTMIterator.java  2001/05/06 02:09:40     1.1.2.6
  @@ -311,6 +311,21 @@
     public int item(int index);
     
     /**
  +   * Sets the node at the specified index of this vector to be the
  +   * specified node. The previous component at that position is discarded.
  +   *
  +   * <p>The index must be a value greater than or equal to 0 and less
  +   * than the current size of the vector.  
  +   * The iterator must be in cached mode.</p>
  +   * 
  +   * <p>Meant to be used for sorted iterators.</p>
  +   *
  +   * @param node Node to set
  +   * @param index Index of where to set the node
  +   */
  +  public void setItem(int node, int index);
  +  
  +  /**
      * The number of nodes in the list. The range of valid child node indices
      * is 0 to <code>length-1</code> inclusive. Note that this requires running
      * the iterator to completion, and presumably filling the cache.
  @@ -318,7 +333,7 @@
      * @return The number of nodes in the list.
      */
     public int getLength();
  -  
  +    
     //=========== Cloning operations. ============
     
     /**
  
  
  
  1.1.2.9   +4 -1      
xml-xalan/java/src/org/apache/xml/dtm/Attic/DTMManager.java
  
  Index: DTMManager.java
  ===================================================================
  RCS file: 
/home/cvs/xml-xalan/java/src/org/apache/xml/dtm/Attic/DTMManager.java,v
  retrieving revision 1.1.2.8
  retrieving revision 1.1.2.9
  diff -u -r1.1.2.8 -r1.1.2.9
  --- DTMManager.java   2001/04/26 20:19:06     1.1.2.8
  +++ DTMManager.java   2001/05/06 02:09:41     1.1.2.9
  @@ -185,11 +185,13 @@
      * @param source the specification of the source object.
      * @param unique true if the returned DTM must be unique, probably because 
it
      * is going to be mutated.
  +   * @param whiteSpaceFilter Enables filtering of whitespace nodes, and may 
  +   *                         be null.
      *
      * @return a non-null DTM reference.
      */
     public abstract DTM getDTM(javax.xml.transform.Source source,
  -                             boolean unique);
  +                             boolean unique, DTMWSFilter whiteSpaceFilter);
                                
     /**
      * Get the instance of DTM that "owns" a node handle.
  @@ -199,6 +201,7 @@
      * @return a non-null DTM reference.
      */
     public abstract DTM getDTM(int nodeHandle);
  +  
     /**
      * Creates a DTM representing an empty <code>DocumentFragment</code> 
object. 
      * @return a non-null DTM reference.
  
  
  
  1.1.2.2   +16 -6     
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.1
  retrieving revision 1.1.2.2
  diff -u -r1.1.2.1 -r1.1.2.2
  --- DTMManagerDefault.java    2001/04/17 15:58:14     1.1.2.1
  +++ DTMManagerDefault.java    2001/05/06 02:09:41     1.1.2.2
  @@ -84,18 +84,28 @@
     public DTMManagerDefault(){}
   
     /**
  -   * Get the instance of DTM that "owns" a node handle.
  +   * Get an instance of a DTM, loaded with the content from the
  +   * specified source.  If the unique flag is true, a new instance will
  +   * always be returned.  Otherwise it is up to the DTMManager to return a
  +   * new instance or an instance that it already created and may be being 
used
  +   * by someone else.
  +   * (I think more parameters will need to be added for error handling, and 
entity
  +   * resolution).
  +   *
  +   * @param source the specification of the source object.
  +   * @param unique true if the returned DTM must be unique, probably because 
it
  +   * is going to be mutated.
  +   * @param whiteSpaceFilter Enables filtering of whitespace nodes, and may 
  +   *                         be null.
      *
  -   * @param nodeHandle the nodeHandle.
  -   *
      * @return a non-null DTM reference.
      */
  -  public DTM getDTM(Source source, boolean unique)
  +  public DTM getDTM(Source source, boolean unique, DTMWSFilter 
whiteSpaceFilter)
     {
   
       if(source instanceof DOMSource)
       {
  -      DTM dtm = new DOM2DTM(this, (DOMSource)source, m_dtms.size());
  +      DTM dtm = new DOM2DTM(this, (DOMSource)source, m_dtms.size(), 
whiteSpaceFilter);
         m_dtms.add(dtm);
         return dtm;
       }
  @@ -180,7 +190,7 @@
         Document doc = db.newDocument();
         Node df = doc.createDocumentFragment();
     
  -      return getDTM(new DOMSource(df), true);
  +      return getDTM(new DOMSource(df), true, null);
       }
       catch(Exception e)
       {
  
  
  
  1.1.2.2   +2 -2      
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.1
  retrieving revision 1.1.2.2
  diff -u -r1.1.2.1 -r1.1.2.2
  --- DTMTreeWalker.java        2001/04/10 18:45:08     1.1.2.1
  +++ DTMTreeWalker.java        2001/05/06 02:09:41     1.1.2.2
  @@ -246,7 +246,7 @@
       case DTM.ELEMENT_NODE :
   
         for (int nsn = m_dtm.getFirstNamespaceNode(node, true); DTM.NULL != 
nsn;
  -           nsn = m_dtm.getNextNamespaceNode(nsn, true))
  +           nsn = m_dtm.getNextNamespaceNode(node, nsn, true))
         {
           String prefix = m_dtm.getPrefix(nsn);
   
  @@ -361,7 +361,7 @@
                                            m_dtm.getNodeName(node));
   
         for (int nsn = m_dtm.getFirstNamespaceNode(node, true); DTM.NULL != 
nsn;
  -           nsn = m_dtm.getNextNamespaceNode(nsn, true))
  +           nsn = m_dtm.getNextNamespaceNode(node, nsn, true))
         {
           String prefix = m_dtm.getPrefix(nsn);
   
  
  
  
  1.1.2.2   +115 -17   
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.1
  retrieving revision 1.1.2.2
  diff -u -r1.1.2.1 -r1.1.2.2
  --- ExpandedNameTable.java    2001/04/17 15:58:16     1.1.2.1
  +++ ExpandedNameTable.java    2001/05/06 02:09:41     1.1.2.2
  @@ -1,35 +1,123 @@
  +/*
  + * The Apache Software License, Version 1.1
  + *
  + *
  + * Copyright (c) 1999 The Apache Software Foundation.  All rights 
  + * reserved.
  + *
  + * Redistribution and use in source and binary forms, with or without
  + * modification, are permitted provided that the following conditions
  + * are met:
  + *
  + * 1. Redistributions of source code must retain the above copyright
  + *    notice, this list of conditions and the following disclaimer. 
  + *
  + * 2. Redistributions in binary form must reproduce the above copyright
  + *    notice, this list of conditions and the following disclaimer in
  + *    the documentation and/or other materials provided with the
  + *    distribution.
  + *
  + * 3. The end-user documentation included with the redistribution,
  + *    if any, must include the following acknowledgment:  
  + *       "This product includes software developed by the
  + *        Apache Software Foundation (http://www.apache.org/)."
  + *    Alternately, this acknowledgment may appear in the software itself,
  + *    if and wherever such third-party acknowledgments normally appear.
  + *
  + * 4. The names "Xalan" and "Apache Software Foundation" must
  + *    not be used to endorse or promote products derived from this
  + *    software without prior written permission. For written 
  + *    permission, please contact [EMAIL PROTECTED]
  + *
  + * 5. Products derived from this software may not be called "Apache",
  + *    nor may "Apache" appear in their name, without prior written
  + *    permission of the Apache Software Foundation.
  + *
  + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
  + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
  + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  + * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
  + * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
  + * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
  + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
  + * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  + * SUCH DAMAGE.
  + * ====================================================================
  + *
  + * This software consists of voluntary contributions made by many
  + * individuals on behalf of the Apache Software Foundation and was
  + * originally based on software copyright (c) 1999, Lotus
  + * Development Corporation., http://www.lotus.com.  For more
  + * information on the Apache Software Foundation, please see
  + * <http://www.apache.org/>.
  + */
   package org.apache.xml.dtm;
   
   /**
  - * This is a default implementation of a table that manages mappings from 
  + * This is a default implementation of a table that manages mappings from
    * expanded names to expandedNameIDs.
    */
  -
   public class ExpandedNameTable
   {
   
  +  /** Probably a reference to static pool.     */
  +  private DTMStringPool m_locNamesPool;
  +
  +  /** Probably a reference to static pool.   */
  +  private DTMStringPool m_namespaceNames;
  +  
  +  static int BITS_PER_LOCALNAME = 16;
  +  static int BITS_PER_NAMESPACE = 10;
  +
  +  static int MASK_LOCALNAME = 0x0000FFFF;
  +  static int MASK_NAMESPACE = 0x03FF0000;
  +  static int MASK_NODETYPE = 0xFC000000;
  +
  +  /**
  +   * Create an expanded name table that uses private string pool lookup.
  +   */
     public ExpandedNameTable()
     {
  +    m_locNamesPool = new DTMSafeStringPool();
  +    m_namespaceNames = new DTMSafeStringPool();
     }
  -  
  +
     /**
  +   * Constructor ExpandedNameTable
  +   *
  +   * @param locNamesPool Local element names lookup.
  +   * @param namespaceNames Namespace values lookup.
  +   */
  +  public ExpandedNameTable(DTMStringPool locNamesPool,
  +                           DTMStringPool namespaceNames)
  +  {
  +    m_locNamesPool = locNamesPool;
  +    m_namespaceNames = namespaceNames;
  +  }
  +
  +  /**
      * 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.
  +   * @param namespace
  +   * @param localName
      *
  -   * NEEDSDOC @param namespace
  -   * NEEDSDOC @param localName
  -   *
      * @return the expanded-name id of the node.
      */
  -  public int getExpandedNameID(String namespace, String localName)
  +  public int getExpandedNameID(String namespace, String localName, int type)
     {
  +    int nsID = (null != namespace) ? 
m_namespaceNames.stringToIndex(namespace) : 0;
  +    int lnID = m_locNamesPool.stringToIndex(localName);
  +    
  +    int expandedTypeID = (type << (BITS_PER_NAMESPACE+BITS_PER_LOCALNAME)) 
  +                       | (nsID << BITS_PER_LOCALNAME) | lnID;
   
  -    // %TBD%
  -    return 0;
  +    return expandedTypeID;
     }
   
     /**
  @@ -37,12 +125,23 @@
      *
      * @param ExpandedNameID an ID that represents an expanded-name.
      * @return String Local name of this node.
  +   */
  +  public String getLocalName(int ExpandedNameID)
  +  {
  +    return m_namespaceNames.indexToString(ExpandedNameID & MASK_LOCALNAME);
  +  }
  +
  +  /**
  +   * 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 getLocalNameFromExpandedNameID(int ExpandedNameID)
  +  public String getNamespace(int ExpandedNameID)
     {
   
  -    // %TBD%
  -    return null;
  +    return m_namespaceNames.indexToString((ExpandedNameID & MASK_NAMESPACE) 
>> BITS_PER_LOCALNAME);
     }
   
     /**
  @@ -52,10 +151,9 @@
      * @return String URI value of this node's namespace, or null if no
      * namespace was resolved.
      */
  -  public String getNamespaceFromExpandedNameID(int ExpandedNameID)
  +  public int getType(int ExpandedNameID)
     {
   
  -    // %TBD%
  -    return null;
  +    return ((ExpandedNameID & MASK_NAMESPACE) >> 
(BITS_PER_LOCALNAME+BITS_PER_NAMESPACE));
     }
  -}
  \ No newline at end of file
  +}
  
  
  
  1.1.2.2   +26 -24    xml-xalan/java/src/org/apache/xml/dtm/Attic/TestDTM.java
  
  Index: TestDTM.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xml/dtm/Attic/TestDTM.java,v
  retrieving revision 1.1.2.1
  retrieving revision 1.1.2.2
  diff -u -r1.1.2.1 -r1.1.2.2
  --- TestDTM.java      2001/04/26 17:50:01     1.1.2.1
  +++ TestDTM.java      2001/05/06 02:09:42     1.1.2.2
  @@ -1,3 +1,5 @@
  +package org.apache.xml.dtm;
  +
   import org.apache.xml.dtm.DTMDocumentImpl;
   import org.apache.xml.dtm.TestDTMNodes;
   import org.xml.sax.helpers.AttributesImpl;
  @@ -8,30 +10,30 @@
    */
   public class TestDTM {
   
  -     public static void main(String argv[]) {
  -             /*  <?xml version="1.0"?>
  -              *  <top>
  -              *   <A>
  -              *    <B/>
  -              *   </A>
  -              *   <C/>
  -              *  </top> */
  +        public static void main(String argv[]) {
  +                /*  <?xml version="1.0"?>
  +                 *  <top>
  +                 *   <A>
  +                 *    <B/>
  +                 *   </A>
  +                 *   <C/>
  +                 *  </top> */
   
   
  -             DTMDocumentImpl doc = new DTMDocumentImpl();
  -             doc.createElement("top",  null);
  -             doc.createElement( "A", null);
  -             AttributesImpl atts = new AttributesImpl();
  -             /*atts.addAttribute("", "", "hat", "CDATA", "new");
  -             atts.addAttribute("", "", "car", "CDATA", "Honda");
  -             atts.addAttribute("", "", "dog", "CDATA", "Boxer");*/
  -             doc.createElement("B", atts);
  -             doc.elementEnd("", "B");
  -             doc.elementEnd("", "A");
  -             doc.createElement("C", null);
  -             doc.elementEnd("", "C");
  -             doc.elementEnd("", "top");
  -             doc.documentEnd();
  -             TestDTMNodes.printNodeTable(doc);
  -     }
  +                DTMDocumentImpl doc = new DTMDocumentImpl();
  +                doc.createElement("top",  null);
  +                doc.createElement( "A", null);
  +                AttributesImpl atts = new AttributesImpl();
  +                /*atts.addAttribute("", "", "hat", "CDATA", "new");
  +                atts.addAttribute("", "", "car", "CDATA", "Honda");
  +                atts.addAttribute("", "", "dog", "CDATA", "Boxer");*/
  +                doc.createElement("B", atts);
  +                doc.elementEnd("", "B");
  +                doc.elementEnd("", "A");
  +                doc.createElement("C", null);
  +                doc.elementEnd("", "C");
  +                doc.elementEnd("", "top");
  +                doc.documentEnd();
  +                TestDTMNodes.printNodeTable(doc);
  +        }
   }
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.1.2.6   +412 -172  
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.5
  retrieving revision 1.1.2.6
  diff -u -r1.1.2.5 -r1.1.2.6
  --- DOM2DTM.java      2001/04/27 18:12:13     1.1.2.5
  +++ DOM2DTM.java      2001/05/06 02:09:46     1.1.2.6
  @@ -59,9 +59,12 @@
   import org.apache.xml.dtm.*;
   import org.apache.xml.utils.IntVector;
   import org.apache.xml.utils.IntStack;
  +import org.apache.xml.utils.BoolStack;
   import org.apache.xml.utils.StringBufferPool;
   import org.apache.xml.utils.FastStringBuffer;
   import org.apache.xml.utils.TreeWalker;
  +import org.apache.xml.utils.QName;
  +import org.apache.xml.utils.XMLCharacterRecognizer;
   
   import org.w3c.dom.*;
   
  @@ -70,6 +73,8 @@
   import javax.xml.transform.dom.DOMSource;
   import org.xml.sax.ContentHandler;
   
  +import org.apache.xml.utils.NodeVector;
  +
   /**
    * The <code>DOM2DTM</code> class serves up a DOM via a DTM API.
    */
  @@ -136,19 +141,36 @@
     protected int m_dtmIdent;
   
     /** %TBD% Doc */
  +  protected int m_dtmRoot;
  +
  +  /** %TBD% Doc */
     protected int m_mask;
   
     /** %TBD% Doc */
     protected String m_documentBaseURI;
  +  
  +  /**
  +   * The whitespace filter that enables elements to strip whitespace or not.
  +   */
  +  protected DTMWSFilter m_wsfilter;
  +  
  +  /** Flag indicating whether to strip whitespace nodes          */
  +  private boolean m_shouldStripWS = false;
   
  +  /** Stack of flags indicating whether to strip whitespace nodes          */
  +  private BoolStack m_shouldStripWhitespaceStack;
  +
     /**
      * Construct a DOM2DTM object from a DOM node.
      *
  -   * NEEDSDOC @param mgr
  -   * NEEDSDOC @param node
  -   * NEEDSDOC @param domSource
  +   * @param mgr The DTMManager who owns this DTM.
  +   * @param domSource the DOM source that this DTM will wrap.
  +   * @param dtmIdentity The DTM identity ID for this DTM.
  +   * @param whiteSpaceFilter The white space filter for this DTM, which may 
  +   *                         be null.
      */
  -  public DOM2DTM(DTMManager mgr, DOMSource domSource, int dtmIdentity)
  +  public DOM2DTM(DTMManager mgr, DOMSource domSource, 
  +                 int dtmIdentity, DTMWSFilter whiteSpaceFilter)
     {
   
       m_mgr = mgr;
  @@ -158,26 +180,33 @@
       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);
     }
   
     /**
      * Construct the node map from the node.
      *
  -   * NEEDSDOC @param node
  -   * NEEDSDOC @param level
  -   * NEEDSDOC @param parentIndex
  -   * NEEDSDOC @param previousSibling
  +   * @param node The node that is to be added to the DTM.
  +   * @param level The current level in the tree.
  +   * @param parentIndex The current parent index.
  +   * @param previousSibling The previous sibling index.
      *
  -   * NEEDSDOC ($objectName$) @return
  +   * @return The index identity of the node that was added.
      */
     protected int addNode(Node node, int level, int parentIndex,
                           int previousSibling)
     {
   
       int nodeIndex = m_nodes.size();
  -
  +    
  +    int type = node.getNodeType();
  +    
       m_nodes.addElement(node);
   
       int startInfo = nodeIndex * NODEINFOBLOCKSIZE;
  @@ -185,8 +214,6 @@
       m_info.addElements(NODEINFOBLOCKSIZE);
       m_info.setElementAt(level, startInfo + OFFSET_LEVEL);
   
  -    int type = node.getNodeType();
  -
       if (Node.ATTRIBUTE_NODE == type)
       {
         String name = node.getNodeName();
  @@ -215,7 +242,7 @@
       String nsURI = node.getNamespaceURI();
       String localName = node.getLocalName();
       int expandedNameID 
  -        = m_mgr.getExpandedNameTable(this).getExpandedNameID(nsURI, 
localName);
  +        = m_mgr.getExpandedNameTable(this).getExpandedNameID(nsURI, 
localName, type);
       m_info.setElementAt(expandedNameID, startInfo + OFFSET_EXPANDEDNAMEID);  
  
   
       if (DTM.NULL != previousSibling)
  @@ -274,139 +301,179 @@
      * Each call to this method adds a new node to the table, unless the end
      * is reached, in which case it returns null.
      *
  -   * NEEDSDOC ($objectName$) @return
  +   * @return The next node in the tree, in document order, or null if 
  +   *         there are no more nodes.
      */
     protected Node nextNode()
     {
  +    // Non-recursive one-fetch-at-a-time depth-first traversal with 
  +    // attribute/namespace nodes and white-space stripping.
  +    // Yippee!  Not for the faint of heart.  I would be glad for 
  +    // constructive suggestions on how to make this cleaner.
   
       if (m_nodesAreProcessed)
       {
  -      // return null;
  +      return null;
       }
   
       Node top = m_root;  // tells us when to stop.
       Node pos = (null == m_pos) ? m_root : m_pos;
  -
  -    // non-recursive depth-first traversal.
  -    // while (null != pos)
  -    {
   
  -      // %TBD% Process attributes!
  -      Node nextNode;
  -      int type = pos.getNodeType();
  +    Node nextNode;
  +    int type = pos.getNodeType();
   
  -      int currentIndexHandle = m_nodes.size()-1;
  -      int posInfo = currentIndexHandle * NODEINFOBLOCKSIZE;
  -      
  -      boolean shouldPushLevel = true;
  -      if (Node.ELEMENT_NODE == type)
  -      {
  -        m_attrs = pos.getAttributes();
  -        m_attrsPos = 0;
  +    int currentIndexHandle = m_nodes.size()-1;
  +    int posInfo = currentIndexHandle * NODEINFOBLOCKSIZE;
  +    
  +    boolean shouldPushLevel = true;
  +    if (Node.ELEMENT_NODE == type)
  +    {
  +      m_attrs = pos.getAttributes();
  +      m_attrsPos = 0;
   
  -        if (null != m_attrs)
  -        {
  -          if (m_attrsPos < m_attrs.getLength())
  -          {
  -            m_elementForAttrs = pos;
  -            m_elementForAttrsIndex = currentIndexHandle;
  -            nextNode = m_attrs.item(m_attrsPos);
  -          }
  -          else
  -            nextNode = pos.getFirstChild();
  -        }
  -        else
  -          nextNode = pos.getFirstChild();
  -      }
  -      else if (Node.ATTRIBUTE_NODE == type)
  +      if (null != m_attrs)
         {
  -        m_info.setElementAt(DTM.NULL, posInfo + OFFSET_FIRSTCHILD);
  -        m_attrsPos++;
  -
           if (m_attrsPos < m_attrs.getLength())
           {
  +          m_elementForAttrs = pos;
  +          m_elementForAttrsIndex = currentIndexHandle;
             nextNode = m_attrs.item(m_attrsPos);
  -          shouldPushLevel = false;
           }
           else
  -        {
  -          m_info.setElementAt(DTM.NULL, posInfo + OFFSET_NEXTSIBLING);
  -          pos = m_elementForAttrs;
  -          currentIndexHandle = m_elementForAttrsIndex;
  -          posInfo = currentIndexHandle * NODEINFOBLOCKSIZE;
             nextNode = pos.getFirstChild();
  -
  -          m_levelInfo.quickPop(LEVELINFO_NPERLEVEL);
  -        }
         }
         else
  -        nextNode = pos.getFirstChild();        
  -
  -      if (shouldPushLevel && (null != nextNode))
         {
  -        m_levelInfo.push(currentIndexHandle); // parent
  -        m_levelInfo.push(DTM.NULL); // previous sibling
  +        nextNode = pos.getFirstChild();
         }
  +    }
  +    else if (Node.ATTRIBUTE_NODE == type)
  +    {
  +      m_info.setElementAt(DTM.NULL, posInfo + OFFSET_FIRSTCHILD);
  +      m_attrsPos++;
   
  -      while (null == nextNode)
  +      if (m_attrsPos < m_attrs.getLength())
  +      {
  +        nextNode = m_attrs.item(m_attrsPos);
  +        shouldPushLevel = false;
  +      }
  +      else
         {
  -        if(m_info.elementAt(posInfo + OFFSET_FIRSTCHILD) == NOTPROCESSED)
  +        m_info.setElementAt(DTM.NULL, posInfo + OFFSET_NEXTSIBLING); 
  +        pos = m_elementForAttrs;
  +        currentIndexHandle = m_elementForAttrsIndex;
  +        posInfo = currentIndexHandle * NODEINFOBLOCKSIZE;
  +        nextNode = pos.getFirstChild();
  +        m_levelInfo.quickPop(LEVELINFO_NPERLEVEL);
  +      }
  +    }
  +    else
  +      nextNode = pos.getFirstChild();  
  +     
  +    // %TBD% Text node coalition.
  +    if((null != m_wsfilter) && (null != nextNode) && 
getShouldStripWhitespace())
  +    {
  +      int t = nextNode.getNodeType();
  +      
  +      if((Node.CDATA_SECTION_NODE == t) || (Node.TEXT_NODE == t))
  +      {
  +        String data = nextNode.getNodeValue();
  +        if(XMLCharacterRecognizer.isWhiteSpace(data))
           {
  -          m_info.setElementAt(DTM.NULL, posInfo + OFFSET_FIRSTCHILD);
  +          nextNode = nextNode.getNextSibling();
           }
  +      }
  +    }
  +    if (shouldPushLevel && (null != nextNode))
  +    {
  +      m_levelInfo.push(currentIndexHandle); // parent
  +      m_levelInfo.push(DTM.NULL); // previous sibling
  +    }
  +
  +    while (null == nextNode)
  +    {
  +      if(m_info.elementAt(posInfo + OFFSET_FIRSTCHILD) == NOTPROCESSED)
  +      {
  +        m_info.setElementAt(DTM.NULL, posInfo + OFFSET_FIRSTCHILD);
  +      }
  +      
  +      if (top.equals(pos))
  +      {
  +        m_info.setElementAt(DTM.NULL, posInfo + OFFSET_NEXTSIBLING);
  +        break;
  +      }
  +      
  +      nextNode = pos.getNextSibling();
  +      
  +      // %TBD% Text node coalition.
  +      if((null != nextNode) && (null != m_wsfilter) && 
getShouldStripWhitespace())
  +      {
  +        int t = nextNode.getNodeType();
           
  -        if (top.equals(pos))
  +        if((Node.CDATA_SECTION_NODE == t) || (Node.TEXT_NODE == t))
           {
  -          m_info.setElementAt(DTM.NULL, posInfo + OFFSET_NEXTSIBLING);
  -          break;
  +          String data = nextNode.getNodeValue();
  +          if(XMLCharacterRecognizer.isWhiteSpace(data))
  +          {
  +            nextNode = nextNode.getNextSibling();
  +          }
           }
  +      }
  +      if(Node.ELEMENT_NODE == pos.getNodeType())
  +      {
  +        // I think this only has to be popped here, and not at getParent,
  +        // oddly enough at first glance.
  +        popShouldStripWhitespace();
  +      }
  +      
  +      if (null == nextNode)
  +      {
  +        m_info.setElementAt(DTM.NULL, posInfo + OFFSET_NEXTSIBLING);
   
  -        nextNode = pos.getNextSibling();
  +        currentIndexHandle = m_info.elementAt(posInfo + OFFSET_PARENT);
  +        posInfo = currentIndexHandle * NODEINFOBLOCKSIZE;
  +        m_levelInfo.quickPop(LEVELINFO_NPERLEVEL);
  +        pos = pos.getParentNode();
   
  -        if (null == nextNode)
  +        if ((null == pos) || (top.equals(pos)))
           {
             m_info.setElementAt(DTM.NULL, posInfo + OFFSET_NEXTSIBLING);
  -
  -          currentIndexHandle = m_info.elementAt(posInfo + OFFSET_PARENT);
  -          posInfo = currentIndexHandle * NODEINFOBLOCKSIZE;
  -          
  -          m_levelInfo.quickPop(LEVELINFO_NPERLEVEL);
  -          pos = pos.getParentNode();
  -
  -          if ((null == pos) || (top.equals(pos)))
  -          {
  -            m_info.setElementAt(DTM.NULL, posInfo + OFFSET_NEXTSIBLING);
  -            nextNode = null;
  -            break;
  -          }
  -
  -          
  +          nextNode = null;
  +          break;
           }
         }
  -
  -      pos = nextNode;
  -
  -      if (null != pos)
  -      {
  -        int level = m_levelInfo.size() / LEVELINFO_NPERLEVEL;
  +      
  +    } // end while (null == nextNode) [for next sibling, parent]
   
  -        int newIndexHandle = 
  -              addNode(pos, level, m_levelInfo.peek(LEVELINFO_PARENT),
  -                  m_levelInfo.peek(LEVELINFO_PREVSIB));
  +    pos = nextNode;
   
  -        m_pos = pos;
  +    if (null != pos)
  +    {
  +      int level = m_levelInfo.size() / LEVELINFO_NPERLEVEL;
  +      int newIndexHandle = 
  +            addNode(pos, level, m_levelInfo.peek(LEVELINFO_PARENT),
  +                m_levelInfo.peek(LEVELINFO_PREVSIB));
   
  -        int sz = m_levelInfo.size();
  +      m_pos = pos;
   
  -        m_levelInfo.setElementAt(newIndexHandle,
  -                                 sz - (1 + LEVELINFO_PREVSIB));
  +      int sz = m_levelInfo.size();
   
  -        return pos;
  +      m_levelInfo.setElementAt(newIndexHandle,
  +                               sz - (1 + LEVELINFO_PREVSIB));
  +                               
  +      if((null != m_wsfilter) && (Node.ELEMENT_NODE == pos.getNodeType()))
  +      {
  +        short wsv = m_wsfilter.getShouldStripSpace(newIndexHandle);
  +        boolean shouldStrip = (DTMWSFilter.INHERIT == wsv) ? 
  +                  getShouldStripWhitespace() : (DTMWSFilter.STRIP == wsv);
  +        pushShouldStripWhitespace(shouldStrip);
         }
  +      return pos;
       }
   
  -    m_nodesAreProcessed = true;
   
  +    m_nodesAreProcessed = true;
  +    m_pos = null;
       return null;
     }
   
  @@ -688,48 +755,6 @@
     }
   
     /**
  -   * 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)
  -    {
  -
  -      // Assume that attributes and namespaces 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 (DTM.ATTRIBUTE_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.
  @@ -801,38 +826,177 @@
   
       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 namespace handle, advance to the next namespace.
  +   * 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 namespaceHandle handle to node which must be of type 
NAMESPACE_NODE.
  +   * @param nodeHandle handle to node, which should probably be an element
  +   *                   node, but need not be.
      *
  -   * NEEDSDOC @param nodeHandle
  -   * NEEDSDOC @param inScope
  -   * @return handle of next namespace, or DTM.NULL to indicate none exists.
  +   * @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 getNextNamespaceNode(int nodeHandle, boolean inScope)
  +  public int getFirstNamespaceNode(int nodeHandle, boolean inScope)
     {
   
       int type = getNodeType(nodeHandle);
   
  -    if (DTM.NAMESPACE_NODE == type)
  +    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;
  +          }
  +        }
  +      }
  +    }
   
  -      // Assume that attributes and namespace nodes immediately follow the 
element.
  -      int identity = nodeHandle & m_mask;
  +    return DTM.NULL;
  +  }
   
  -      while (DTM.NULL != (identity = getNextNodeIdentity(identity)))
  -      {
  -        type = getNodeType(identity);
   
  -        if (type == DTM.NAMESPACE_NODE)
  +  /**
  +   * Given a namespace handle, advance to the next namespace.
  +   *
  +   * @param baseHandle handle to original node from where the first child 
  +   * 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 
           {
  -          return identity | m_dtmIdent;
  +          if(nodeHandle == namespaces.elementAt(i))
  +          {
  +            if(i+1 < n)
  +              return namespaces.elementAt(i+1);
  +          }
           }
  -        else if (type != DTM.ATTRIBUTE_NODE)
  +      }
  +      else
  +      {
  +        // Assume that attributes and namespace nodes immediately follow the 
element.
  +        int identity = nodeHandle & m_mask;
  +  
  +        while (DTM.NULL != (identity = getNextNodeIdentity(identity)))
           {
  -          break;
  +          type = getNodeType(identity);
  +  
  +          if (type == DTM.NAMESPACE_NODE)
  +          {
  +            return identity | m_dtmIdent;
  +          }
  +          else if (type != DTM.ATTRIBUTE_NODE)
  +          {
  +            break;
  +          }
           }
         }
       }
  @@ -900,9 +1064,15 @@
     {
   
       int identity = nodeHandle & m_mask;
  -    int firstChild = getNodeInfo(identity, OFFSET_PARENT);
  -
  -    return nodeHandle | m_dtmIdent;
  +    // System.out.println("identity: "+identity);
  +    if(identity > 0)
  +    {
  +      int parent = getNodeInfo(identity, OFFSET_PARENT);
  +  
  +      return parent | m_dtmIdent;
  +    }
  +    else
  +      return DTM.NULL;
     }
   
     /**
  @@ -913,7 +1083,7 @@
      */
     public int getDocument()
     {
  -    return 0 | m_dtmIdent;
  +    return m_dtmIdent;
     }
   
     /**
  @@ -1098,12 +1268,12 @@
      *
      * @return the expanded-name id of the node.
      */
  -  public int getExpandedNameID(String namespace, String localName)
  +  public int getExpandedNameID(String namespace, String localName, int type)
     {
   
       ExpandedNameTable ent = m_mgr.getExpandedNameTable(this);
   
  -    return ent.getExpandedNameID(namespace, localName);
  +    return ent.getExpandedNameID(namespace, localName, type);
     }
   
     /**
  @@ -1116,7 +1286,7 @@
     {
       ExpandedNameTable ent = m_mgr.getExpandedNameTable(this);
   
  -    return ent.getLocalNameFromExpandedNameID(ExpandedNameID);
  +    return ent.getLocalName(ExpandedNameID);
     }
   
     /**
  @@ -1130,7 +1300,7 @@
     {
       ExpandedNameTable ent = m_mgr.getExpandedNameTable(this);
   
  -    return ent.getNamespaceFromExpandedNameID(ExpandedNameID);
  +    return ent.getNamespace(ExpandedNameID);
     }
   
     /**
  @@ -1167,10 +1337,25 @@
   
       switch (type)
       {
  +    case DTM.NAMESPACE_NODE :
  +    {
  +      Node node = getNode(nodeHandle);
  +
  +      // assume not null.
  +      name = node.getNodeName();
  +      if(name.startsWith("xmlns:"))
  +      {
  +        name = QName.getLocalPart(name);
  +      }
  +      else if(name.equals("xmlns"))
  +      {
  +        name = "";
  +      }
  +    }
  +    break;
       case DTM.ATTRIBUTE_NODE :
       case DTM.ELEMENT_NODE :
       case DTM.ENTITY_REFERENCE_NODE :
  -    case DTM.NAMESPACE_NODE :
       case DTM.PROCESSING_INSTRUCTION_NODE :
       {
         Node node = getNode(nodeHandle);
  @@ -1366,7 +1551,8 @@
   
       int identity = nodeHandle & m_mask;
   
  -    return (short) getNodeInfo(identity, OFFSET_LEVEL);
  +    // Apparently, the axis walker stuff requires levels to count from 1.
  +    return (short) (getNodeInfo(identity, OFFSET_LEVEL)+1);
     }
   
     // ============== Document query functions ============== 
  @@ -1831,15 +2017,17 @@
         }
       }
       break;
  +    case Node.PROCESSING_INSTRUCTION_NODE : // %REVIEW%
  +    case Node.COMMENT_NODE :
       case Node.TEXT_NODE :
       case Node.CDATA_SECTION_NODE :
       case Node.ATTRIBUTE_NODE :
         String str = node.getNodeValue();
         ch.characters(str.toCharArray(), 0, str.length());
         break;
  -    case Node.PROCESSING_INSTRUCTION_NODE :
  -      // warning(XPATHErrorResources.WG_PARSING_AND_PREPARING);        
  -      break;
  +//    case Node.PROCESSING_INSTRUCTION_NODE :
  +//      // warning(XPATHErrorResources.WG_PARSING_AND_PREPARING);        
  +//      break;
       default :
         // ignore
         break;
  @@ -1912,5 +2100,57 @@
     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);
     }
   }
  
  
  
  1.1.2.3   +13 -3     
xml-xalan/java/src/org/apache/xml/dtm/dom2dtm/Attic/UnitTest.java
  
  Index: UnitTest.java
  ===================================================================
  RCS file: 
/home/cvs/xml-xalan/java/src/org/apache/xml/dtm/dom2dtm/Attic/UnitTest.java,v
  retrieving revision 1.1.2.2
  retrieving revision 1.1.2.3
  diff -u -r1.1.2.2 -r1.1.2.3
  --- UnitTest.java     2001/04/18 17:42:29     1.1.2.2
  +++ UnitTest.java     2001/05/06 02:09:46     1.1.2.3
  @@ -79,7 +79,7 @@
                 "</far-north>";
                   
     // namespaces and text
  -  static String s_doc1String3 = 
  +  static String s_doc1String3x = 
                 "<?xml version=\"1.0\"?>" +
                 "<far-north>a" +
                 " <north xmlns:x='http://x.com'>b" +
  @@ -100,6 +100,16 @@
                 "  </near-north>s" +
                 " </north>t" +
                 "</far-north>";
  +              
  +    static String s_doc1String3 = 
  +              "<?xml version=\"1.0\"?>" +
  +              "<docs>" +
  +              "  <doc xmlns:ext=\"http://somebody.elses.extension\";>" +
  +              "    <section xmlns:foo=\"http://foo.com\";>" +
  +              "      <inner xmlns:whiz=\"http://whiz.com/special/page\"/>" +
  +              "    </section>" +
  +              "  </doc>" +
  +              "</docs>";
     
     protected int run(String[] args)
       throws Exception
  @@ -112,7 +122,7 @@
       Document doc = db.parse(new InputSource(sr));
       
       DTMManager dtmMgr = DTMManager.newInstance();
  -    DTM dtm = dtmMgr.getDTM(new DOMSource(doc), true);
  +    DTM dtm = dtmMgr.getDTM(new DOMSource(doc), true, null);
       
       int docHandle = dtm.getDocument();
       outputChildren(docHandle, dtm, 0);
  @@ -141,7 +151,7 @@
         System.out.println(", val: "+dtm.getStringValue(handle));
         
         for (int ns = dtm.getFirstNamespaceNode(handle, true); ns != DTM.NULL; 
  -           ns = dtm.getNextNamespaceNode(ns, true)) 
  +           ns = dtm.getNextNamespaceNode(handle, ns, true)) 
         {
           System.out.print("ns decl: "+dtm.getNodeName(ns));
           System.out.println(", val: "+dtm.getStringValue(ns));
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.8.2.2   +5 -5      xml-xalan/java/src/org/apache/xml/utils/DOMBuilder.java
  
  Index: DOMBuilder.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xml/utils/DOMBuilder.java,v
  retrieving revision 1.8.2.1
  retrieving revision 1.8.2.2
  diff -u -r1.8.2.1 -r1.8.2.2
  --- DOMBuilder.java   2001/04/10 18:45:09     1.8.2.1
  +++ DOMBuilder.java   2001/05/06 02:09:47     1.8.2.2
  @@ -59,6 +59,7 @@
   import org.apache.xalan.res.XSLMessages;
   import org.apache.xpath.res.XPATHErrorResources;
   import org.apache.xml.utils.NodeVector;
  +import java.util.Stack;
   
   import org.xml.sax.ext.LexicalHandler;
   import org.xml.sax.ContentHandler;
  @@ -87,7 +88,7 @@
     public DocumentFragment m_docFrag = null;
   
     /** Vector of element nodes          */
  -  protected NodeVector m_elemStack = new NodeVector();
  +  protected Stack m_elemStack = new Stack();
   
     /**
      * DOMBuilder instance constructor... it will add the DOM nodes
  @@ -342,8 +343,7 @@
         
         // append(elem);
     
  -      // %TBD%
  -//      m_elemStack.push(elem);
  +      m_elemStack.push(elem);
     
         m_currentNode = elem;
         
  @@ -376,8 +376,8 @@
     public void endElement(String ns, String localName, String name)
             throws org.xml.sax.SAXException
     {
  -    // %TBD%
  -//    m_currentNode = m_elemStack.popAndTop();
  +    m_elemStack.pop();
  +    m_currentNode = m_elemStack.isEmpty() ? null : (Node)m_elemStack.peek();
     }
   
     /**
  
  
  
  1.3.2.2   +19 -0     xml-xalan/java/src/org/apache/xml/utils/NodeVector.java
  
  Index: NodeVector.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xml/utils/NodeVector.java,v
  retrieving revision 1.3.2.1
  retrieving revision 1.3.2.2
  diff -u -r1.3.2.1 -r1.3.2.2
  --- NodeVector.java   2001/04/10 18:45:09     1.3.2.1
  +++ NodeVector.java   2001/05/06 02:09:47     1.3.2.2
  @@ -354,6 +354,25 @@
     {
       return m_map[m_firstFree - 2];
     }
  +  
  +  /**
  +   * Insert a node in order in the list.
  +   * 
  +   * @param value Node to insert
  +   */
  +  public void insertInOrder(int value)
  +  {
  +    for (int i = 0; i < m_firstFree; i++) 
  +    {
  +      if(value < m_map[i])
  +      {
  +        insertElementAt(value, i);
  +        return;
  +      }
  +    }
  +    addElement(value);
  +    
  +  }
   
     /**
      * Inserts the specified node in this vector at the specified index.
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.10.2.2  +17 -0     xml-xalan/java/src/org/apache/xpath/NodeSet.java
  
  Index: NodeSet.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xpath/NodeSet.java,v
  retrieving revision 1.10.2.1
  retrieving revision 1.10.2.2
  diff -u -r1.10.2.1 -r1.10.2.2
  --- NodeSet.java      2001/04/10 18:45:10     1.10.2.1
  +++ NodeSet.java      2001/05/06 02:09:48     1.10.2.2
  @@ -985,6 +985,23 @@
   
       super.setElementAt(node, index);
     }
  +  
  +  /**
  +   * Same as setElementAt.
  +   *
  +   * @param node  The node to be set.
  +   * @param index The index of the node to be replaced.
  +   * @throws RuntimeException thrown if this NodeSet is not of 
  +   * a mutable type.
  +   */
  +  public void setItem(int node, int index)
  +  {
  +
  +    if (!m_mutable)
  +      throw new RuntimeException("This NodeSet is not mutable!");
  +
  +    super.setElementAt(node, index);
  +  }
   
     /**
      * Get the nth element.
  
  
  
  1.24.2.2  +2 -1      
xml-xalan/java/src/org/apache/xpath/SourceTreeManager.java
  
  Index: SourceTreeManager.java
  ===================================================================
  RCS file: 
/home/cvs/xml-xalan/java/src/org/apache/xpath/SourceTreeManager.java,v
  retrieving revision 1.24.2.1
  retrieving revision 1.24.2.2
  diff -u -r1.24.2.1 -r1.24.2.2
  --- SourceTreeManager.java    2001/04/10 18:45:11     1.24.2.1
  +++ SourceTreeManager.java    2001/05/06 02:09:48     1.24.2.2
  @@ -338,7 +338,8 @@
   
       try
       {
  -      DTM dtm = xctxt.getDTM(source, false);
  +      // %TBD% I think I need a TransformerImpl here?
  +      DTM dtm = xctxt.getDTM(source, false, null);
         return dtm.getDocument();
       }
       catch (Exception e)
  
  
  
  1.20.2.3  +5 -3      xml-xalan/java/src/org/apache/xpath/XPathContext.java
  
  Index: XPathContext.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xpath/XPathContext.java,v
  retrieving revision 1.20.2.2
  retrieving revision 1.20.2.3
  diff -u -r1.20.2.2 -r1.20.2.3
  --- XPathContext.java 2001/04/17 15:51:13     1.20.2.2
  +++ XPathContext.java 2001/05/06 02:09:48     1.20.2.3
  @@ -107,6 +107,7 @@
   import org.apache.xml.dtm.DTMIterator;
   import org.apache.xml.dtm.DTMFilter;
   import org.apache.xml.dtm.DTM;
  +import org.apache.xml.dtm.DTMWSFilter;
   
   /**
    * <meta name="usage" content="advanced"/>
  @@ -121,7 +122,7 @@
      * the DTMManager, it really is a proxy for this object, which 
      * is the real DTMManager.
      */
  -  DTMManager m_dtmManager;
  +  private DTMManager m_dtmManager = DTMManager.newInstance();
     
     /**
      * Return the DTMManager object.  Though XPathContext context extends 
  @@ -148,9 +149,10 @@
      *
      * @return a non-null DTM reference.
      */
  -  public DTM getDTM(javax.xml.transform.Source source, boolean unique)
  +  public DTM getDTM(javax.xml.transform.Source source, boolean unique, 
  +                    DTMWSFilter wsfilter)
     {
  -    return m_dtmManager.getDTM(source, unique);
  +    return m_dtmManager.getDTM(source, unique, wsfilter);
     }
                                
     /**
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.18.2.2  +17 -23    xml-xalan/java/src/org/apache/xpath/axes/AxesWalker.java
  
  Index: AxesWalker.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xpath/axes/AxesWalker.java,v
  retrieving revision 1.18.2.1
  retrieving revision 1.18.2.2
  diff -u -r1.18.2.1 -r1.18.2.2
  --- AxesWalker.java   2001/04/10 18:45:15     1.18.2.1
  +++ AxesWalker.java   2001/05/06 02:09:49     1.18.2.2
  @@ -278,8 +278,9 @@
     {
   
       int parent = m_root;
  -
  -    while (DTM.NULL != (parent = getDTM(parent).getParent(parent)))
  +    
  +    DTM dtm = getDTM(parent);
  +    while (DTM.NULL != (parent = dtm.getParent(parent)))
       {
         if (parent == n)
           return true;
  @@ -546,24 +547,15 @@
       String rootName;
       String currentNodeName;
   
  -    try
  -    {
  -      rootName = (DTM.NULL == m_root)
  -                 ? "null"
  -                 : getDTM(m_root).getNodeName(m_root) + "{"
  -                   + m_root + "}";
  -      currentNodeName =
  -        (DTM.NULL == m_root)
  -        ? "null"
  -        : getDTM(m_currentNode).getNodeName(m_currentNode) + "{"
  -          + m_currentNode + "}";
  -    }
  -    catch (ClassCastException cce)
  -    {
  -      rootName = (DTM.NULL == m_root) ? "null" : 
getDTM(m_root).getNodeName(m_root);
  -      currentNodeName = (DTM.NULL == m_root)
  -                        ? "null" : 
getDTM(m_currentNode).getNodeName(m_currentNode);
  -    }
  +    rootName = (DTM.NULL == m_root)
  +               ? "null"
  +               : getDTM(m_root).getNodeName(m_root) + "{"
  +                 + (m_root+1) + "}";
  +    currentNodeName =
  +      (DTM.NULL == m_currentNode)
  +      ? "null"
  +      : getDTM(m_currentNode).getNodeName(m_currentNode) + "{"
  +        + (m_currentNode+1) + "}";
   
       return clName + "[" + rootName + "][" + currentNodeName + "]";
     }
  @@ -1054,6 +1046,7 @@
       if (DTM.NULL == next)
         this.m_isDone = true;
   
  +    // System.out.println("Returning: "+this);
       return next;
     }
   
  @@ -1248,6 +1241,7 @@
     {
   
       int pos = getProximityPosition();
  +    
       AxesWalker walker;
   
       try
  @@ -1390,15 +1384,15 @@
     /**
      *  The root node of the TreeWalker, as specified when it was created.
      */
  -  transient int m_root;
  +  transient int m_root = DTM.NULL;
   
     /**
      *  The node at which the TreeWalker is currently positioned.
      */
  -  transient int m_currentNode;
  +  transient int m_currentNode = DTM.NULL;
     
     /** The node last returned from nextNode(). */
  -  transient int m_prevReturned;
  +  transient int m_prevReturned = DTM.NULL;
   
     /**
      * The arg length of the XPath step. Does not change after the constructor.
  
  
  
  1.8.2.2   +1 -1      
xml-xalan/java/src/org/apache/xpath/axes/DescendantIterator.java
  
  Index: DescendantIterator.java
  ===================================================================
  RCS file: 
/home/cvs/xml-xalan/java/src/org/apache/xpath/axes/DescendantIterator.java,v
  retrieving revision 1.8.2.1
  retrieving revision 1.8.2.2
  diff -u -r1.8.2.1 -r1.8.2.2
  --- DescendantIterator.java   2001/04/10 18:45:16     1.8.2.1
  +++ DescendantIterator.java   2001/05/06 02:09:50     1.8.2.2
  @@ -305,7 +305,7 @@
     }
     
     /** The top of the subtree, may not be the same as m_context if "//foo" 
pattern. */ 
  -  transient private int m_startContext;
  +  transient private int m_startContext = DTM.NULL;
   
     /** True if this is a descendants-or-self axes.
      *  @serial */
  
  
  
  1.14.2.2  +3 -2      
xml-xalan/java/src/org/apache/xpath/axes/FilterExprWalker.java
  
  Index: FilterExprWalker.java
  ===================================================================
  RCS file: 
/home/cvs/xml-xalan/java/src/org/apache/xpath/axes/FilterExprWalker.java,v
  retrieving revision 1.14.2.1
  retrieving revision 1.14.2.2
  diff -u -r1.14.2.1 -r1.14.2.2
  --- FilterExprWalker.java     2001/04/10 18:45:16     1.14.2.1
  +++ FilterExprWalker.java     2001/05/06 02:09:50     1.14.2.2
  @@ -293,8 +293,9 @@
         */
       }
   
  -    // System.out.println("FilterExprWalker.getNextNode - Returning: "+next);
  -    return setCurrentIfNotNull(next);
  +    int current = setCurrentIfNotNull(next);
  +    // System.out.println("Returning: "+this);
  +    return current;
     }
     
     /** The contained expression. Should be non-null.
  
  
  
  1.6.2.2   +1 -1      
xml-xalan/java/src/org/apache/xpath/axes/FollowingWalker.java
  
  Index: FollowingWalker.java
  ===================================================================
  RCS file: 
/home/cvs/xml-xalan/java/src/org/apache/xpath/axes/FollowingWalker.java,v
  retrieving revision 1.6.2.1
  retrieving revision 1.6.2.2
  diff -u -r1.6.2.1 -r1.6.2.2
  --- FollowingWalker.java      2001/04/10 18:45:16     1.6.2.1
  +++ FollowingWalker.java      2001/05/06 02:09:50     1.6.2.2
  @@ -257,7 +257,7 @@
   
     /** What this is is frankly a little unclear.  It is used in getParent 
      *  to see if we should continue to climb the tree. */
  -  transient int m_currentAncestor;
  +  transient int m_currentAncestor = DTM.NULL;
   
     /**
      * Tell what's the maximum level this axes can descend to.
  
  
  
  1.24.2.2  +36 -9     
xml-xalan/java/src/org/apache/xpath/axes/LocPathIterator.java
  
  Index: LocPathIterator.java
  ===================================================================
  RCS file: 
/home/cvs/xml-xalan/java/src/org/apache/xpath/axes/LocPathIterator.java,v
  retrieving revision 1.24.2.1
  retrieving revision 1.24.2.2
  diff -u -r1.24.2.1 -r1.24.2.2
  --- LocPathIterator.java      2001/04/10 18:45:17     1.24.2.1
  +++ LocPathIterator.java      2001/05/06 02:09:50     1.24.2.2
  @@ -441,10 +441,28 @@
     public int item(int index)
     {
   
  -    resetToCachedList();
  +    // resetToCachedList();
   
       return m_cachedNodes.item(index);
     }
  +  
  +  /**
  +   * Sets the node at the specified index of this vector to be the
  +   * specified node. The previous component at that position is discarded.
  +   *
  +   * <p>The index must be a value greater than or equal to 0 and less
  +   * than the current size of the vector.  
  +   * The iterator must be in cached mode.</p>
  +   * 
  +   * <p>Meant to be used for sorted iterators.</p>
  +   *
  +   * @param node Node to set
  +   * @param index Index of where to set the node
  +   */
  +  public void setItem(int node, int index)
  +  {
  +    m_cachedNodes.setElementAt(node, index);
  +  }
   
     /**
      *  The number of nodes in the list. The range of valid child node indices
  @@ -454,10 +472,19 @@
      */
     public int getLength()
     {
  -
  -    resetToCachedList();
   
  -    return m_cachedNodes.getLength();
  +    // resetToCachedList();
  +    if(m_last > 0)
  +      return m_last;
  +    else if(null == m_cachedNodes || !m_foundLast)
  +    {
  +      m_last = getLastPos(m_execContext);
  +    }
  +    else
  +    {
  +      m_last = m_cachedNodes.getLength();
  +    }
  +    return m_last;
     }
   
     /**
  @@ -466,7 +493,7 @@
      */
     private void resetToCachedList()
     {
  -
  +    // %TBD% ? This doesn't seem to work so well...
       int pos = this.getCurrentPos();
   
       if ((null == m_cachedNodes) || (pos != 0))
  @@ -970,7 +997,7 @@
      */
     public int getLast()
     {
  -    return m_last;
  +    return getLength();
     }
   
     /**
  @@ -1104,7 +1131,7 @@
     // ObjectPool m_pool = new ObjectPool(this.getClass());
   
     /** The last node that was fetched, usually by nextNode. */
  -  transient public int m_lastFetched;
  +  transient public int m_lastFetched = DTM.NULL;
   
     /**
      * If this iterator needs to cache nodes that are fetched, they
  @@ -1133,7 +1160,7 @@
      * The context node for this iterator, which doesn't change through
      * the course of the iteration.
      */
  -  transient protected int m_context;
  +  transient protected int m_context = DTM.NULL;
   
     /**
      * The node context from where the expression is being
  @@ -1141,7 +1168,7 @@
      * from m_context in that this is the context for the entire
      * expression, rather than the context for the subexpression.
      */
  -  transient protected int m_currentContextNode;
  +  transient protected int m_currentContextNode = DTM.NULL;
   
     /**
      * Fast access to the current prefix resolver.  It isn't really
  
  
  
  1.4.2.2   +12 -4     
xml-xalan/java/src/org/apache/xpath/axes/NamespaceWalker.java
  
  Index: NamespaceWalker.java
  ===================================================================
  RCS file: 
/home/cvs/xml-xalan/java/src/org/apache/xpath/axes/NamespaceWalker.java,v
  retrieving revision 1.4.2.1
  retrieving revision 1.4.2.2
  diff -u -r1.4.2.1 -r1.4.2.2
  --- NamespaceWalker.java      2001/04/10 18:45:17     1.4.2.1
  +++ NamespaceWalker.java      2001/05/06 02:09:51     1.4.2.2
  @@ -116,9 +116,11 @@
   
       if (m_root == m_currentNode)
       {
  -
  -      // System.out.println("ChildWalker - Calling getFirstChild");
  -      return 
setCurrentIfNotNull(getDTM(m_root).getFirstNamespaceNode(m_currentNode, true));
  +      DTM dtm = getDTM(m_root);
  +      // System.out.println("NamespaceWalker - Calling 
getFirstNamespaceNode: "+dtm.getNodeName(m_currentNode));
  +      int nsNode = dtm.getFirstNamespaceNode(m_currentNode, true);
  +      
  +      return setCurrentIfNotNull(nsNode);
       }
       else
         return DTM.NULL;
  @@ -135,7 +137,13 @@
     {
   
       if (m_root != m_currentNode)
  -      return 
setCurrentIfNotNull(getDTM(m_root).getNextNamespaceNode(m_currentNode, true));
  +    {
  +      DTM dtm = getDTM(m_root);
  +      // System.out.println("NamespaceWalker - Calling getNextNamespaceNode: 
"+dtm.getNodeName(m_currentNode));
  +      int nsNode = dtm.getNextNamespaceNode(m_root, m_currentNode, true);
  +      
  +      return setCurrentIfNotNull(nsNode);
  +    }
       else
         return DTM.NULL;
     }
  
  
  
  1.10.2.2  +1 -1      
xml-xalan/java/src/org/apache/xpath/axes/PrecedingWalker.java
  
  Index: PrecedingWalker.java
  ===================================================================
  RCS file: 
/home/cvs/xml-xalan/java/src/org/apache/xpath/axes/PrecedingWalker.java,v
  retrieving revision 1.10.2.1
  retrieving revision 1.10.2.2
  diff -u -r1.10.2.1 -r1.10.2.2
  --- PrecedingWalker.java      2001/04/10 18:45:17     1.10.2.1
  +++ PrecedingWalker.java      2001/05/06 02:09:51     1.10.2.2
  @@ -271,7 +271,7 @@
     }
   
     /** The document owner node.  */
  -  transient int m_doc;
  +  transient int m_doc = DTM.NULL;
   
     /**
      * Tell what's the maximum level this axes can descend to.
  
  
  
  1.3.2.2   +5 -7      
xml-xalan/java/src/org/apache/xpath/axes/PredicatedNodeTest.java
  
  Index: PredicatedNodeTest.java
  ===================================================================
  RCS file: 
/home/cvs/xml-xalan/java/src/org/apache/xpath/axes/PredicatedNodeTest.java,v
  retrieving revision 1.3.2.1
  retrieving revision 1.3.2.2
  diff -u -r1.3.2.1 -r1.3.2.2
  --- PredicatedNodeTest.java   2001/04/10 18:45:18     1.3.2.1
  +++ PredicatedNodeTest.java   2001/05/06 02:09:51     1.3.2.2
  @@ -354,16 +354,14 @@
      */
     protected String nodeToString(int n)
     {
  -    DTM dtm = m_lpi.getXPathContext().getDTM(n);
  -    try
  +    if(DTM.NULL != n)
       {
  -      return (DTM.NULL != n)
  -             ? dtm.getNodeName(n) + "{" + n + "}"
  -             : "null";
  +      DTM dtm = m_lpi.getXPathContext().getDTM(n);
  +      return dtm.getNodeName(n) + "{" + (n+1) + "}";
       }
  -    catch (ClassCastException cce)
  +    else
       {
  -      return (DTM.NULL != n) ? dtm.getNodeName(n) : "null";
  +      return "null";
       }
     }
     
  
  
  
  1.6.2.2   +1 -0      
xml-xalan/java/src/org/apache/xpath/axes/ReverseAxesWalker.java
  
  Index: ReverseAxesWalker.java
  ===================================================================
  RCS file: 
/home/cvs/xml-xalan/java/src/org/apache/xpath/axes/ReverseAxesWalker.java,v
  retrieving revision 1.6.2.1
  retrieving revision 1.6.2.2
  diff -u -r1.6.2.1 -r1.6.2.2
  --- ReverseAxesWalker.java    2001/04/10 18:45:18     1.6.2.1
  +++ ReverseAxesWalker.java    2001/05/06 02:09:51     1.6.2.2
  @@ -226,6 +226,7 @@
       }
   
       // System.out.println("getLastPos - pos: "+count);
  +    // System.out.println("pos (ReverseAxesWalker): "+count);
       return count;
     }
   }
  
  
  
  1.15.2.2  +27 -12    
xml-xalan/java/src/org/apache/xpath/axes/UnionPathIterator.java
  
  Index: UnionPathIterator.java
  ===================================================================
  RCS file: 
/home/cvs/xml-xalan/java/src/org/apache/xpath/axes/UnionPathIterator.java,v
  retrieving revision 1.15.2.1
  retrieving revision 1.15.2.2
  diff -u -r1.15.2.1 -r1.15.2.2
  --- UnionPathIterator.java    2001/04/10 18:45:19     1.15.2.1
  +++ UnionPathIterator.java    2001/05/06 02:09:51     1.15.2.2
  @@ -515,7 +515,7 @@
     }
   
     /** The last node that was fetched, usually by nextNode. */
  -  transient int m_lastFetched;
  +  transient int m_lastFetched = DTM.NULL;
   
     /**
      *  Returns the next node in the set and advances the position of the
  @@ -644,11 +644,10 @@
     public int getLength()
     {
   
  -    // %TBD%
  -    return 0;
  +    // %TBD% ??
   //    resetToCachedList();
  -//
  -//    return m_cachedNodes.getLength();
  +
  +    return m_cachedNodes.getLength();
     }
   
     /**
  @@ -662,11 +661,27 @@
      */
     public int item(int index)
     {
  -    // %TBD%
  -    return DTM.NULL;
  -//    resetToCachedList();
  -//
  -//    return m_cachedNodes.item(index);
  +    // resetToCachedList(); %TBD% ??
  +
  +    return m_cachedNodes.item(index);
  +  }
  +  
  +  /**
  +   * Sets the node at the specified index of this vector to be the
  +   * specified node. The previous component at that position is discarded.
  +   *
  +   * <p>The index must be a value greater than or equal to 0 and less
  +   * than the current size of the vector.  
  +   * The iterator must be in cached mode.</p>
  +   * 
  +   * <p>Meant to be used for sorted iterators.</p>
  +   *
  +   * @param node Node to set
  +   * @param index Index of where to set the node
  +   */
  +  public void setItem(int node, int index)
  +  {
  +    m_cachedNodes.setElementAt(node, index);
     }
     
     /**
  @@ -732,13 +747,13 @@
     /**
      * The node context for the expression.
      */
  -  transient protected int m_context;
  +  transient protected int m_context = DTM.NULL;
   
     /**
      * The node context from where the Location Path is being
      * executed from (i.e. for current() support).
      */
  -  transient protected int m_currentContextNode;
  +  transient protected int m_currentContextNode = DTM.NULL;
     
     /**
      * Get an instance of a DTM that "owns" a node handle.  Since a node 
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.23.2.1  +22 -21    
xml-xalan/java/src/org/apache/xpath/compiler/Compiler.java
  
  Index: Compiler.java
  ===================================================================
  RCS file: 
/home/cvs/xml-xalan/java/src/org/apache/xpath/compiler/Compiler.java,v
  retrieving revision 1.23
  retrieving revision 1.23.2.1
  diff -u -r1.23 -r1.23.2.1
  --- Compiler.java     2001/03/16 22:17:32     1.23
  +++ Compiler.java     2001/05/06 02:09:53     1.23.2.1
  @@ -88,11 +88,12 @@
   import javax.xml.transform.TransformerConfigurationException;
   import javax.xml.transform.SourceLocator;
   import org.apache.xml.utils.SAXSourceLocator;
  +import org.apache.xml.dtm.DTMFilter;
   
   import javax.xml.transform.ErrorListener;
   import javax.xml.transform.TransformerException;
   
  -import org.w3c.dom.traversal.NodeFilter;
  +// import org.w3c.dom.traversal.NodeFilter;
   
   /**
    * <meta name="usage" content="advanced"/>
  @@ -774,58 +775,58 @@
       switch (testType)
       {
       case OpCodes.NODETYPE_COMMENT :
  -      return NodeFilter.SHOW_COMMENT;
  +      return DTMFilter.SHOW_COMMENT;
       case OpCodes.NODETYPE_TEXT :
  -//      return NodeFilter.SHOW_TEXT | NodeFilter.SHOW_COMMENT;
  -      return NodeFilter.SHOW_TEXT | NodeFilter.SHOW_CDATA_SECTION ;
  +//      return DTMFilter.SHOW_TEXT | DTMFilter.SHOW_COMMENT;
  +      return DTMFilter.SHOW_TEXT | DTMFilter.SHOW_CDATA_SECTION ;
       case OpCodes.NODETYPE_PI :
  -      return NodeFilter.SHOW_PROCESSING_INSTRUCTION;
  +      return DTMFilter.SHOW_PROCESSING_INSTRUCTION;
       case OpCodes.NODETYPE_NODE :
  -//      return NodeFilter.SHOW_ALL;
  +//      return DTMFilter.SHOW_ALL;
         switch (axesType)
         {
         case OpCodes.FROM_NAMESPACE:
  -        return NodeFilter.SHOW_ATTRIBUTE | NodeTest.SHOW_NAMESPACE;
  +        return DTMFilter.SHOW_ATTRIBUTE | DTMFilter.SHOW_NAMESPACE;
         case OpCodes.FROM_ATTRIBUTES :
         case OpCodes.MATCH_ATTRIBUTE :
  -        return NodeFilter.SHOW_ATTRIBUTE;
  +        return DTMFilter.SHOW_ATTRIBUTE;
         case OpCodes.FROM_SELF:
         case OpCodes.FROM_ANCESTORS_OR_SELF:
         case OpCodes.FROM_DESCENDANTS_OR_SELF:
  -        return NodeFilter.SHOW_ALL;
  +        return DTMFilter.SHOW_ALL;
         default:
           if (getOp(0) == OpCodes.OP_MATCHPATTERN)
  -          return ~NodeFilter.SHOW_ATTRIBUTE
  -                  & ~NodeFilter.SHOW_DOCUMENT
  -                  & ~NodeFilter.SHOW_DOCUMENT_FRAGMENT;
  +          return ~DTMFilter.SHOW_ATTRIBUTE
  +                  & ~DTMFilter.SHOW_DOCUMENT
  +                  & ~DTMFilter.SHOW_DOCUMENT_FRAGMENT;
           else
  -          return ~NodeFilter.SHOW_ATTRIBUTE;
  +          return ~DTMFilter.SHOW_ATTRIBUTE;
         }
       case OpCodes.NODETYPE_ROOT :
  -      return NodeFilter.SHOW_DOCUMENT | NodeFilter.SHOW_DOCUMENT_FRAGMENT;
  +      return DTMFilter.SHOW_DOCUMENT | DTMFilter.SHOW_DOCUMENT_FRAGMENT;
       case OpCodes.NODETYPE_FUNCTEST :
         return NodeTest.SHOW_BYFUNCTION;
       case OpCodes.NODENAME :
         switch (axesType)
         {
         case OpCodes.FROM_NAMESPACE :
  -        return NodeFilter.SHOW_ATTRIBUTE | NodeTest.SHOW_NAMESPACE;
  +        return DTMFilter.SHOW_ATTRIBUTE | DTMFilter.SHOW_NAMESPACE;
         case OpCodes.FROM_ATTRIBUTES :
         case OpCodes.MATCH_ATTRIBUTE :
  -        return NodeFilter.SHOW_ATTRIBUTE;
  +        return DTMFilter.SHOW_ATTRIBUTE;
   
         // break;
         case OpCodes.MATCH_ANY_ANCESTOR :
         case OpCodes.MATCH_IMMEDIATE_ANCESTOR :
  -        return NodeFilter.SHOW_ELEMENT;
  +        return DTMFilter.SHOW_ELEMENT;
   
         // break;
         default :
  -        return NodeFilter.SHOW_ELEMENT;
  +        return DTMFilter.SHOW_ELEMENT;
         }
       default :
         // System.err.println("We should never reach here.");
  -      return NodeFilter.SHOW_ALL;
  +      return DTMFilter.SHOW_ALL;
       }
     }
   
  @@ -869,12 +870,12 @@
       case OpCodes.FROM_ROOT :
         argLen = getArgLengthOfStep(opPos);
         opPos = getFirstChildPosOfStep(opPos);
  -      pattern = new StepPattern(NodeFilter.SHOW_DOCUMENT | 
NodeFilter.SHOW_DOCUMENT_FRAGMENT);
  +      pattern = new StepPattern(DTMFilter.SHOW_DOCUMENT | 
DTMFilter.SHOW_DOCUMENT_FRAGMENT);
         break;
       case OpCodes.MATCH_ATTRIBUTE :
         argLen = getArgLengthOfStep(opPos);
         opPos = getFirstChildPosOfStep(opPos);
  -      pattern = new StepPattern(NodeFilter.SHOW_ATTRIBUTE,
  +      pattern = new StepPattern(DTMFilter.SHOW_ATTRIBUTE,
                                   getStepNS(startOpPos),
                                   getStepLocalName(startOpPos));
         break;
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.5.2.2   +1 -1      
xml-xalan/java/src/org/apache/xpath/functions/FuncCurrent.java
  
  Index: FuncCurrent.java
  ===================================================================
  RCS file: 
/home/cvs/xml-xalan/java/src/org/apache/xpath/functions/FuncCurrent.java,v
  retrieving revision 1.5.2.1
  retrieving revision 1.5.2.2
  diff -u -r1.5.2.1 -r1.5.2.2
  --- FuncCurrent.java  2001/04/10 18:45:28     1.5.2.1
  +++ FuncCurrent.java  2001/05/06 02:09:54     1.5.2.2
  @@ -129,6 +129,6 @@
           currentNode = DTM.NULL;
       }
   
  -    return new XNodeSet(currentNode);
  +    return new XNodeSet(currentNode, xctxt.getDTMManager());
     }
   }
  
  
  
  1.6.2.2   +1 -1      xml-xalan/java/src/org/apache/xpath/functions/FuncId.java
  
  Index: FuncId.java
  ===================================================================
  RCS file: 
/home/cvs/xml-xalan/java/src/org/apache/xpath/functions/FuncId.java,v
  retrieving revision 1.6.2.1
  retrieving revision 1.6.2.2
  diff -u -r1.6.2.1 -r1.6.2.2
  --- FuncId.java       2001/04/10 18:45:30     1.6.2.1
  +++ FuncId.java       2001/05/06 02:09:54     1.6.2.2
  @@ -159,7 +159,7 @@
   
       XObject arg = m_arg0.execute(xctxt);
       int argType = arg.getType();
  -    XNodeSet nodes = new XNodeSet();
  +    XNodeSet nodes = new XNodeSet(xctxt.getDTMManager());
       NodeSet nodeSet = nodes.mutableNodeset();
   
       if (XObject.CLASS_NODESET == argType)
  
  
  
  1.6.2.2   +5 -40     
xml-xalan/java/src/org/apache/xpath/functions/FuncLast.java
  
  Index: FuncLast.java
  ===================================================================
  RCS file: 
/home/cvs/xml-xalan/java/src/org/apache/xpath/functions/FuncLast.java,v
  retrieving revision 1.6.2.1
  retrieving revision 1.6.2.2
  diff -u -r1.6.2.1 -r1.6.2.2
  --- FuncLast.java     2001/04/10 18:45:30     1.6.2.1
  +++ FuncLast.java     2001/05/06 02:09:54     1.6.2.2
  @@ -95,50 +95,13 @@
       // assert(null != m_contextNodeList, "m_contextNodeList must be 
non-null");
       // If we're in a predicate, then this will return non-null.
       SubContextList iter = xctxt.getSubContextList();
  -
  +    // System.out.println("iter: "+iter);
       if (null != iter)
         return iter.getLastPos(xctxt);
   
       DTMIterator cnl = xctxt.getContextNodeList();
  -
  -    // %TBD%
  -//    if (cnl.size() == 0)
  -    {
  -      try
  -      {
  -        DTMIterator ni = (DTMIterator)cnl.clone();
  -        int count = cnl.getCurrentPos();
  -        while(DTM.NULL != ni.nextNode())
  -          count++;
  -        // %TBD%
  -//        cnl.setLast(count);
  -        return count;
  -      }
  -      catch(CloneNotSupportedException cnse){}
  -    }
  -    // %REVIEW%
  +    
       return cnl.getLength();
  -//    return cnl.size();
  -
  -    /*
  -    // The code below has massive problem if inside of a predicate.  -sb
  -    if (cnl.size() == 0)
  -    {
  -      int currentPos = cnl.getCurrentPos();
  -
  -      // This has problems if inside a predicate.  For now, just clone.
  -      if (!cnl.isFresh())
  -        cnl.reset();
  -
  -      cnl.setShouldCacheNodes(true);
  -      cnl.runTo(-1);
  -      cnl.setCurrentPos(currentPos);
  -      System.out.println("cnl.getCurrentPos() after: "+cnl.getCurrentPos());
  -    }
  -
  -    // System.out.println("cnl.size(): "+cnl.size());
  -    return cnl.size();
  -    */
     }
   
     /**
  @@ -151,6 +114,8 @@
      */
     public XObject execute(XPathContext xctxt) throws 
javax.xml.transform.TransformerException
     {
  -    return new XNumber((double) getCountOfContextNodeList(xctxt));
  +    XNumber xnum = new XNumber((double) getCountOfContextNodeList(xctxt));
  +    // System.out.println("last: "+xnum.num());
  +    return xnum;
     }
   }
  
  
  
  1.5.2.2   +32 -7     
xml-xalan/java/src/org/apache/xpath/functions/FunctionDef1Arg.java
  
  Index: FunctionDef1Arg.java
  ===================================================================
  RCS file: 
/home/cvs/xml-xalan/java/src/org/apache/xpath/functions/FunctionDef1Arg.java,v
  retrieving revision 1.5.2.1
  retrieving revision 1.5.2.2
  diff -u -r1.5.2.1 -r1.5.2.2
  --- FunctionDef1Arg.java      2001/04/10 18:45:34     1.5.2.1
  +++ FunctionDef1Arg.java      2001/05/06 02:09:54     1.5.2.2
  @@ -61,7 +61,10 @@
   import org.apache.xpath.XPathContext;
   import org.apache.xpath.objects.XNodeSet;
   import org.apache.xpath.objects.XNumber;
  +import org.apache.xpath.objects.XString;
   
  +import org.apache.xml.dtm.DTM;
  +
   /**
    * <meta name="usage" content="advanced"/>
    * Base class for functions that accept one argument that can be defaulted if
  @@ -107,10 +110,20 @@
     protected String getArg0AsString(XPathContext xctxt)
             throws javax.xml.transform.TransformerException
     {
  -
  -    return (null == m_arg0)
  -           ? XNodeSet.getStringFromNode(xctxt.getCurrentNode())
  -           : m_arg0.execute(xctxt).str();
  +    if(null == m_arg0)
  +    {
  +      int currentNode = xctxt.getCurrentNode();
  +      if(DTM.NULL == currentNode)
  +        return "";
  +      else
  +      {
  +        DTM dtm = xctxt.getDTM(currentNode);
  +        return dtm.getStringValue(currentNode);
  +      }
  +      
  +    }
  +    else
  +      return m_arg0.execute(xctxt).str();   
     }
   
     /**
  @@ -130,9 +143,21 @@
             throws javax.xml.transform.TransformerException
     {
   
  -    return (null == m_arg0)
  -           ? XNodeSet.getNumberFromNode(xctxt.getCurrentNode())
  -           : m_arg0.execute(xctxt).num();
  +    if(null == m_arg0)
  +    {
  +      int currentNode = xctxt.getCurrentNode();
  +      if(DTM.NULL == currentNode)
  +        return 0;
  +      else
  +      {
  +        DTM dtm = xctxt.getDTM(currentNode);
  +        String str = dtm.getStringValue(currentNode);
  +        return XString.castToNum(str);
  +      }
  +      
  +    }
  +    else
  +      return m_arg0.execute(xctxt).num();
     }
   
     /**
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.10.2.2  +24 -23    xml-xalan/java/src/org/apache/xpath/objects/XNodeSet.java
  
  Index: XNodeSet.java
  ===================================================================
  RCS file: 
/home/cvs/xml-xalan/java/src/org/apache/xpath/objects/XNodeSet.java,v
  retrieving revision 1.10.2.1
  retrieving revision 1.10.2.2
  diff -u -r1.10.2.1 -r1.10.2.2
  --- XNodeSet.java     2001/04/10 18:45:43     1.10.2.1
  +++ XNodeSet.java     2001/05/06 02:09:56     1.10.2.2
  @@ -63,6 +63,7 @@
   
   import org.apache.xml.dtm.DTM;
   import org.apache.xml.dtm.DTMIterator;
  +import org.apache.xml.dtm.DTMManager;
   
   import org.apache.xpath.DOMHelper;
   import org.apache.xpath.XPathContext;
  @@ -77,6 +78,12 @@
    */
   public class XNodeSet extends XObject
   {
  +  private DTMManager m_dtmMgr;
  +  
  +  public DTMManager getDTMMgr()
  +  {
  +    return m_dtmMgr;
  +  }
   
     /**
      * Construct a XNodeSet object.
  @@ -86,14 +93,16 @@
     public XNodeSet(DTMIterator val)
     {
       super(val);
  +    m_dtmMgr = val.getDTMManager();
     }
   
     /**
      * Construct an empty XNodeSet object.
      */
  -  public XNodeSet()
  +  public XNodeSet(DTMManager dtmMgr)
     {
       super(new NodeSet());
  +    m_dtmMgr = dtmMgr;
     }
   
     /**
  @@ -101,10 +110,11 @@
      *
      * @param n Node to add to the new XNodeSet object
      */
  -  public XNodeSet(int n)
  +  public XNodeSet(int n, DTMManager dtmMgr)
     {
   
       super(new NodeSet());
  +    m_dtmMgr = dtmMgr;
   
       if (DTM.NULL != n)
       {
  @@ -140,7 +150,7 @@
      *
      * @return numeric value of the string conversion from a single node.
      */
  -  public static double getNumberFromNode(int n)
  +  public double getNumberFromNode(int n)
     {
       return XString.castToNum(getStringFromNode(n));
     }
  @@ -169,7 +179,7 @@
     {
       return (nodeset().nextNode() != DTM.NULL);
     }
  -
  +  
     /**
      * Get the string conversion from a single node.
      *
  @@ -177,27 +187,18 @@
      *
      * @return the string conversion from a single node.
      */
  -  public static String getStringFromNode(int n)
  +  public String getStringFromNode(int n)
     {
  -
  -    // %TBD%
  +    // %OPT%
       // I guess we'll have to get a static instance of the DTM manager...
  -    return null;
  -//    switch (n.getNodeType())
  -//    {
  -//    case DTM.ELEMENT_NODE :
  -//    case DTM.DOCUMENT_NODE :
  -//      return DOMHelper.getNodeData(n);
  -//    case DTM.CDATA_SECTION_NODE :
  -//    case DTM.TEXT_NODE :
  -//      return ((Text) n).getData();
  -//    case DTM.COMMENT_NODE :
  -//    case DTM.PROCESSING_INSTRUCTION_NODE :
  -//    case DTM.ATTRIBUTE_NODE :
  -//      return n.getNodeValue();
  -//    default :
  -//      return DOMHelper.getNodeData(n);
  -//    }
  +    if(DTM.NULL != n)
  +    {
  +      return m_dtmMgr.getDTM(n).getStringValue(n);
  +    }
  +    else
  +    {
  +      return "";
  +    }
     }
   
     /**
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.9.2.1   +1 -1      
xml-xalan/java/src/org/apache/xpath/operations/Variable.java
  
  Index: Variable.java
  ===================================================================
  RCS file: 
/home/cvs/xml-xalan/java/src/org/apache/xpath/operations/Variable.java,v
  retrieving revision 1.9
  retrieving revision 1.9.2.1
  diff -u -r1.9 -r1.9.2.1
  --- Variable.java     2001/01/02 03:47:18     1.9
  +++ Variable.java     2001/05/06 02:09:56     1.9.2.1
  @@ -125,7 +125,7 @@
   //      error(xctxt, XPATHErrorResources.ER_COULDNOT_GET_VAR_NAMED,
   //            new Object[]{ m_qname.getLocalPart() });  //"Could not get 
variable named "+varName);
         
  -      result = new XNodeSet();
  +      result = new XNodeSet(xctxt.getDTMManager());
       }
   
       return result;
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.20.2.3  +5 -30     
xml-xalan/java/src/org/apache/xpath/patterns/NodeTest.java
  
  Index: NodeTest.java
  ===================================================================
  RCS file: 
/home/cvs/xml-xalan/java/src/org/apache/xpath/patterns/NodeTest.java,v
  retrieving revision 1.20.2.2
  retrieving revision 1.20.2.3
  diff -u -r1.20.2.2 -r1.20.2.3
  --- NodeTest.java     2001/04/10 18:45:46     1.20.2.2
  +++ NodeTest.java     2001/05/06 02:09:57     1.20.2.3
  @@ -91,10 +91,6 @@
      */
     protected int m_whatToShow;
   
  -  /** This bit specifies a namespace, and extends the SHOW_XXX stuff 
  -   *  in [EMAIL PROTECTED] org.w3c.dom.traversal.NodeFilter}. */
  -  public static final int SHOW_NAMESPACE = 0x00001000;
  -
     /**
      * Special bitmap for match patterns starting with a function.
      * Make sure this does not conflict with [EMAIL PROTECTED] 
org.w3c.dom.traversal.NodeFilter}.
  @@ -458,32 +454,13 @@
       // namespace declarations. The node test will be true for any node 
       // of the principal type whose expanded name has the URI to which 
       // the prefix expands, regardless of the local part of the name."
  -    case DTMFilter.SHOW_ATTRIBUTE :
  +    case DTMFilter.SHOW_NAMESPACE :
       {
  -      int isNamespace = (m_whatToShow & SHOW_NAMESPACE);
  -
  -      if (0 == isNamespace)
  -      {
  -        if (!(DTM.NAMESPACE_NODE == dtm.getNodeType(context)))
  -          return (m_isTotallyWild || 
(subPartMatchNS(dtm.getNamespaceURI(context), 
  -                  m_namespace) && 
  -                  subPartMatch(dtm.getLocalName(context), m_name)))
  -                 ? m_score : SCORE_NONE;
  -        else
  -          return SCORE_NONE;
  -      }
  -      else
  -      {
  -        if (DTM.NAMESPACE_NODE == dtm.getNodeType(context))
  -        {
  -          String ns = dtm.getNodeValue(context);
  +      String ns = dtm.getNodeValue(context);
   
  -          return (subPartMatch(ns, m_name)) ? m_score : SCORE_NONE;
  -        }
  -        else
  -          return SCORE_NONE;
  -      }
  +      return (subPartMatch(ns, m_name)) ? m_score : SCORE_NONE;
       }
  +    case DTMFilter.SHOW_ATTRIBUTE :
       case DTMFilter.SHOW_ELEMENT :
       {
         return (m_isTotallyWild || 
(subPartMatchNS(dtm.getNamespaceURI(context), m_namespace) 
  @@ -511,8 +488,6 @@
     public XObject execute(XPathContext xctxt)
             throws javax.xml.transform.TransformerException
     {
  -    // %TBD%
  -//    return execute(xctxt, xctxt.getCurrentNode());
  -    return null;
  +    return execute(xctxt, xctxt.getCurrentNode());
     }
   }
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to