A List Apart: for 
people who make websites

Using XML.

Setting up Windows XML Tools

Java ™

All the tools we will use in this article are written in Java, so you will need a Java Runtime Environment (JRE). You may obtain this at http://java.sun.com/j2se/1.4/download.html. You don’t need the Software Development Kit (SDK) unless you plan on writing Java programs of your own. Follow the instructions that come with the JRE and install it on your system.

Creating Directories

Create a directory named xmlapps on your C: drive. This is where all the tools will go.

Create a directory named nutrition on your C: drive. That is where you will save all the XML files from this article.

The Multi-Schema Validator

You may download the Multi-Schema Validator (MSV) from https://msv.dev.java.net/. Unzip the file into the xmlapps directory that you created above. It will create a directory which you may rename to msv (if it is not already named that).

Now create a file named msvalidate.bat in your nutrition directory, and paste the following text into it:


java -jar c:\xmlapps\msv\msv.jar %1 %2

Xalan

You may download Xalan, a tool which is used to transform XML from one form to another, at http://xml.apache.org/xalan-j/index.html

Again, you will unzip the file into the xmlapps directory. It will create a directory of the form xalan-j_2_x_y where the x and y are numbers that depend upon which version you have downloaded. To make our lives easier, just rename that directory to xalan-j

Now create a file named transform.bat in your nutrition directory, and paste the following text into it.


java -cp c:\xmlapps\xalan-j\bin\xml-apis.jar;c:\xmlapps\xalan-j\bin\xercesImpl.jar;c:\xmlapps\xalan-j\bin\xalan.jar org.apache.xalan.xslt.Process -IN %1 -XSL %2 -OUT %3

FOP

FOP is a tool that takes documents written in the XSL-FO (Extensible Stylesheet Language–Formatting Objects) markup language, and converts them to PDF files. You download it at http://xml.apache.org/fop/index.html. Again, you unzip it into the xmlapps directory. It will create a directory with a name like fop-0.20.4 (or whatever the current version number is). To make things easier, rename that directory to fop.

Now copy the file fop.bat from the fop directory to your nutrition directory. You will have to change all the paths in the command. Thus, where it says:

build\fop.jar;lib\batik.jar;

(etc.) you will have to add the prefix to where the XML apps are:

c:\xmlapps\fop\build\fop.jar;c:\xmlapps\fop\lib\batik.jar;

Batik

Batik is a toolkit that lets you manipulate documents written in the Scalable Vector Graphics (SVG) markup language. You may download it at http://xml.apache.org/batik/. Be sure to get version 1.5 or greater (as of this writing, that is a beta version, but that’s OK).

Again, download it and unzip it into the xmlapps directory. Rename the directory that it creates to batik. Then, create a file named batik.bat in the nutrition directory, and paste the following text into it.


java -jar c:\xmlapps\batik\batik-svgbrowser.jar %1