Question:
how xml work with java?
kn2003_sahu
2006-04-16 22:58:45 UTC
how xml work with java?
Five answers:
Bryan
2006-04-16 23:02:18 UTC
you can use SAX or JDOM parsers for xml
eswars_in
2006-04-17 06:16:07 UTC
good question. XML is a self describing document description language and we can process the xml documents with java using two techniques, either with DOM (Document Object Model), or SAX (Simple API for XML processing). DOM is like object oriented and all the documents, elements, attributes are represented as objects and operations on these objects are well defined. refer to DOM level-3 specification.

BUT SAX is used as events, and everything is represented in terms of events.

More over, with SAX, you can traverse the document in forward direction only and that to only once. UIf you want to get back to the previous node, its not possible. But with DOM you can have asynchronous access to the xml nodes and you can get any node at any time.

But the disadvantage with DOM is it loads the whole document into the memory once, and if the document to be processed with is of large size then your virtual memory may not be suffucient to process the document.

But with SAX you wont have such problems, and is faster than the DOM.



Ofcourse, there are many xml processing tools available with java, but always the best is from apache, named, xerces compiler.

For simple processing, you can use JAXP, which is coming as default with the java5.0 onwards. you can find them in the documentation at "javax.xml package".
kinan
2006-04-17 06:07:45 UTC
Java can parse/generate XML documents using variety of parsers. As you might know there are two kinds of parsers DOM and SAX. Some of the well known parsers are Xerces http://xerces.apache.org/xerces-j/ and JDOM http://www.jdom.org/ . If you are new to Java then start by using JDOM.
2006-04-17 11:58:58 UTC
use SAX or JDOM parsers for xml



http://www.cafeconleche.org/books/xmljav...
rox
2006-04-17 06:04:32 UTC
u have to need a compiler with use of internet explorer. then u add it& use it...


This content was originally posted on Y! Answers, a Q&A website that shut down in 2021.
Loading...