XML Tips
Validating with DTD
In Debian 5.0 (Lenny) install the sp
package and use the nsgmls
command.
In Emacs the sgml-mode (or xml-mode) has a sgml-validate
command,
which runs nsgmls from the sp
package.
Validating with XSD
Download msv.yyyymmdd.zip from the MSV Download site. The download link's are hidden away in the left side-bar, under 'Documents & files'
Validate an XML file that uses an XSD with:
$ java -jar msv.jar my.xsd my.xml
Emacs
In Debian 5.0 (Lenny) install the nxml-mode
package.
Next we need to convert XSD schemas to RELAX NG
Download rngconv.zip from the MSV Download site. It's probably only available under Nightly builds
Unzip it somewhere sensible and convert the XSD to RELAX NG as follows:
$ java -jar rngconv.jar my.xsd >my.rng
Download [Tring][] from the Jing/Trang project page
Now convert it to the RELAX NG compact format
$ java -jar trang.jar my.rng my.rnc
Load an XML document to validate. Enter the Emacs command
rng-set-schema-file-and-validate
and select the location of the .rnc file.
Note: If you get file not found type errors when using these tools, read the error message carefully. It's quite likely an include file that is missing.
References
- http://www.postneo.com/2007/01/16/all-i-want-to-do-is-convert-my-schema
- http://www.emacswiki.org/emacs/NxmlMode
- http://www.emacswiki.org/emacs/TextEncodingInitiativeEmacs
- http://www.thaiopensource.com/nxml-mode/
- Interface21 announces Spring Web Services 1.0
- Tutorial: Writing Contract-first Web Services
Related Topics: EmacsTips
-- Frank Dean - 17 Apr 2010