An XML Document

An XML document has the following general structure but some parts are optional:

  • A prolog, which may optionally be empty

  • At least one element, the document element, although a typical XML document has a nested structure of elements

  • Optional content following the end tag of the document element

Each of these permitted parts of an XML document is described in the remaining sections of this chapter.

A minimal XML document can consist of a single document element, such as this:

<someElementTypeName>The content</someElementTypeName> 

Typically, XML documents are much more complex and have a nested structure of elements. An XML document that uses more of the allowed structures might look like this:

<?xml version="1.0" ?> 
<!-- This is an example XML document. --> 
<!DOCTYPE book > 
<book> 
<title>Sams Teach Yourself XML in 10 Minutes</title> 
<author>Andrew Watt</author> 
</book> 

First let’s look at what can go in the prolog.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset