posted 20 years ago
Hi
Thanks to all who replied ... I'm now clearer on the differences between JAXB and SAX/DOM.
Found the following from the sun's site. Hope that it's useful .
* JAXB simplifies access to an XML document from a Java program:
- JAXB allows you to access and process XML data without having to
know XML or XML processing. Unlike SAX-based processing, there's no
need to create a SAX parser or write callback methods.
- JAXB allows you to access data in non-sequential order, but unlike
DOM-based processing, it doesn't force you to navigate through a
tree to access the data.
- By unmarshalling XML data through JAXB, Java content objects that
represent the content and organization of the data are directly
available to your program.
* JAXB uses memory efficiently: The tree of content objects produced
through JAXB tends can be more efficient in terms of memory use than
DOM-based trees.
* JAXB is flexible:
- You can unmarshal XML data from a variety of input sources,
including a file, an InputStream object, a URL, a DOM node, or a
transformed source object.
- You can marshal a content tree to a variety of output targets,
including an XML file, an OutputStream object, a DOM node, or a
transformed data object
- You can unmarshal SAX events -- for example, you can do a SAX
parse of a document and then pass the events to JAXB for
unmarshalling.
- JAXB allows you to access XML data without having to unmarshal it.
Once a schema is bound you can use the ObjectFactory methods to
create the objects and then use set methods in the generated
objects to create content.
- You can validate source data against an associated schema as part
of the unmarshalling operation, but you can turn validation off if
you don't want to incur the additional validation overhead.
- You can validate a content tree, using the Validator class,
separately from marshalling. For example, you can do the
validating at one point in time, and do the marshalling at another
time.
* JAXB's binding behavior can be customized in a variety of ways.