Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JAXB Parser

 
Vijay Kumar
Ranch Hand
Posts: 260
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Which parser is used by JAXB to Marshalling & unMarshalling
Thanks
 
Ulf Dittmer
Rancher
Posts: 42967
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don't think JAXB comes with its own parser, so it would rely on the one JAXP supplies. Depending on the JRE version, that could be Crimson or Xerces.
 
Vijay Kumar
Ranch Hand
Posts: 260
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks
Ulf Dittmer but in JAXB tutorial JAXB a StAX, which provides a standard, bidirectional pull parser interface for streaming XML processing.
Is there any way through which I can define which Parser should use for marshaling & unmarshalling.
thanks
 
Vijay Kumar
Ranch Hand
Posts: 260
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,All
There is StaX API is defined in JWS Tutorials (V1.6).
Is this API used to parse & update the XML

Thanks
Vijay Kumar
 
Ulf Dittmer
Rancher
Posts: 42967
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Why would you want to specify which parser JAXB should use? Note that a parser can only read XML, not generate it.
 
Peer Reynders
Bartender
Posts: 2968
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
StAX: "Streaming API for XML" - that means it is an API for reading and writing XML streams. StAX may very well do it's own "parsing" (rather than relying on a pre-existing parser) - or are you trying control the StAX implementation that is being used? If so why?

The SAX parser returned by the javax.xml.parsers.SAXParserFactory is controlled by the "javax.xml.parsers.SAXParserFactory" system property but code can easily bypass that by looking for a specific parser implementation.

StAX's javax.xml.stream.XMLInputFactory has its own set of system properties that influence its behavior but none of them specify a "parser".

I'm also not aware that JAXB was ever required to use any XML manipulation technology in particular. There always has been the suggestion that JAXB would use something like SAX or StAX in order to maximize speed and minimize the memory footprint but the implementation was always free to do its "own thing".

Kohsuke Kawaguchi's Blog
This release is also the fastest JAXB RI release ever. Both the unmarshaller and marshaller were implemented pretty much from scratch for 2.0. The marshaller in particular has a brand-new algorithm highly optimized for UTF-8. It's so fast that at one point (maybe it still is) faster then our own FastInfoset.

[ August 02, 2007: Message edited by: Peer Reynders ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic