Seminar Topics & Project Ideas On Computer Science Electronics Electrical Mechanical Engineering Civil MBA Medicine Nursing Science Physics Mathematics Chemistry ppt pdf doc presentation downloads and Abstract

Full Version: Java Architecture for XML Binding
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Java Architecture for XML Binding


[attachment=27002]

What is JAXB?

JAXB is Java Architecture for XML Binding
SAX and DOM are generic XML parsers
They will parse any well-structured XML
JAXB creates a parser that is specific to your DTD
A JAXB parser will parse only valid XML (as defined by your DTD)
DOM and JAXB both produce a tree in memory
DOM produces a generic tree; everything is a Node
JAXB produces a tree of Objects with names and attributes as described by your DTD


Advantages and disadvantages


Advantages:
JAXB requires a DTD
Using JAXB ensures the validity of your XML
A JAXB parser is actually faster than a generic SAX parser
A tree created by JAXB is smaller than a DOM tree
It’s much easier to use a JAXB tree for application-specific code
You can modify the tree and save it as XML
Disadvantages:
JAXB requires a DTD
Hence, you cannot use JAXB to process generic XML (for example, if you are writing an XML editor or other tool)
You must do additional work up front to tell JAXB what kind of tree you want it to construct
But this more than pays for itself by simplifying your application
JAXB is new: Version 1.0 dates from Q4 (fourth quarter) 2002


How JAXB works


JAXB takes as input two files: your DTD and a binding schema (which you also write)
A binding schema is an XML document written in a “binding language” defined by JAXB (with extension .xjs)
A binding schema is used to customize the JAXB output
Your binding schema can be very simple or quite complex
JAXB produces as output Java source code which you compile and add to your program
Your program will uses the specific classes generated by JAXB
Your program can then read and write XML files
JAXB also provides an API for working directly with XML
Some examples in this lecture are taken from the JAXB User’s guide,


Limitations of JAXB


JAXB only supports DTDs and a subset of XML Schemas
Later versions may support more schema languages
JAXB does not support the following legal DTD constructs:
Internal subsets
NOTATIONs
ENTITY and ENTITIES
Enumerated NOTATION types