W3C home > Mailing lists > Public > www-dom@w3.org > January to March 2000

Re: String output of XML documents

From: David Brownell <david-b@pacbell.net>
Date: Tue, 08 Feb 2000 14:23:55 -0800
Message-ID: <38A0977B.A3913153@pacbell.net>
To: Arnaud Dubesset <arnaud@gradient.ie>
Cc: www-dom@w3.org
keshlam@us.ibm.com wrote:
> 
> > I supposed I could find in this interface a method  enabling to format
> the
> > XML tree content to a string value.
> 
> Sorry, but this is not yet standardized in the DOM APIs. DOM Level 3 is
> planning to include a chapter on serialization and deserialization of DOMs,
> which will address this.
> 
> Meanwhile, there are off-the-shelf implementations of this operation which
> you could "steal" for use in your own program. 

Even open source versions (no theft possible :-) that show some of the
advantages of not having this be part of DOM at all:

    http://home.pacbell.net/david-b/xml/

There are two packages there ... the "DOM2" package implements the CR
(including events and other extension modules), but the printing support
is in the "utilities" package and is not DOM-specific.  The "domparse"
example shows a complete round-tripping scenario:  it reads a document
into your specified DOM, and then writes it out.  Converting to strings
is easy using the java.io classes for that purpose (that is, StringReader
and StringWriter).

By the way, those packages may be very useful also to understand how
the latest versions of SAX and DOM support namespaces and suchlike,
and how SAX2beta works.

- Dave
Received on Tuesday, 8 February 2000 17:24:17 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Friday, 22 June 2012 06:13:47 GMT