[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: Xerces, XML Parsers and support for creating Documents.


serialize document

thanks to Elena, Rahul Srivastava and Dare for the clarifications. They
were very clear.

Dare, We will continue to use Xerces because we are comfortable with it
and also with javadoc.. Also for research, we almost always use unix/linux
though everyone uses Windows both at home and also everyone has one
machine at work with Windows.. Hopefully modifying code for serialization
from one parser to the other should not be that difficult..

Note: Greatly wish .NET will include support for RELAX NG also..

cheers and regards - murali.

On Fri, 29 Mar 2002, Elena Litani wrote:

> Murali Mani wrote:
> > xerces 2.0.1 -- there is an XML serializer with which we can do it.
>
> Both Xerces2 (latest 2.0.1) and Xerces1 (last version 1.4.4) support
> serialization of documents.
>
> > 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??
>
> Well, it is an open source project and we don't have that much people
> volunteering to write documentation (or contribute code)..
>
> There are two ways to serialize your DOM document.
>
> [1] Serialize (or load) a document using DOM Level 3.
> In the latest release (2.0.1) we support DOM Level 3 Load/Save Working
> Draft. The support is experimental (means that interfaces might change)
> and not complete (we don't support filters yet). We do provide
> implementation for DOMBuilder and DOMWriter -- and I believe this is the
> functionality you are looking for.
>
> For more information visit:
> http://xml.apache.org/xerces2-j/dom3.html
> http://www.w3.org/TR/2002/WD-DOM-Level-3-ASLS-20020114/load-save.html
>
> [2] Serialize document using XMLSerializer, as in your example.
>
> >  DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance ();
> >   docBuilder = factory.newDocumentBuilder ();
> >
> >   Document doc = docBuilder.newDocument ();
> >   Element el = doc.createElement ("root");
> >   doc.appendChild (el);
>
> The above is correct.
> Here is an example for XMLSerializer:
> OutputFormat format = new OutputFormat((Document)core);
> // set format
> format.setIndenting(true);
> format.setPreserveSpace(true);
> // serialize
> XMLSerializer toFile = new XMLSerializer (new FileWriter("output.xml"),
> format);
> toFile.asDOMSerializer();
> toFile.serialize((Document)doc);
>
> In the future, please post your questions about Xerces to
> xerces-j-user@x...
>
> Thanks,
> --
> Elena Litani / IBM Toronto
>


PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
 

Stylus Studio has published XML-DEV in RSS and ATOM formats, enabling users to easily subcribe to the list from their preferred news reader application.


Stylus Studio Sponsored Links are added links designed to provide related and additional information to the visitors of this website. they were not included by the author in the initial post. To view the content without the Sponsor Links please click here.

Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.