Updating a file in java
Both of these parsers are provided by Java API for XML Processing (JAXP).
Java developers can invoke a SAX or DOM parser in an application through the JAXP API to parse an XML document -- that is, scan the document and logically break it up into discrete pieces.
Now developers have another Java API at their disposal that can make it easier to access XML documents: Java Architecture for XML Binding (JAXB).
A Reference Implementation of the API is now available in the Java Web Services Developer Pack V 1.1.
There is no need to create and use a parser and no need to write a content handler with callback methods.
What this means is that developers can access and process XML data without having to know XML or XML processing.
That's because XML has emerged as the standard for exchanging data across disparate systems, and Java technology provides a platform for building portable applications.
One way to do this, perhaps the most typical way, is through parsers that conform to the Simple API for XML (SAX) or the Document Object Model (DOM).
For example, the JAXB Reference Implementation provides a binding compiler that you can invoke through scripts.
Suppose, for example, you want to bind the schema using the binding compiler provided by the JAXB Reference Implementation.
For example, it can't update the data in memory and return the updated data to the XML file.
In the DOM approach, the parser creates a tree of objects that represents the content and organization of data in the document. The application can then navigate through the tree to access the data it needs, and if appropriate, manipulate it.