SimpleComTools, LLC
XML1000 – User Manual
SimpleComTools, LLC
14
Document Correctness
For an XML document to be correct, it must be both
well-formed
and
valid
. That means that the document
conforms both to the rules of XML, as well as the requirements of the schema (in this case, the correct values
required to interrogate and configure the XML1000).
It is therefore possible that documents could be well-formed but not valid. Conversely, documents could
conform to the correct schema, but may not be formatted properly (well-formed). It is essential that both
factors are present in order for XML to work properly.
Well Formed Documents
A well-formed document conforms to all of the W3C XML syntax rules.
For more info on well-formed documents, refer to the W3C website at
http://www.w3.org/XML
.
Below are some examples of those rules for well-formed documents:
1. The document may have only one root element.
2. Non-empty elements must have both opening and closing tags.
3. Empty elements may be marked with an empty-element (self-closing) tag, such as <EMPTY/>.
4. All attribute values are quoted, either single (') or double (") quotes.
5. Single quotes close a single quote and double quotes close a double quote.
6. Tags may be nested but must not overlap.
7. Each non-root element must be completely contained in another element.
8. Document elements match required case-sensitivity.
Example: the tag <Sample> is not the same as <SAMPLE>.
9. The document complies to its character set definition.
Valid Documents
Valid document have data that conforms to defined content rules, or XML schema.
Below are some examples of those rules for valid documents:
1. Elements must have the correct data type.
2. Elements required to contain a numeric value, may not contain text.
3. Elements required to contain a text may only not contain a numeric as part of the string.
4. Elements that are numeric, must be displayed as the correct type - integer or decimal.