Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

parser

 
arunseege paramashivappa
Ranch Hand
Posts: 33
Java Oracle Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello everyone,

I'am little confused in understanding parsers.

is SAX and DOM are specifications and vendors will provide implementaions for it,(like a specification given by sun on "servlets" and vendors(weblogic,jboss etc) will provide implementaion.)

please help me on this..

Thanks-Arun



 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13056
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What exactly is your question?

Parsers are part of the standard Java library and have been since Java 1.4. The basic API is JAXP - the java api for xml processing.

Bill
 
arunseege paramashivappa
Ranch Hand
Posts: 33
Java Oracle Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

On JAXP i came up with below understanding

JAXP is an XML framework by SUN that allows programmers to plug-in any W3C compliant XML parser using Java's system property files. It is not a parser by itself, but provides a level of abstraction by facilitating dynamic parser selection.

JDOM is another XML framework that integrates standard Java collection classes with any W3C compliant DOM parser allowing programmers to manipulate DOM objects as Java Collections. Very much like JAXP, JDOM sits between the application and the parser. Note that JDOM by itself is not an XML parser

Xerces is Apache's collection of software libraries for parsing, validating, serializing and manipulating XML. The library implements a number of standard APIs for XML parsing, including DOM, SAX and SAX2.


dom4j is an easy to use, open source library for working with XML, XPath and XSLT on the Java platform using the Java Collections Framework and with full support for DOM, SAX and JAXP.


these are above lines which are putting me in confusion on JAXP.

On DOM and SAX ,from the above i understood that they are standard APIs.

 
Ulf Dittmer
Rancher
Pie
Posts: 42967
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
JAXP is more an API than a framework. It goes beyond parsing (leveraging the SAX and DOM APIs), it also defines APIs for XPath, XSLT, XML validation and streaming XML parsing, amongst others.

JDOM is not like JAXP, as it does not implement much of the above.

JDOM, dom4j and XOM are variants of the basic DOM model, providing more Java-like APIs than DOM itself.
 
arunseege paramashivappa
Ranch Hand
Posts: 33
Java Oracle Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


i came with the understanding that Parser API (SAX,DOM,STAX) are like JDBC api.

like if we user jdbc api in our application code we can migrate to any databases just by loading driver for the perticular database.


Please correct me if m wrong.

i want to start working on xml,:

i want to parse xml using sax api and dom api.

which parser is implementing both the api's.

one more question:

is jdk bundled with implementation for both sax api and dom api ?



Thanks-Arun

 
Ulf Dittmer
Rancher
Pie
Posts: 42967
73
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes, the JRE (and by extension, the JDK) does come with implementations of both those APIs. You don't need anything else.
 
arunseege paramashivappa
Ranch Hand
Posts: 33
Java Oracle Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


like APIs for DOM,SAX and STAX ,APIs for XPath, XSLT, XML validation are also implemented by Parser vendors i,e parsers like Saxon,Xalan ?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic