A "Well-Formed" XML document means that it has a correct XML syntax. Using the Check XML Form function checks that your document conforms to the XML syntax rules.
A valid XML document is "Well-Formed", and also conforms to the rules of a Document Type Definition (DTD) , XML Schema, or other type of schema, which defines the structure of an XML document.
When creating XML documents, errors can be introduced. Working with large projects or a vast number of files increases the probability that errors will occur. Identifying and resolving errors in your project can be time consuming and frustrating. Fortunately, oXygen provides functions that make error identification fast and easy.
The use of XML schemas is gaining more and more momentum over the use of DTDs. oXygen always integrates the latest version of the Xerces-J XML parser to validate documents against XML Schemas. Xerces is widely considered the best open-source XML parser and is used in many enterprise servers.
Most of the XML schema-related errors are reported with a descriptive message and also a pointer (URL) to the exact location in the W3C XML Schema specification that is related to that error. Therefore, you can save a lot of time by having easy access to more details about a particular error or by having its schema specification just a click away.
The oXygen Validation Scenarios are very powerful and they solve a number of important issues when working with XML markup and XML-related technologies. They allow you to work with modules and perform multiple validations with one action.
By default, the validation of a document is done by using a processor (XML parser, XSLT transformer, XQuery engine, etc.) to analyze the current file. The validation scenario allows you to specify a set of files to validate, what processor to use for each file, and whether or not to perform continuous validation. When working with a module, you can perform the validation on the Master File (the file that references that module) and you can also perform multiple validations on various files or with different processors.
Suppose that you are working on a big XML document that you decide to split into multiple files and use external entities to merge those files into a master document. If you edit one of those files then you would want to check that the master document (that includes the current file) is valid. The oXygen Validation Scenarios allow you to validate the master document instead of only validating the current file. Therefore, the current file gets validated in the context of the master document from which it is included.
XSLT stylesheets, as is the case with many other XML-related technologies (XQuery, Relax NG, etc.), can be invalid by themselves, yet valid in the context of being imported or included in other files. For instance, you can have an XSLT stylesheet that makes a reference to a named template or variable that is not defined in the current file, but it is defined in the Master File that includes the XSLT stylesheet. In this case, if you validate the XSLT module by itself, you will get an error that no template or variable exists with that name. However, when you validate the master XSLT stylesheet that includes this module, there will be no such error. The oXygen custom validation scenarios allow you to specify the master file that references the module to be validated so that the XSLT module is validated in proper context.
Some XML technologies are complicated, as is the case with XML Schema or XSLT processors, for instance. When you edit documents that are intended to be public or should work no matter what engine is used, then it is best to check them against all engines they will be used with. The oXygen Validation Scenarios allow you to specify multiple validations to be performed and which engine to use for each validation. For example, when editing a schema you can specify any of the processors oXygen supports for XML Schema validation (there are 6 XML Schema processors that oXygen supports and others can also be added as external processors). oXygen validates your schema against all of the processors in one action. Therefore, you can easily check to see that your schema will work no matter what processor is used.
Suppose that you have a set of XML instance documents and you want to change their schema while ensuring that they are still valid. The oXygen Validation Scenarios allow you to configure multiple validations (on each instance document and on the schema file) and is performed in a single action. This allows you to make sure that the schema is valid and your instance documents are valid against the updated schema.
When you work with modules it is also common to re-use them in different contexts (master files). oXygen allows you to validate a module in all the contexts from which it is used since the validation scenarios allow you to set multiple files for validation. Therefore, you can specify all the master files that use the module, and in a single action, you check that the module is valid in all its different contexts.
oXygen can be configured to report validation errors in an edited document as you modify it. By selecting the Enable automatic validation option validation errors will automatically be displayed as you type, after a configured delay.
At the bottom of the editing area, a message is displayed that describes the error that is closest to the caret position.
The location of errors, including those that are generated by continuous validation, are marked in place with an underline. The error locations are also marked in red on the right side of the editing view, in an overview ruler that allows quick navigation between the error markers.
oXygen has built-in support for various external validation engines, including Xerces, LIBXML, XSV, Saxon SA, MSXML4.0, MSXML .NET and SQC.
In addition to these engines that are pre-configured, you can also add your own custom validation engine.
oXygen can validate XML documents using Schematron schemas, XML Schemas, or Relax NG schemas that contain embedded Schematron rules. Editing and validation support is also included for Schematron schemas.
For validation, oXygen uses the Skeleton XSLT processor that is Schematron 1.5 compliant.
For schemas that define different validation phases, oXygen automatically shows a dialog where the validation phase can be selected.
oXygen also includes support for ISO Schematron.
oXygen has a Schematron editor, which analyzes the namespace and automatically detects if the edited Schematron schema is ISO Schematron. It offers continuous validation as well as a Content Completion Assistant with suggestions for the ISO Schematron elements, attributes, and values.
When editing XML Schemas, oXygen offers proposals, using the Content Completion Assistant, inside xs:annotation and xs:appinfo ISO Schematron This makes Schematron embedded rules easier to edit.
oXygen supports validation against ISO Schematron schemas, including validation on request, continuous validation, and batch validation.
ISO Schematron rules can be embedded in other schemas. oXygen offers validation against ISO Schematron rules embedded in Relax NG schemas or XML Schema.
oXygen also supports ISO Schematron schemas that contain abstract patterns or references to other ISO Schematron files through sch:include.
The diagnostics messages reported by Schematron schema are displayed together along with other validation errors. Schematron report messages are displayed as warnings.
XPath 2.0 checks, used in an ISO Schematron schema or Schematron 1.5 schema, can optionally be executed with Saxon EE, instead of Saxon B, in order to access the schema-aware features of Saxon EE. The Saxon EE processor is an extension of the Saxon B processor and is bundled with the oXygen software packages.
The allow-foreign parameter, set in Schematron processing, allows XML elements that reside outside the ISO Schematron namespace (for example, xsl:function and xsl:import-schema) to be used inside an ISO Schematron schema.
An XML Catalog defines mappings between schema locations and local copies of the schema documents. For example, default DocBook documents use the DTDs that are located on the Oasis website. This means that each validation will take time since the DTDs need to be downloaded each time. To speed up this process, oXygen XML Editor uses several catalogs for its default frameworks that are set up automatically the first time you run the application.
The catalog list can be managed from Options / Preferences / XML / XML Catalog, as seen below.
The lack of support for external entities is a known weakness of XML Schema. There are documents that reference a schema but also contain a DTD declaration that allows external entities to be defined. oXygen allows XML schema and external entities to co-exist since you can configure the validation to be performed against the specified XML schema even if a DTD is also specified.
You can use oXygen to validate an XML document instance against a specified DTD.
With oXygen you can easily validate documents against Relax NG (in both XML syntax and compact syntax) and Namespace Routing Language (NRL) schemas.
Multiple files that are currently selected in the Project view can be validated against a schema file with a single action from the Validate button on the toolbar or from the contextual menu. The supported schemas include XML Schema, Relax NG, NVDL, Schematron, or XML Schema/Relax NG schema with embedded Schematron rules. This makes it easy to group the files in your project and validate them as a batch.
The following image shows the dialog for choosing a validation schema.
Errors are reported in an informational pane, indicating the severity of the problem, location information (line number, file path), and a descriptive message. You can track document errors by simply double-clicking the error in the Errors pane. The editor opens the corresponding file and jump to and highlight the location of the error.
oXygen allows you to control some of the parser settings used for validation. The XML Parser features can be configured from Options / Preferences / XML / XML Parser.
You can use the Associate Schema action to open a wizard that allows you to associate a schema with a document.
This modifies the document so that it contains the declared schema location.