• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Paul Clapham
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Roland Mueller
  • Piet Souris
Bartenders:

creating xml using sax

 
Ranch Hand
Posts: 56
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi,

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

Thank you
 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Author and all-around good cowpoke
Posts: 13078
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Got it - you meant to link to the example below the one you actually linked to.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic