Using JAXB-Built Classes
As soon as the JAXB has built classes that represent an XML document, it is a simple matter to use them. The operations that make XML processing complete include:
Reading an XML document
Modifying an XML document (adding, removing, and updating nodes)
Writing an XML document
Reading an XML Document
Recall from earlier in the chapter that the process of building a Java object representation of an XML document in JAXB terms is referred to as unmarshalling. Therefore, the process for reading an XML document that adheres to the chosen DTD is to call the Java class representing the root node's unmarshal() method.
In the example, the root node is <books> and is represented by the Books class. The Books class has four unmarshal() ...
Get Java™ Web Services Unleashed now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.