How Do I Convert DTDs and RELAX NG to XSD?
Whether you’re working with legacy schemas or simply prefer to work in these simpler frameworks, you need to convert these forms to XSD for work in Office. As noted earlier, Trang, available from http://www.thaiopensource.com/relaxng/trang.html, offers an extremely easy path from DTDs or RELAX NG to XSD. At its core, Trang is a simple command-line utility that takes XML sample documents, DTDs, RELAX NG, RELAX NG Compact syntax, or XSD and converts them into DTDs, RELAX NG, RELAX NG Compact syntax, or XSD. For working with Office, you’ll mostly be converting DTDs and RELAX NG to XSD, though perhaps you’ll want to convert XSD to other forms to use with other systems.
Warning
RELAX NG is more expressive than XSD in a number of ways. If you really take advantage of RELAX NG, the limitations of XSD will be fairly apparent, and Trang can’t convert all of RELAX NG’s capabilities to XSD. If you stick with the subset shown in this appendix, however, you should not encounter such losses.
The basic syntax for using Trang looks like:
java -jar trang.jarsourceFile
destinationFile
By default, the kind of transformation Trang performs depends on the file extensions of the source and destination files, shown in Table D-3.
Table D-3. File extensions used by Trang
File extension |
Meaning |
---|---|
.xsd |
W3C XML Schema (XSD) file (output only) |
.dtd |
XML 1.0 Document Type Definition (DTD) |
.rng |
RELAX NG file, XML syntax |
.rnc |
RELAX NG file, compact syntax |
|
Get Office 2003 XML now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.