A Valid XML document is a Well Formed XML document, which also conforms to the rules of a schema which defines the legal elements of an XML document. The schema type can be: XML Schema, Relax NG (full or compact syntax), Schematron, Document Type Definition (DTD), Namespace Routing Language (NRL) or Namespace-based Validation Dispatching Language (NVDL).
The purpose of the schema is to define the legal building blocks of an XML document. It defines the document structure with a list of legal elements.
The <oXygen/>
function ensures that your document is compliant with the rules defined by an associated DTD, XML Schema, Relax NG or Schematron schema. XML Schema or Relax NG Schema can embed Schematron rules. For Schematron it is possible to select the validation phase.Validation of an XML document against a W3C XML Schema containing a type definition with a minOccurs or maxOccurs attribute having a value larger than 256 limits the value to 256 and issues a warning about this restriction in the Message panel at the bottom of the <oXygen/> window. Otherwise for large values of the minOccurs and maxOccurs attributes the validator fails with an OutOfMemory error which practically makes <oXygen/> unusable without a restart of the entire application.
Validation of an XML document against a deeply recursive Relax NG schema may fail with a stack overflow error. It happens very rarely and the cause is the unusual depth of the Relax NG pattern recursion needed to match an element of the document against the schema and the depth exceeds the default stack size allocated by the Java virtual machine. The error can be overcome by simply setting a larger stack size to the JVM at startup using the -Xss parameter, for example -Xss1m.
Validation of an XML document against a W3C XML Schema or Relax NG Schema with embedded ISO Schematron rules allows XPath 2.0 in the expressions of the ISO Schematron rules. This ensures that both XPath 1.0 and XPath 2.0 expressions are accepted in the embedded ISO Schematron rules and are enforced by the validation operation. For embedded Schematron 1.5 rules the version of XPath is set with a user preference.
A line with a validation error or warning will be marked in the editor panel by underlining the error region with a red color. Also a red sign will mark the position in the document of that line on the right side ruler of the editor panel. The same will happen for a validation warning, only the color will be yellow instead of red.
The ruler on the right of the document is designed to display the errors found during the validation process and also to help the user to locate them more easily. The ruler contains the following areas:
top area containing a success validation indicator that will turn green in case the validation succeeded or red otherwise.
middle area where the errors markers are depicted in red. The number of markers shown can be limited by modifying the setting oXygen/Editor / Document checking+Maximum number of errors reported per document
→ +Clicking on a marker will highlight the corresponding text area in the editor. The error message is displayed both in the tool tip and in the error area on the bottom of the editor panel.
Status messages from every validation action are logged into the Console view.