aruny       2004/02/23 09:55:09

  Modified:    java/src/org/apache/xml/utils DOMBuilder.java
  Log:
  Description : Copying the patch from jaxp-1_3_0-branch  to main trunk.
  When there is no mark up inside element content, text should be contained in 
single TEXT node.
  
  Revision  Changes    Path
  1.18      +16 -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.17
  retrieving revision 1.18
  diff -u -r1.17 -r1.18
  --- DOMBuilder.java   18 Feb 2004 00:04:32 -0000      1.17
  +++ DOMBuilder.java   23 Feb 2004 17:55:09 -0000      1.18
  @@ -28,6 +28,7 @@
   import org.w3c.dom.Element;
   import org.w3c.dom.Node;
   import org.w3c.dom.Text;
  +import org.w3c.dom.CDATASection;
   
   import org.xml.sax.Attributes;
   import org.xml.sax.ContentHandler;
  @@ -324,6 +325,9 @@
     }
   
     /**
  +
  +
  +
      * Receive notification of the end of an element.
      *
      * <p>The SAX parser will invoke this method at the end of every
  @@ -395,9 +399,14 @@
       }
   
       String s = new String(ch, start, length);
  -    Text text = m_doc.createTextNode(s);
  -
  -    append(text);
  +    Node childNode = m_currentNode.getLastChild();
  +    if( childNode != null && childNode.getNodeType() == Node.TEXT_NODE ){ 
  +       ((Text)childNode).appendData(s); 
  +    } 
  +    else{ 
  +       Text text = m_doc.createTextNode(s);       
  +       append(text);       
  +    }     
     }
   
     /**
  @@ -555,6 +564,7 @@
     public void startCDATA() throws org.xml.sax.SAXException
     {
       m_inCData = true;
  +    append(m_doc.createCDATASection(""));
     }
   
     /**
  @@ -598,7 +608,8 @@
   
       String s = new String(ch, start, length);
   
  -    append(m_doc.createCDATASection(s));
  +    CDATASection section  =(CDATASection) m_currentNode.getLastChild();
  +    section.appendData(s);
     }
   
     /**
  
  
  

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

Reply via email to