You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xalan.apache.org by zo...@apache.org on 2002/11/05 21:49:09 UTC

cvs commit: xml-xalan/java/src/org/apache/xalan/xsltc/dom DOMImpl.java

zongaro     2002/11/05 12:49:09

  Modified:    java/src/org/apache/xalan/xsltc/dom Tag: XSLTC_DTM
                        DOMImpl.java
  Log:
  Changed characters(int, TransletOutputHandler) method to use the DTM's
  dispatchCharactersEvents method.  That method will emit characters events
  for the string value of a node without creating String temporaries.
  
  Revision  Changes    Path
  No                   revision
  
  
  No                   revision
  
  
  1.68.2.15 +17 -19    xml-xalan/java/src/org/apache/xalan/xsltc/dom/DOMImpl.java
  
  Index: DOMImpl.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xalan/xsltc/dom/DOMImpl.java,v
  retrieving revision 1.68.2.14
  retrieving revision 1.68.2.15
  diff -u -r1.68.2.14 -r1.68.2.15
  --- DOMImpl.java	5 Nov 2002 10:41:44 -0000	1.68.2.14
  +++ DOMImpl.java	5 Nov 2002 20:49:08 -0000	1.68.2.15
  @@ -154,6 +154,9 @@
       private String    _documentURI = null;
       static private int _documentURIIndex = 0;
   
  +    // Object used to map TransletOutputHandler events to SAX events
  +    private CH2TOH _ch2toh = new CH2TOH();
  +
       // Support for access/navigation through org.w3c.dom API
       private Node[] _nodes;
       private NodeList[] _nodeLists;
  @@ -1504,18 +1507,19 @@
       }
   
       /**
  -     * Copy the contents of a text-node to an output handler
  +     * Copy the string value of a node directly to an output handler
        */
  -    public void characters(final int textNode, TransletOutputHandler handler)
  +    public void characters(final int node, TransletOutputHandler handler)
         throws TransletException 
       {
  -      //TODO: child of a text node== null!!
  -      /* handler.characters(_text,
  -                         _offsetOrChild[textNode],
  -                         _lengthOrAttr[textNode]); */
  -       char[] buffer;
  -        buffer = getNodeValue(textNode).toCharArray();
  -        handler.characters(buffer, 0, buffer.length);
  +        if (node != DTM.NULL) {
  +            _ch2toh.setTOH(handler);
  +            try {
  +                dispatchCharactersEvents(node, _ch2toh, false);
  +            } catch (SAXException e) {
  +                throw new TransletException(e);
  +            }
  +        }
       }
   
       /**
  @@ -1569,10 +1573,7 @@
                                      _lengthOrAttr[node])*/);
           break;
         case DTM.TEXT_NODE:
  -        char[] buffer = getNodeValue(node).toCharArray();
  -        handler.characters(buffer, 0, buffer.length);/*_text,
  -                           _offsetOrChild[node],
  -                           _lengthOrAttr[node]);*/
  +        characters(node, handler);
           break;
         case DTM.ATTRIBUTE_NODE:
           shallowCopy(node, handler);
  @@ -1657,13 +1658,10 @@
         switch(type)
         {
         case DTM.ROOT_NODE: // do nothing
  -     case DTM.DOCUMENT_NODE:
  +      case DTM.DOCUMENT_NODE:
           return EMPTYSTRING;
         case DTM.TEXT_NODE:
  -              char[] buffer = this.getNodeValue(node).toCharArray();
  -        handler.characters(buffer, 0, buffer.length); /*_text,
  -                           _offsetOrChild[node],
  -                           _lengthOrAttr[node]); */
  +        characters(node, handler);
           return null;
         case DTM.PROCESSING_INSTRUCTION_NODE:
           copyPI(node, handler);
  
  
  

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