Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

creating xml using sax

 
deep rai
Ranch Hand
Posts: 56
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi,

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

Thank you
 
Ulf Dittmer
Rancher
Posts: 42968
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13074
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 56
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Rancher
Posts: 42968
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That page talks about creating PDFs from an XML source. How does that help with creating XML?
 
deep rai
Ranch Hand
Posts: 56
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Rancher
Posts: 42968
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Got it - you meant to link to the example below the one you actually linked to.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic