XML rules
The following rules apply to all XML documents:
1. All XML elements must have a closing tag.
An element must be either a tag pair, like this:
<book> </book>
or a self-closing tag, like this:
<book title="The Fellowship of the Ring"/>
Sometimes a self-closing tag is used when the tag contains no data, or when only the attributes are necessary.
2. XML tags are case sensitive
The following tags would not be valid in our example document:
<BOOK>
<Book>
In our example, all the tags are in lower case.
3. All XML elements must be properly nested
Unlike HTML, XML tags must be nested in the correct order. HTML tags can be nested incorrectly and the document will still be displayed correctly, like this:
<b><i>The Fellowship of the Ring</b></i>
Notice that the italics opening and closing tags both appear after the bold tags. In XML, the child tag must be enclosed within its parent tag, like this:
<parent><child>Data</child></parent>
4. All XML documents must have a root tag
This contains all of the content of the document. It may not be contained by any other element in the document.
5. Attribute values must always be quoted
Another difference in syntax between HTML and XML is that attribute values must be enclosed in quotes in XML. In HTML, you can omit the quotes and most browsers will display the document properly, like this:
<body background=White>
XML attributes will not be recognized unless they are enclosed in quotes, like this:
<book author="J.R.R. Tolkien">
6. You can add comments to your document
You may add comments to your XML document, and the comment tags are the same in HTML:
<!-- Your comment goes here -->
Text between the comment tags is ignored, and you are encouraged to add comments to the Creo Elements/Direct Manager Server XML files wherever you make a change. Comment nesting is not allowed.
Was this helpful?