[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.

  • To: "Murali Mani" <mani@C...>,<xml-dev@l...>
  • Subject: RE: Xerces, XML Parsers and support for creating Documents.
  • From: "Dare Obasanjo" <dareo@m...>
  • Date: Thu, 28 Mar 2002 16:28:05 -0800
  • Thread-index: AcHWs5LrD8BTsmMVQUynQST++5iQ4wAAVCww
  • Thread-topic: Xerces, XML Parsers and support for creating Documents.

xerces save document
If you were using the .NET Framework classes(also available on FreeBSD)
you would be able to utilize this functionality with ease. 

using System;
using System.IO;
using System.Xml;

public class Sample
{
  public static void Main()
  {
    //Create the XmlDocument.
    XmlDocument doc = new XmlDocument();
    doc.LoadXml("<book genre='novel' ISBN='1-861001-57-5'>" +
                "<title>Pride And Prejudice</title>" +
                "</book>");

    //Save the document to a file.
    doc.Save("data.xml");
  }
}

which seems a lot less cumbersome than the code you just showed. You can
obtain the .NET Framework 
SDK at

	
http://msdn.microsoft.com/downloads/default.asp?url=/downloads/sample.as
p?url=/msdn-files/027/000/976/msdncompositedoc.xml

or the shared source CLI implementation at 

	http://msdn.microsoft.com/net/sscli/

-- 
This posting is provided "AS IS" with no warranties, and confers no
rights. 
You assume all risk for your use. (c) 2002 Microsoft Corporation. All
rights reserved.



> -----Original Message-----
> From: Murali Mani [mailto:mani@C...] 
> Sent: Thursday, March 28, 2002 3:51 PM
> To: xml-dev@l...
> Subject:  Xerces, XML Parsers and support for 
> creating Documents.
> 
> 
> 
> Hi,
> 
> 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.
> 
> 
> -----------------------------------------------------------------
> The xml-dev list is sponsored by XML.org 
> <http://www.xml.org>, an initiative of OASIS 
<http://www.oasis-open.org>

The list archives are at http://lists.xml.org/archives/xml-dev/

To subscribe or unsubscribe from this list use the subscription
manager: <http://lists.xml.org/ob/adm.pl>


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.