|
|
XML Syntax
XML Syntax consists of XML Declaration, XML Elements and XML Attributes.
- XML documents use a self-describing and simple syntax.
The first line in the document - the XML declaration - defines the XML version and the character encoding used in the document. In this case the document conforms to the 1.0 specification of XML and uses the ISO-8859-1 (Latin-1/West European) character set.
The next line describes the root element of the document (like it was saying: "this document is a note"):
- All XML elements must have a closing tag.
With XML, it is illegal to omit the closing tag.In HTML some elements do not have to have a closing tag.In XML all elements must have a closing tag, like this:
- XML tags are case sensitive.
Opening and closing tags must therefore be written with the same case:
- All XML elements must be properly nested.
In XML all elements must be properly nested within each other like this:
- All XML documents must have a root tag.
All XML documents must contain a single tag pair to define a root element.
All other elements must be within this root element.All elements can have sub elements (child elements). Sub elements must be correctly nested within their parent element:
- Attribute values must always be quoted.
- With XML, White Space is Preserved.
With XML, the white space in your document is not truncated.This is unlike HTML.
- Comments in XML.
The syntax for writing comments in XML is similar to that of HTML.
Top
|