OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.


Help: OASIS Mailing Lists Help | MarkMail Help



   Xerces, XML Parsers and support for creating Documents.

[ Lists Home | Date Index | Thread Index ]


I have noticed that creating new Documents and then writing these
documents to an outputStream have not always gotten top priority. I have
noticed the following over the different parsers I have used:

xml4j 1.1.6 -- the old parser from IBM -- we had TXDocument which used to
have printWithFormat method.

xerces 2.0.0 alpha -- no support at all.

xerces 2.0.1 -- there is an XML serializer with which we can do it.

This is a functionality which I require almost regularly, and I almost
always find difficult to find. Also none of the examples provided also
talk about this. I would like to ask why this is so??

Also it will be good if someone could check if this is the way of doing it
using Xerces 2.0.1,

  DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance ();
  docBuilder = factory.newDocumentBuilder ();

  Document doc = docBuilder.newDocument ();
  Element el = doc.createElement ("root");
  doc.appendChild (el);

  FileOutputStream outStream = new FileOutputStream ("test.xml");
  XMLSerializer serializer = new XMLSerializer ();
  serializer.writeNode (outStream, doc);

thanks and regards - murali.


News | XML in Industry | Calendar | XML Registry
Marketplace | Resources | MyXML.org | Sponsors | Privacy Statement

Copyright 2001 XML.org. This site is hosted by OASIS