XML has a simple markup syntax that allows you to store information as a tree of tagged nodes.
Consider the XML document library1.xml, shown in the following example, that describes the contents of a library.
<?xml version="1.0"?> <!--An example XML document--> <library> <book isbn="0-246-13655-3"> <title>Mystery</title> <author>Peter Straub</author> </book> <book isbn="1-876590-17-3"> <title>False Memory</title> <author>Dean Koontz</author> </book> </library>
In this example:
The first line of the file is the XML declaration with version information.
The second line defines a comment node.
The next line contains a <library> tag, which indicates the start of an XML element node named library that ends when a matching </library> tag is found.
The <library> element is the root element of the document and contains two <book> element child nodes, each containing a <title> and an <author> node.
Each <book> element node has an attribute with name isbn and its International Standard Book Number (ISBN) value.
The <title> and <author> elements each contain text data.