The W3C XML specification states that a program should not continue to process an XML document if it finds a validation error. The reason is that XML software should be easy to write, and that all XML documents should be compatible. With HTML it was possible to create documents with lots of errors (like when you forget an end tag). One of the main reasons that HTML browsers are so big and incompatible, is that they have their own ways to figure out what a document should look like when they encounter an HTML error. With XML this should not be possible.
However, when creating an XML document, errors are very easily introduced. When working with large projects or many files, the probability that errors will occur is even greater. Determining that your project is error free can be time consuming and even frustrating. For this reason <oXygen/> provides functions that enable easy error identification and rapid error location.
A Well-Formed XML document is a document that conforms to the XML syntax rules.
A Namespace Well-Formed XML document is a document that is Well-Formed XML and is also namespace-wellformed and namespace-valid.
The XML Syntax rules for Well-Formed XML are:
All XML elements must have a closing tag.
XML tags are case sensitive.
All XML elements must be properly nested.
All XML documents must have a root element.
Attribute values must always be quoted.
With XML, white space is preserved.
The namespace-wellformed rules are:
All element and attribute names contain either zero or one colon
No entity names, processing instruction targets, or notation names contain any colons.
The namespace-valid rules are:
The prefix xml is by definition bound to the namespace name http://www.w3.org/XML/1998/namespace. It MAY, but need not, be declared, and MUST NOT be undeclared or bound to any other namespace name. Other prefixes MUST NOT be bound to this namespace name.
The prefix xmlns is used only to declare namespace bindings and is by definition bound to the namespace name http://www.w3.org/2000/xmlns/. It MUST NOT be declared or undeclared. Other prefixes MUST NOT be bound to this namespace name.
All other prefixes beginning with the three-letter sequence x, m, l, in any case combination, are reserved. This means that users SHOULD NOT use them except as defined by later specifications and processors MUST NOT treat them as fatal errors.
The namespace prefix, unless it is xml or xmlns, MUST have been declared in a namespace declaration attribute in either the start-tag of the element where the prefix is used or in an ancestor element (i.e. an element in whose content the prefixed markup occurs). Furthermore, the attribute value in the innermost such declaration MUST NOT be an empty string.
If you select menu Ctrl+Shift+W) or click the toolbar button <oXygen/> checks if your document is Namespace Well-Formed XML. If any error is found the result is returned to the Message Panel. Each error is one record in the Result List and is accompanied by an error message. Clicking the record will open the document containing the error and highlight the approximate location.
+ → (Example 4.2. Document which is not Well-Formed XML
<root><tag></root>
When "Check document form" is performed the following error is raised:
The element type "tag" must be terminated by the matching end-tag "</tag>"
To resolve the error, click in the result list record which will locate and highlight the errors approximate position. Identify which start tag is missing an end tag and insert </tag>.
Example 4.3. Document which is not namespace-wellformed
<x::y></x::y>
When "Check document form" is performed the following error is raised:
Element or attribute do not match QName production: QName::=(NCName':')?NCName.
Example 4.4. Document which is not namespace-valid
<x:y></x:y>
When "Check document form" is performed the following error is raised:
The prefix "x" for element "x:y" is not bound.
Also the files contained in the current project and selected with the mouse in the Project view can be checked for well-formedness with one action available on the popup menu of the Project view :