You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xalan.apache.org by mk...@apache.org on 2003/04/03 18:48:12 UTC

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

mkwan       2003/04/03 08:48:12

  Modified:    java/src/org/apache/xalan/xsltc/dom
                        AdaptiveResultTreeImpl.java SAXImpl.java
                        SimpleResultTreeImpl.java
               java/src/org/apache/xml/dtm/ref/sax2dtm SAX2DTM2.java
  Log:
  Javadocs updates.
  
  Revision  Changes    Path
  1.3       +10 -10    xml-xalan/java/src/org/apache/xalan/xsltc/dom/AdaptiveResultTreeImpl.java
  
  Index: AdaptiveResultTreeImpl.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xalan/xsltc/dom/AdaptiveResultTreeImpl.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- AdaptiveResultTreeImpl.java	1 Apr 2003 21:39:16 -0000	1.2
  +++ AdaptiveResultTreeImpl.java	3 Apr 2003 16:48:10 -0000	1.3
  @@ -78,30 +78,30 @@
   /**
    * AdaptiveResultTreeImpl is a adaptive DOM model for result tree fragments (RTF). It is
    * used in the case where the RTF is likely to be pure text yet it can still be a DOM tree. 
  - * It is designed for RTFs which have <xsl:call-template> or <xsl:apply-templates> in 
  + * It is designed for RTFs which have &lt;xsl:call-template&gt; or &lt;xsl:apply-templates&gt; in 
    * the contents. Example:
    * <pre>
  - *    <xsl:variable name = "x">
  - *      <xsl:call-template name = "test">
  - *         <xsl:with-param name="a" select="."/>
  - *      </xsl:call-template>
  - *    </xsl:variable>
  + *    &lt;xsl:variable name = "x"&gt;
  + *      &lt;xsl:call-template name = "test"&gt;
  + *         &lt;xsl:with-param name="a" select="."/&gt;
  + *      &lt;/xsl:call-template&gt;
  + *    &lt;/xsl:variable>
    * </pre>
  - * In this example the result produced by <xsl:call-template> is likely to be a single
  + * <p>In this example the result produced by <xsl:call-template> is likely to be a single
    * Text node. But it can also be a DOM tree. This kind of RTF cannot be modelled by 
    * SimpleResultTreeImpl. 
  - *
  + * <p>
    * AdaptiveResultTreeImpl can be considered as a smart switcher between SimpleResultTreeImpl
    * and SAXImpl. It treats the RTF as simple Text and uses the SimpleResultTreeImpl model
    * at the beginning. However, if it receives a call which indicates that this is a DOM tree
    * (e.g. startElement), it will automatically transform itself into a wrapper around a 
    * SAXImpl. In this way we can have a light-weight model when the result only contains
    * simple text, while at the same time it still works when the RTF is a DOM tree.
  - *
  + * <p>
    * All methods in this class are overridden to delegate the action to the wrapped SAXImpl object
    * if it is non-null, or delegate the action to the SimpleResultTreeImpl if there is no
    * wrapped SAXImpl.
  - *
  + * <p>
    * %REVISIT% Can we combine this class with SimpleResultTreeImpl? I think it is possible, but
    * it will make SimpleResultTreeImpl more expensive. I will use two separate classes at 
    * this time.
  
  
  
  1.3       +15 -5     xml-xalan/java/src/org/apache/xalan/xsltc/dom/SAXImpl.java
  
  Index: SAXImpl.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xalan/xsltc/dom/SAXImpl.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- SAXImpl.java	1 Apr 2003 21:39:17 -0000	1.2
  +++ SAXImpl.java	3 Apr 2003 16:48:11 -0000	1.3
  @@ -88,7 +88,6 @@
   import org.apache.xml.serializer.SerializationHandler;
   import org.apache.xml.serializer.ToXMLSAXHandler;
   import org.apache.xml.utils.XMLStringFactory;
  -import org.w3c.dom.DOMException;
   import org.w3c.dom.Node;
   import org.w3c.dom.NodeList;
   import org.w3c.dom.Document;
  @@ -100,6 +99,18 @@
   import org.xml.sax.SAXException;
   
   
  +/**
  + * SAXImpl is the core model for SAX input source. SAXImpl objects are
  + * usually created from an XSLTCDTMManager.
  + *
  + * <p>DOMSource inputs are handled using DOM2SAX + SAXImpl. SAXImpl has a
  + * few specific fields (e.g. _node2Ids, _document) to keep DOM-related
  + * information. They are used when the processing behavior between DOM and
  + * SAX has to be different. Examples of these include id function and 
  + * unparsed entity.
  + *
  + * <p>SAXImpl extends SAX2DTM2 instead of SAX2DTM for better performance.
  + */
   public final class SAXImpl extends SAX2DTM2 implements DOM, DOMBuilder
   {
       
  @@ -1461,9 +1472,8 @@
       }
       
       /**
  -     * Returns a DOMBuilder class wrapped in a SAX adapter.
  -     * I am not sure if we need this one anymore now that the
  -     * DOM builder's interface is pure SAX2 (must investigate)
  +     * Return a SerializationHandler for output handling.
  +     * This method is used by Result Tree Fragments.
        */
       public SerializationHandler getOutputDomBuilder()
       {
  
  
  
  1.3       +2 -2      xml-xalan/java/src/org/apache/xalan/xsltc/dom/SimpleResultTreeImpl.java
  
  Index: SimpleResultTreeImpl.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xalan/xsltc/dom/SimpleResultTreeImpl.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- SimpleResultTreeImpl.java	1 Apr 2003 21:39:17 -0000	1.2
  +++ SimpleResultTreeImpl.java	3 Apr 2003 16:48:11 -0000	1.3
  @@ -83,12 +83,12 @@
    * A simple RTF is an RTF that has only one Text node. The Text node can be produced by a
    * combination of Text, xsl:value-of and xsl:number instructions. It can also be produced
    * by a control structure (xsl:if or xsl:choose) whose body is pure Text.
  - *
  + * <p>
    * A SimpleResultTreeImpl has only two nodes, i.e. the ROOT node and its Text child. All DOM
    * interfaces are overridden with this in mind. For example, the getStringValue() interface
    * returns the value of the Text node. This class receives the character data from the 
    * characters() interface.
  - *
  + * <p>
    * This class implements DOM and SerializationHandler. It also implements the DTM interface
    * for support in MultiDOM. The nested iterators (SimpleIterator and SingletonIterator) are
    * used to support the nodeset() extension function.
  
  
  
  1.3       +22 -22    xml-xalan/java/src/org/apache/xml/dtm/ref/sax2dtm/SAX2DTM2.java
  
  Index: SAX2DTM2.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xml/dtm/ref/sax2dtm/SAX2DTM2.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- SAX2DTM2.java	1 Apr 2003 18:56:03 -0000	1.2
  +++ SAX2DTM2.java	3 Apr 2003 16:48:11 -0000	1.3
  @@ -76,20 +76,20 @@
    * and DTMDefaultBase are overridden in SAX2DTM2 in order to allow fast, efficient 
    * access to the DTM model. Some nested iterators in DTMDefaultBaseIterators
    * are also overridden in SAX2DTM2 for performance reasons.
  - *
  + * <p>
    * Performance is the biggest consideration in the design of SAX2DTM2. To make the code most 
    * efficient, the incremental support is dropped in SAX2DTM2, which means that you should not
    * use it in incremental situation. To reduce the overhead of pulling data from the DTM model,
    * a few core interfaces in SAX2DTM2 have direct access to the internal arrays of the
    * SuballocatedIntVectors.
  - * 
  + * <p>
    * The design of SAX2DTM2 may limit its extensibilty. If you have a reason to extend the
    * SAX2DTM model, please extend from SAX2DTM instead of this class.
  - *
  + * <p>
    * TODO: This class is currently only used by XSLTC. We need to investigate the possibility
    * of also using it in Xalan-J Interpretive. Xalan's performance is likely to get an instant 
    * boost if we use SAX2DTM2 instead of SAX2DTM in non-incremental case.
  - *
  + * <p>
    * %MK% The code in this class is critical to the XSLTC_DTM performance. Be very careful
    * when making changes here!
    */
  @@ -109,7 +109,7 @@
       /**
        * Setting start to END should 'close' the iterator,
        * i.e. subsequent call to next() should return END.
  -     *
  +     * <p>
        * If the iterator is not restartable, this has no effect.
        * %REVIEW% Should it return/throw something in that case,
        * or set current node to END, to indicate request-not-honored?
  @@ -1927,7 +1927,7 @@
     /**
      * Override DTMDefaultBase._exptype() by dropping the incremental code.
      * 
  -   * This one is less efficient than _exptype2. It is only used during
  +   * <p>This one is less efficient than _exptype2. It is only used during
      * DTM building. _exptype2 is used after the document is fully built.
      */
     public final int _exptype(int identity)
  @@ -2018,7 +2018,7 @@
     /**
      * The optimized version of DTMDefaultBase.getExpandedTypeID(int).
      *
  -   * This one is only used by DOMAdapter.getExpandedTypeID(int), which
  +   * <p>This one is only used by DOMAdapter.getExpandedTypeID(int), which
      * is mostly called from the compiled translets.
      */
     public final int getExpandedTypeID2(int nodeHandle)
  @@ -2076,7 +2076,7 @@
     /**
      * Override SAX2DTM.startElement()
      *
  -   * Receive notification of the start of an element.
  +   * <p>Receive notification of the start of an element.
      *
      * <p>By default, do nothing.  Application writers may override this
      * method in a subclass to take specific actions at the start of
  @@ -2459,7 +2459,7 @@
   
     /**
      * Override the processingInstruction() interface in SAX2DTM2.
  -   * 
  +   * <p>
      * %OPT% This one is different from SAX2DTM.processingInstruction()
      * in that we do not use extended types for PI nodes. The name of
      * the PI is saved in the DTMStringPool.
  @@ -2493,7 +2493,7 @@
   
     /**
      * The optimized version of DTMDefaultBase.getFirstAttribute().
  -   * 
  +   * <p>
      * Given a node handle, get the index of the node's first attribute.
      *
      * @param nodeHandle int Handle of the node.
  @@ -2533,7 +2533,7 @@
   
     /**
      * The optimized version of DTMDefaultBase.getFirstAttributeIdentity(int).
  -   *
  +   * <p>
      * Given a node identity, get the index of the node's first attribute.
      *
      * @param identity int identity of the node.
  @@ -2568,7 +2568,7 @@
   
     /**
      * The optimized version of DTMDefaultBase.getNextAttributeIdentity(int).
  -   *
  +   * <p>
      * Given a node identity for an attribute, advance to the next attribute.
      *
      * @param identity int identity of the attribute node.  This
  @@ -2596,7 +2596,7 @@
   
     /**
      * The optimized version of DTMDefaultBase.getTypedAttribute(int, int).
  -   * 
  +   * <p>
      * Given a node handle and an expanded type ID, get the index of the node's
      * attribute of that type, if any.
      *
  @@ -2643,8 +2643,8 @@
     }
   
     /**
  -   * Override SAX2DTM.getLocalName() in SAX2DTM2
  -   * Processing for PIs is different.
  +   * Override SAX2DTM.getLocalName() in SAX2DTM2.
  +   * <p>Processing for PIs is different.
      * 
      * Given a node handle, return its XPath- style localname. (As defined in
      * Namespaces, this is the portion of the name after any colon character).
  @@ -2668,8 +2668,8 @@
   
     /**
      * The optimized version of SAX2DTM.getNodeNameX().
  -   * 
  -   * Given  a node handle, return the XPath node name. This should be the name
  +   * <p>
  +   * 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.
  @@ -2713,7 +2713,7 @@
   
     /**
      * The optimized version of SAX2DTM.getNodeName().
  -   * 
  +   * <p>
      * Given a node handle, return its DOM-style node name. This will include
      * names such as #text or #document.
      *
  @@ -2773,9 +2773,9 @@
   
     /**
      * Override SAX2DTM.getStringValue(int)
  -   *
  +   * <p>
      * This method is only used by Xalan-J Interpretive. It is not used by XSLTC.
  -   *
  +   * <p>
      * If the caller supplies an XMLStringFactory, the getStringValue() interface
      * in SAX2DTM will be called. Otherwise just calls getStringValueX() and
      * wraps the returned String in an XMLString.
  @@ -2889,7 +2889,7 @@
     
     /**
      * The optimized version of SAX2DTM.getStringValue(int).
  -   * 
  +   * <p>
      * %OPT% This is one of the most often used interfaces. Performance is
      * critical here. This one is different from SAX2DTM.getStringValue(int) in
      * that it returns a String instead of a XMLString.
  @@ -3011,7 +3011,7 @@
   
     /**
      * The optimized version of SAX2DTM.dispatchCharactersEvents(int, ContentHandler, boolean).
  -   *
  +   * <p>
      * 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
  
  
  

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