Chapter 2
Your First XML
Examples
Overview
The project in this chapter involves the Stitch Store asking its warehouse if items in a user's order are available.
Elements
Tags in XML are called elements (or nodes). The element that encompasses the whole XML document is called the root node (or root element). Elements that are nested inside of other elements are called child nodes. If an element doesn't need a closing tag, then that element is called an empty tag.
Element names in XML are case-sensitive, so <cat> is a distinct from <Cat>.
Attributes
XML elements can contain any number of attributes. All attribute values must be in double quotes.
Viewing XML
As of this writing, only Internet Explorer is good for viewing XML documents.
Structure and Syntax
Most XML documents begin with a version declaration: <?xml version="1.0"?>. This line is optional. The element that follows the version declaration is the root element, which encompasses all the other elements in the document.
All XML tags must be closed, either by a separate closing tag or by ending a tag with a forward slash.
All XML tags must be properly nested. For example, <a><b></b></a> is ok, but <a><b></a></b> is not.