ZedAI XML Editors
From zedwiki
Contents |
Preamble
The ZedAI specification allows the normative schema of a profile to be expressed using any combination of the following four XML schema languages:
- RelaxNG
- XSD 1.0
- ISO Schematron
- ISO NVDL
As of 2009-2010, the profiles and features are being normatively expressed in RelaxNG, with a smaller set of ISO Schematron rules added for the expression of certain exclusion rules, and to make an automated (with approximations) translation to informative XSD (W3C XML Schema) possible.
While XSDs are being made available as informative alternative schemas, they can not be used to assert that a document is fully valid with respect to the normative schemas. Where possible, it is recommended to use a RelaxNG+Schematron- aware editor during the full authoring process to avoid the overhead that inevitably arises when using a non-normative schema for authoring.
Note also that XML DTDs are not in the list of allowed schema languages. For some general reasoning about why DTDs are excluded, see for example the section "Whats wrong with DTDs" at the validator.nu FAQ.
Finally, note that as a supporting deliverable, the ZedAI WG intends to provide a validator service that supports simple one-stop validation of ZedAI instances, both over the web and locally.
Editor overview
This overview is not aspiring to be complete, and focuses on XML editors with RelaxNG support. Refer to http://wiki.docbook.org/topic/DocBookAuthoringTools and http://en.wikipedia.org/wiki/List_of_XML_editors for additional editors.
| Name | RNG support | XSD support | SCH support | NVDL support | Platform support | Accessibility | Availability |
|---|---|---|---|---|---|---|---|
| Oxygen | yes | yes | yes | yes | Win+Mac+Linux | N/A | Commercial w discounts |
| XMLMind | yes | yes | yes | no | Win+Mac+Linux | N/A | Free+Commercial versions |
| GNU Emacs nXML | yes | no | no | no | Win+Mac+Linux | N/A | Free (GNU GPL) |
| Aquamacs | yes | no | no | no | Mac | N/A | Free (GNU GPL) |
| Editix | yes | yes | no | no | Win+Mac+Linux | N/A | Commercial w 30 day evaluation |
| XMLBluePrint | yes | yes | no | no | Win only | N/A | Commercial w 10 day evaluation |
| XML Copy Editor | yes | yes | ? | no | Win+Linux+Mac | N/A | Free (GNU GPL) |
| xmlmate (under development) | yes | yes | yes | no | Mac | N/A | Free (new BSD) |
Note regarding Schematron (SCH) support: since Schematron can be executed using plain XSLT, some of the editors above could be made to support Schematron by using provided XSLT facilities.
Editor setup and configuration
Oxygen
The validation support in Oxygen is extensive and can be employed in multiple ways, as described on the Oxygen validation information page.
The below shows one available method, where a RelaxNG schema is associated with a document using an oxygen processing instruction at the document top (before the root element):
<?oxygen RNGSchema="http://www.daisy.org/z3986/2011/auth/profiles/book/0.6/z3986a-book.rng" type="xml"?>
In the above example, the reference to the schema is to its canonical online location. Oxygen will cache the schema locally (so it is only accessed online once). Of course, you can reference a local copy of the schema as well (downloaded from the profiles' resource directory).
To also reference the ISO Schematron schema associated with the profile, a second processing instruction is added, again to the document top:
<?oxygen SCHSchema="http://www.daisy.org/z3986/2011/auth/profiles/book/0.6/resources/z3986a-book.sch"?>
Once this is done, the document top should look like this:
<?xml version="1.0" encoding="UTF-8"?>
<?oxygen RNGSchema="http://www.daisy.org/z3986/2011/auth/profiles/book/0.6/z3986a-book.rng" type="xml"?>
<?oxygen SCHSchema="http://www.daisy.org/z3986/2011/auth/profiles/book/0.6/resources/z3986a-book.sch"?>
<document xmlns="http://www.daisy.org/ns/z3986/authoring/" ...
You can add the two processing instructions to the document by copy and paste, or by using the Associate schema... entry in the the Document/Schema menu.
Emacs nXML
nXML-mode is included with GNU Emacs as of version 23.1 and is the default for editing xml files as of version 23.2.
The easiest method to associate a document with a schema is by specifying it via the menu: Select XML->Set Schema->File.... That will get you a File selection dialog where you can enter the schema location.
A more gerenal method is to place a file named schemas.xml in the same directory as your xml files. The content of the file should be along the following:
<?xml version="1.0"?> <locatingRules xmlns="http://thaiopensource.com/ns/locating-rules/1.0"> <namespace ns="http://www.daisy.org/z3986/2010/" uri="/path/to/the/schema.rnc"/> </locatingRules>
This will associate any xml file which contains the namespace http://www.daisy.org/z3986/2010/ to the specified schema. Adapt the path to your settings.
Further information
- Hack #12 of the O'Reilly XML Hacks Book
- nxml-mode is included with Emacs since Emacs 23.1 (see http://git.savannah.gnu.org/cgit/emacs.git/plain/etc/NEWS)
Validation-only configuration
Validating with XML Calabash (XProc)
TODO
Validating with Jing
Jing can be used to validate files independently of an XML editor (for example, to batch validate files or to integrate into an automated process). The latest source is available for download from the jing-trang project at http://code.google.com/p/jing-trang/. You will also need a recent version of Java in order to invoke the program.
After updating your command shell to include the path to Java and adding the path to the jing.jar file to your CLASSPATH variable (the jar file is located in the \bin subfolder in the source download), you can invoke jing with the following command to validate against the book schema:
java -jar jing.jar http://www.daisy.org/z3986/2011/auth/profiles/book/0.6/z3986a-book.rng [filename]
To avoid repeated calls to grab the schemas from the DAISY web site, a copy of the profile files should be obtained from the profile resource directories and the URI to the DAISY site replaced with the local path to them in the above command.
