Creating an XML File

Before exploring XOM, you should learn some things about XML and how it stores data. XML data turns up in countless places—it can be stored to a file, transmitted over an Internet network, and held in a program's memory.

As XML became popular, Sun Microsystems took note of its usefulness by supporting the format. Several classes in the Java 2 class library can read and write XML, including the Properties class in the java.util package, which was covered in the previous hour, “Reading and Writing Files.”

A Properties object can be stored as XML rather than in the name=value format covered in the preceding hour.

After the object has been filled with configuration properties, its storeToXML() method saves it to an XML file. ...

Get SAMS Teach Yourself Programming with Java™ in 24 Hours, FOURTH EDITION 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.