Here's the basic syntax of a document:
[1] document ::= prolog element Misc* - Char* RestrictedChar Char* [39] element ::= EmptyElemTag | STag content ETag [9] STag ::= '<' QName (S Attribute)* S? '>' [10] ETag ::= '</' QName S? '>' [11] EmptyElemTag ::= '<' QName (S Attribute)* S? '/>'
Examples:
<?xml version="1.0"> <doc> <h:a href="something.xml" xmlns:h="http://www.w3.org/1999/xhtml">something</h:a> </doc>
The 'prolog' and 'misc' can only contain comments and processing instructions--no text content other than whitespace.
If there is an XML declaration (see next slide) it must occur before any characters in the document.
The 'content' production consists of any element, characters, processing instruction, or comment.
There can only be one element at the root of the document and it is called the document element.