W3C home > Mailing lists > Public > www-dom@w3.org > April to June 2001

RE: Maybe someone can tell us

From: Sander Bos <sander@x-hive.com>
Date: Wed, 13 Jun 2001 09:33:13 +0200
To: "W3C DOM mailing list" <www-dom@w3.org>

> why the DOM version 1 didn't specify a means of getting the
> actual XML out
> of the DOM document.  I'm not really talking about loading and saving
> files, but rather just getting the contents of the DOM doc as a
> big string
> at least.
> Does someone have a historical perspective on this?  I'm trying to
> implement some XML functionality with Xerces and I'm frustrated with the
> hassle of writing reams of code just to get the DOM into usable XML.

I can't provide you with any history. However, if you can save to a file,
you can also save to a String? You didn't mention whether you use Xerces-C
or Xerces-J? With Xerces-J it is possible to do this without reams of code:

import org.apache.xml.serialize.XMLSerializer;
import java.io.StringWriter;
Document document = ...;

StringWriter writer = new StringWriter();
XMLSerializer serializer = new XMLSerializer();
String serializedXML = writer.toString();


With future Load/Save implementations, you could of course create a similar

Hope this helps,

Received on Wednesday, 13 June 2001 03:33:23 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 20 October 2015 10:46:08 UTC