Hi
 
    I assume you looking for a way to output the contents of your document or node object as text, the following sample code will do exactly that. It does not make use of crimson or jaxp classes.
 
  /** Returns source underlying xml document. This a fail quick implementation, if the document is not in a
   * ready state then this method will throw an exception. 
   */
  public static final java.lang.String getNodeXML(org.w3c.dom.Node node) {
    String xml = "";
  
    try {
      if (node != null) {
        //Create a StringWriter object to pass to the FormatterToXML instance
        java.io.StringWriter writer = new java.io.StringWriter();
 
        //Uses the Xerces Serializer implementation XMLSerializer
        XMLSerializer serializer = new XMLSerializer(writer, new OutputFormat());
        if (node instanceof org.w3c.dom.Document)
            serializer.serialize((org.w3c.dom.Document)node);
        else
            serializer.serialize((org.w3c.dom.Element)node);

        //Convert the contents of the StringWriter into a String
        xml = writer.toString();
      }
    } catch (Exception e) {
        e.printStackTrace();
    } 
   
    return xml;
  }    
 
Regards
Anthony Dodd
Software Development and Production Manager
Synergy Financial Systems Limited
Synergy House
Highfields Science Park
University Boulevard
Nottingham
NG7 2RF
w: http://www.synergy-fs.com 
t: +44 (0)115 967 7990
f: +44 (0)115 967 7933
e: [EMAIL PROTECTED]
-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
Sent: 04 December 2000 17:56
To: xerces-j-dev@xml.apache.org; [EMAIL PROTECTED]; general@xml.apache.org
Subject: Xerces and Crimson's XmlWriter


Hi,
I hope I'm sending this to the right address, if not please forward to the right one.

When I used the jaxp1.1EA  package from java.sun.com I found a great and good looking way to output XML elements as text. Crimson uses XmlWriter & XmlWriterContext for that use.

But, as good as that may be I found the jaxp package to be lacking some support for XSLT which got me to stay with Xerces & Xalan.

I wonder, will the next version of Xerces (which the site says will use the best parts from crimson) use XmlWriter or another way to output XML as text easily?
and if so when is the next version expected ?

I thank you for the time spent on this correspondence,

Asaf Manela
TrulyGlobal Inc.
Unified Communications

http://guest.trulyglobal.com/amanela

Reply via email to