Say we would like to store information that has a structure that is meaningful to our program. Also, we would like this information to be human-readable to some degree and sometimes even human-editable. To accomplish this, we very often turn to XML.
Java provides us with powerful tools for manipulating, reading, and writing XML raw text and files. However, as is the case with many powerful tools, there's a bit of a knowledge overhead for us to learn how to use them. In this chapter, we'll first look at how to use Java to load an XML file into a Java object. Next, we'll walk through how to parse XML data using Java. Finally, we'll see the Java code to write and modify XML data.
We'll cover the following topics in this chapter:
- Java code for reading XML data
- Parsing XML data
- Writing and modifying XML data