Chapter 4 XML Processing
To sum up, consider using DOM when any of these circumstances apply:
You want to consume or produce documents.
You want to manipulate documents and need fine grained control over the doc 
ument structure that you want to create or edit.
You want to process the document more than once.
You want random access to parts of the document. For example, you may want 
to traverse back and forth within the document.
Memory usage is not a big issue.
You want to implement data binding but you cannot use JAXB technology be 
cause the document either has no schema or it conforms to a DTD schema def 
inition rather than to an XSD schema definition. The document may also be too 
complex to use SAX to implement data binding. (See  SAX Programming 
Model  on page 165.)
You want to benefit from the flexibility of Xpath and apply Xpath expressions 
on DOM trees.
XML Data Binding Programming Model
The XML data binding programming model, contrary to the SAX and DOM
models, allows the developer to program the processing of the content of an XML
document without being concerned with XML document representations (infosets). 
Using a binding compiler, the XML data binding programming model, as
implemented by JAXB, binds components of a source XSD schema to schema 
derived Java content classes. JAXB binds an XML namespace to a Java package.
XSD schema instance documents can be unmarshalled into a tree of Java objects
(called a content tree), which are instances of the Java content classes generated
by compiling the schema. Applications can access the content of the source docu 
ments using JavaBeans style get and set accessor methods. In addition, you can
create or edit an in memory content tree, then marshal it to an XML document
instance of the source schema. Whether marshalling or unmarshalling, the devel 
oper can apply validation to ensure that either the source document or the docu 
ment about to be generated satisfy the constraints expressed in the source schema. 
The steps for using JAXB technology schema derived classes to process an
incoming XML document are very simple, and they are as follows:

New Page 1

Home : About Us : Network : Services : Support : FAQ : Control Panel : Order Online : Sitemap : Contact : Terms Of Service

java web hosting



 Our partners: | PHP: Hypertext Preprocessor | Best Web Hosting | Java Web Hosting | Inexpensive Web Hosting |

Jsp Web Hosting | Cheapest Web Hosting | Jsp Hosting | Cheap Hosting


Virtualwebstudio. Business web hosting division of Web Design Plus. All rights reserved