O'Reilly logo

Ivor Horton's Beginning Java®, Java 7 Edition by Ivor Horton

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 22

Java and XML

WHAT YOU WILL LEARN IN THIS CHAPTER:

  • What a well-formed XML document is
  • What constitutes a valid XML document
  • What the components in an XML document are and how they are used
  • What a DTD is and how it is defined
  • What namespaces are and why you use them
  • What the SAX and DOM APIs are and how they differ
  • How you read documents using SAX

The Java Development Kit (JDK) includes capabilities for processing Extensible Markup Language (XML) documents. The classes that support XML processing are collectively referred to as JAXP, the Java API for XML Processing. In this chapter and the next, you explore not only how you can read XML documents, but also how you can create and modify them. This chapter provides a brief outline of XML and some related topics, plus a practical introduction to reading XML documents from within your Java programs using one of the two mechanisms you have available for this. In the next chapter I discuss how you can modify XML documents and how you create new XML documents programmatically. Inevitably, I can only skim the surface in a lot of areas because XML itself is a huge topic. However, you should find enough in this chapter and the next to give you a good feel for what XML is about and how you can handle XML documents in Java.

XML

XML, or the Extensible Markup Language, is a system- and hardware-independent language for defining data and its structure within an XML document. An XML document is a Unicode text file that contains data ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required