This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes XML and Related Technologies and the fly likes creating xml using sax Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "creating xml using sax" Watch "creating xml using sax" New topic
Author

creating xml using sax

deep rai
Ranch Hand

Joined: Oct 04, 2007
Posts: 56
hi,

i would like to know how to create xml file using sax.

Thank you
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41173
    
  45
SAX is an API for parsing XML, not for creating it. The DOM API would be better suited. See this on how to create a XML through a DOM Document object.


Ping & DNS - my free Android networking tools app
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12761
    
    5
Welllll thats not exactly true.

It is not commonly done but you can create a document by creating a sequence of SAX events being fed to an event handler that simply writes them to output.

Harold's chapter 8 on SAX processing gets into this to some extent.

Manipulating SAX events is the basis for "pipeline" processing of XML documents. I cite several toolkits in this survey article.

Note that the SAX approach takes MUCH less memory and CPU time than the DOM approach.

Bill
[ April 22, 2008: Message edited by: William Brogden ]
deep rai
Ranch Hand

Joined: Oct 04, 2007
Posts: 56
thankz ulf and william... just in case someone needs this in future i have attached a great linkkk below which has everything

http://xmlgraphics.apache.org/fop/0.95/embedding.html#ExampleXML2PDF
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41173
    
  45
That page talks about creating PDFs from an XML source. How does that help with creating XML?
deep rai
Ranch Hand

Joined: Oct 04, 2007
Posts: 56
It has few examples, and in one of them it is creating xml from java objects calling sax events on the java object. its example ExampleObj2XML.java
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41173
    
  45
Got it - you meant to link to the example below the one you actually linked to.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: creating xml using sax
 
Similar Threads
reading xml data
how to compare two xml files?
XSL transformation using Apache Xalan
Writing XML using JAVA
XML