Java Forum / General / November 2006
lost in XML
gk - 27 Nov 2006 15:55 GMT Hi,
I am getting confused in XML processing.
i have read SAX API ...its event driven
I have read DOM API ....its Tree structured.
I found two more ! ....JAXP and JDOM.
are these two (JAXP,JDOM) different API or these have been derived from the SAX,DOM ?
If these are really different API , then i am worried about ,why there is no standardization ? if every X,Y,Z people starts inventing their own API , it would be a total chaos .......
may be , i am wrong , JAXP and JDOM could be an extenstion of SAX , DOM ......am i right ?
same problem would be for vendors also, they will be also confused to implement which API ....is not it ?
For example, I know XERCES-J , it implements SAX and DOM both ......i know JAXP is of SUN.
what i dont know, is whether JAXP has been derived from SAX-DOM or is a complete different API ?
probing@gmail.com - 28 Nov 2006 08:16 GMT As far as I know, DOM and SAX are two kinds of standar API for programming with XML. Meanwhile, JDOM and JAXP are one of the implementation for each of them separately.
P.S. there is a another XML processing method, like KXML, which is a "pull" parser which will require less system memory.
"gk 写道: "
> Hi, > [quoted text clipped - 24 lines] > what i dont know, is whether JAXP has been derived from SAX-DOM or is > a complete different API ? gk - 28 Nov 2006 13:12 GMT > As far as I know, DOM and SAX are two kinds of standar API for > programming with XML. > Meanwhile, JDOM and JAXP are one of the implementation for each of them > separately. are you sure ? you said ..its implementation ......but JAXP = java API for XML Processing.
is not it an just API ?
and when it says , ".....JAXP supports SAX and DOM.."......... ....what it means ? does it mean , that it has all the interfaces whatever the SAX and DOM has ....and also some more extra it has ................is this correct ?
> P.S. there is a another XML processing method, like KXML, which is a > "pull" parser which will require less system memory. [quoted text clipped - 29 lines] > > what i dont know, is whether JAXP has been derived from SAX-DOM or is > > a complete different API ? rxreyn3@gmail.com - 28 Nov 2006 23:08 GMT Holy crap; don't get all emotional. Is this an academic discussion, or do you have a problem?
If it is for academic purposes, the previous poster was correct when he referred to the standard vs. the implementation. SAX parsers are more for streaming and consuming large pieces of XML data. Where as DOM is for a small XML instance like the DOM API in Internet Explorer that AJAX apps use. Xerces and Saxon were written by some of the authors of the actual standards. And, since XML is so damn simple, who cares if there are a bunch of different parsers, they all follow the standard.
However, there are many OO solutions out there like XMLBeans, Castor and Hibernate that extract this stuff from us. So, I don't actually mess with low-level XML, what are you doing that this is such a concern?
Rayan
> > As far as I know, DOM and SAX are two kinds of standar API for > > programming with XML. [quoted text clipped - 44 lines] > > > what i dont know, is whether JAXP has been derived from SAX-DOM or is > > > a complete different API ? probing@gmail.com - 29 Nov 2006 03:43 GMT Maybe my previews post is not accurate, "JAXP" is JSR5 and "jaxp" is its implementation on java.net
"gk 写道: "
> > As far as I know, DOM and SAX are two kinds of standar API for > > programming with XML. [quoted text clipped - 44 lines] > > > what i dont know, is whether JAXP has been derived from SAX-DOM or is > > > a complete different API ? gk - 29 Nov 2006 06:29 GMT > Maybe my previews post is not accurate, "JAXP" is JSR5 and "jaxp" is > its implementation on java.net [quoted text clipped - 49 lines] > > > > what i dont know, is whether JAXP has been derived from SAX-DOM or is > > > > a complete different API ? You guys are not understanding my question. I am not asking what is DOM and what is SAX etc .
OK, let me restate my question ,
we have seen JAXP , SAX , DOM .....so many API ....right ? agreed ?
JAXP === developed by SUN .....this is an API ...not implementation .....agreed ?
SAX,DOM === developed by W3 guys ....this is also an API ....not implementation......agreed ?
Now, the implementor is a vendor ...and its the APACHE ,.....APACHE has a product called XERCES-J .......this product has lots of classes , interfaces which follows those above API specification..................agreed ?
see, when we write XML parsing , we see imports like below...
import java.io.IOException; import java.util.ArrayList; import java.util.Iterator; import java.util.List;
import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.parsers.ParserConfigurationException;
import org.w3c.dom.Document; import org.w3c.dom.Element; import org.w3c.dom.NodeList; import org.xml.sax.SAXException;
these kind of imports you will find ...........well, fine......very nice....see , we dont have any import from specific vendor (like apache xerces-j) ...is not it ? one from JAXP api ( javax.xml and blah blah) and other is from DOM spec ..........so, its basically implementation independent ........so far so good.
the points which is not understandable is ,
Q1 ) why there is a mixture of JAXP and DOM imports !
Q2) does JAXP api is influenced by DOM , SAX api ? or this JAXP has no relation with DOM , SAX api ?
Q3) can we parse XML only with JAXP ...without importing DOM,SAX api ?
Free MagazinesGet these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...
|
|
|