XML Basics
The basic syntax of XML is extremely simple. If you’ve worked with
HTML, you’re already halfway there. As with HTML, XML represents
information as text using tags to add structure. A tag begins
with a name sandwiched between less than (<) and greater than (>)
characters. Unlike HTML, XML tags must always be
balanced; in other words, an opening tag must always
be followed by a closing tag. A closing tag looks just like the opening
tag but starts with a less than sign and a slash (</). An opening tag,
closing tag, and any content in between are collectively referred to as an
element of the XML document. Elements can contain
other elements, but they must be properly nested (all tags started within
an element must be closed before the element itself is closed). Elements
can also contain plain text or a mixture of elements and text (called
mixed content). Comments are enclosed between <!— and —> markers. Here are a few examples:
<!--Simple--><Sentence>Thisistext.</Sentence><!--Element--><Paragraph><Sentence>Thisistext.</Sentence></Paragraph><!--Mixed--><Paragraph><Sentence>This<verb>is</verb>text.</Sentence></Paragraph><!--Empty--><PageBreak></PageBreak>
An empty tag can be written more compactly in a special form using a single tag ending with a slash and a greater-than sign (/>):
<PageBreak/>
Attributes
An XML element can contain attributes, which are simple name-value pairs supplied inside the start tag.
<Documenttype="LEGAL"id="42">...</Document><