O'Reilly logo

Java™ Web Services Unleashed by Mark Wutka, Joseph Weber, Arthur Ryman, K. Scott Morrison, Benoît Marchal, Matthias Kloppmann, Steven Haines, Darren Govoni, Francisco Curbera, Frank Cohen, Robert Brunner

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

XML Components

Before you dive into using JAXP to manipulate XML files, we need to define the components that make up XML documents.

XML Document

The core of an XML document is the document itself. It consists of the following components:

  • Prolog. Contains version information, comments, and references to Document Type Definition (DTD) files.

  • Body. Contains a document root and sub-elements.

  • Epilog. Contains comments and processing instructions.

Listing 12.1 shows a simple XML file that might be used in a bookstore to define a set of books.

Listing 12.1. books.xml<?xml version="1.0"?>
 <!DOCTYPE books SYSTEM "Books.dtd"> <books> <book category="computer-programming"> <author>Steven Haines</author> <title>Java 2 From Scratch</title> <price>39.95</price> ...

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