Chapter 21. Reading and Writing XML Data



  • Reading XML from a file

  • Extracting XML elements

  • Collecting a set of child elements

  • Reading attribute values for an XML element

  • Writing an XML file


The rise to prominence of Java in the 1990s coincided with another dramatic change in the development of computer software: the introduction of Extensible Markup Language (XML). XML, a format for organizing and storing data so that it can be read by any program, has become ginormous, to borrow my kids’ favorite adjective.

Thanks to XML, data can be read and written independently of the software used to create it. This is a welcome change from the bad old days when every program seemed to have its own ...

Get Sams Teach Yourself Java™ in 24 Hours, Fifth Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.