Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

What is SAX exactly??

Status
Not open for further replies.

pondi

Programmer
Jun 6, 2001
32
GB
Hi,

I'm actually looking for a Java API able to create XML documents from data "on the fly".
During my search, I often get SAX.
Some say that you can create XML documents with it but when I look at the doc of APIs I just have notes about parsing an existing XML document like:
________________________________
startDocument() endDocument()
These methods are called when you're at the top or the end of the document. Thye initialize the parsing.
_________________________________

Thanx for your help.

 
Simple Api for XML.
Sax is basically, as far as I know (I worked most with Xerces), related to XML's DOM (search it on it reached the level 3 specification).

Therefore, you have in DOM all the necessary functions for creating documents and all kinds of elements, setting and retrieving their values anso...

If you want to create a document, you have to use the createDocument function inside the DOM_Document interface, which will set the parent of the newly created document to the DOM_Document instance where you've called the method from.
That is because the DOM Nodes have no meaning outside a document.

And that's the reason that you cannot create a document just like that...
HTH...
[red]Nosferatu[/red]
We are what we eat...
There's no such thing as free meal...
once stated: methane@personal.ro
 
There are 2 major types of API for XML: DOM and SAX. DOM is tree-based and SAX is event-based. They each have their advantages/disadvantages. Generally, SAX is better if your documents are very large.

If you want to know more, check out the official web site for SAX:

The java doc is available at:
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top