2004-01-15

Relaxer and jEdit

Thought I would post something Java related. Java and XML. The 1.0 release of Relaxer is out (actually out Dec. 26, but whatever).

I've been using Relaxer more and more since last February. It is a general code generation tool. It can read an XML document and generate DTD, Schema, Relax NG grammar, JAXP source, and much more.

I use it to quickly create a DTD or XML Schema. I still have to tweak the results, and it doesn't always work, but it is a good first try.

Free, open-source, written in Java. Install is a little strange, but not too difficult to figure out. Once installed and relaxer.bat is on your path:

relaxer file.xml -dtd will create file.dtd
relaxer file.xml -xsd will create file.xsd
relaxer file.xml -xslt will create file.xslt

I use the first two quite a bit. The last one creates an XSLT stylesheet, which is novel. I don't get as much value out of this as the XSLT merely creates a copy of the input (something that could be accomplished with a single template). But, it is easier to type this than it is to type in the standard XSLT template gobbledegook.

Oh, and a little jEdit tip. The console plug-in in jEdit is quite handy. Other editors like vi and emacs have similar console capabilities. But, a lot of jEdit users don't know about the built-in variables to refer to the current buffer.

Let's say you have an XML file open in jEdit. Switch to the console plug-in (I dock mine at the bottom of the screen). Type cd $d (directory of the current buffer). Then type relaxer -dtd $n (filename of the current buffer). Then %edit filename.dtd (don't have an environment variable for that last one).

No comments:

Post a Comment