Monday, 4 April 2016

What are the goals and usage of JAXB ?


JAXB provides API, tools, and a framework that automate the mapping between XML documents and Java objects.
Provides compiler that compiles XML schema to Java classes.
Provides an efficient and standard way of mapping between XML and Java code.

JAXB is high-level language while JAXP/SAX/DOM are assembly language for XML document management.

What you can do ?
  • Unmarshal XML content (XML document instance) to Java representations.
  • Access, update and validate the Java representation against schema constraints.
  • Marshal the Java representation of the XML content into XML content.


JAXB Design Goals

Easy to use
  • Lower “barrier to entry” to manipulating XML documents within Java programs
  • Don't have to deal with complexities of SAX and DOM

Customizable
  • Sophisticated applications sometimes require fine control over the structure and content of schema-derived classes
  • Allows keeping pace with schema evolution

Portable
  • JAXB components can be replaced without having to make significant changes to the rest of the source code.

Validation on demand
  • Validate the tree against the constraints in the source schema

Clean “round-tripping”
  • Converting a Java content tree to XML content and back to Java content again should result in equivalent Java content trees before and after the conversion.

No comments:

Post a Comment

Note: only a member of this blog may post a comment.