The XML Pipeline Processor

Volume 10, Issue 66; 10 Jul 2007; last modified 08 Oct 2010

Announcing the first release of the XML Pipeline Processor, my implementation of XProc: An XML Pipeline Processor.

At last, I'm releasing my nascent XProc processor. You'll find all the details on the project status page.

Fair warning: this release is extremely alpha. In addition to scant documentation and a woefully inadequate test suite, it is known to have the following bugs:

  • The defaulting story for primary inputs and outputs (i.e., a pipeline with no declared inputs gets an anonymous input if it's needed) is not supported.

  • There is no command-line syntax for binding options.

  • Parameters bound on the command-line are ignored.

  • The following steps are not implemented: p:error, p:xsl-formatter, and p:xquery.

  • The p:http-request step is incompletely and incorrectly implemented.

  • A large, almost random collection of debugging messages are printed.

  • Error reporting is abysmal.

No doubt it has many others.

However, it does implement a fair chunk of the specification and it does work for me, so maybe it'll work for you. I suggest you read the release notes before deciding if it's something you want to try today.

Bug reports and other comments most welcome. I expect to continue to work on making it complete and correct at least until the XProc specification has successfully exited its candidate recommendation phase.

Comments

Hi Norman,

Great news! (ok, I already knew you were releasing it ;-))

I've just downloaded and setup XProc, and have gave it a try. I had a few problems related with paths, I think because I'm here on Windows. You say here "Bug reports and other comments most welcome", but you don't say were this is the best to report them (here, on your personal email, on a dedicated ML, ...) so I post here. Please let me know if there is a more appropriate place to do so.

First, Windows doesn't seem to like the "/tmp/xproc.log" path:

(drkm)[20] ~/tmp/xproc
$ xproc.sh samples/choose.xml samples/choose.xml /dev/null
Exception in thread "main" java.io.IOException: Couldn't get lock for /tmp/xproc.log
    at java.util.logging.FileHandler.openFiles(FileHandler.java:372)
    at java.util.logging.FileHandler.(FileHandler.java:237)
    at xproc.Driver.main(Driver.java:92)

As this is only a log file, I commented the following lines in xproc.Driver (lines 92-93):

    FileHandler handler = new FileHandler("/tmp/xproc.log");
    logger.addHandler(handler);

Then Java doesn't like the Windows-like paths to construct URIs (note I just replaced some part of the full path on my system by "..."):

(drkm)[21] ~/tmp/xproc
$ xproc.sh samples/choose.xml samples/choose.xml /dev/null
Exception in thread "main" java.net.URISyntaxException: Illegal character in opaque part at index 7: file:c:\...\tmp\xproc/
    at java.net.URI$Parser.fail(URI.java:2816)
    at java.net.URI$Parser.checkChars(URI.java:2989)
    at java.net.URI$Parser.parse(URI.java:3026)
    at java.net.URI.(URI.java:578)
    at org.xproc.parsers.XMLParser.open(XMLParser.java:118)
    at org.xproc.parsers.XMLParser.loadPipeline(XMLParser.java:234)
    at org.xproc.XProc.load(XProc.java:173)
    at xproc.Driver.main(Driver.java:179)

I replaced in org.xproc.parsers.XMLParser the following line (118):

    URI cwd = new URI("file:" + System.getProperty("user.dir") + "/");

by:

    String user_dir = System.getProperty("user.dir");
    URI cwd = new URI("file:" + URLEncoder.encode(user_dir) + "/");
(drkm)[22] ~/tmp/xproc
$ xproc.sh samples/choose.xml samples/choose.xml /dev/null
Exception in thread "main" java.lang.IllegalArgumentException: URI is not absolute
    at java.net.URI.toURL(URI.java:1080)
    at org.xproc.parsers.XMLParser.open(XMLParser.java:129)
    at org.xproc.parsers.XMLParser.loadPipeline(XMLParser.java:237)
    at org.xproc.XProc.load(XProc.java:173)
    at xproc.Driver.main(Driver.java:179)

Adding a slash after "file:" was enough to solve the problem:

    String user_dir = System.getProperty("user.dir");
    URI cwd = new URI("file:/" + URLEncoder.encode(user_dir) + "/");

This is fine. But the path I tried to access to contained spaces (you know "My Documents/..."). URLEncoder.encode() replace some chars by their Unicode number (you know that), but spaces with '+'. So when the path contains a space, at the end of the day the system will try to find a directory whose the path contains "My+Documents/...", which doesn't exist:

(drkm)[23] ~/tmp/xproc
$ xproc.sh samples/choose.xml samples/choose.xml /dev/null
Pipeline failed: XProc error err:XD0009
XProc error err:XD0009
    at org.xproc.parsers.XMLParser.open(XMLParser.java:136)
    at org.xproc.parsers.XMLParser.loadPipeline(XMLParser.java:235)
    at org.xproc.XProc.load(XProc.java:173)
    at xproc.Driver.main(Driver.java:179)
Caused by: java.io.FileNotFoundException: c:\...\tmp\xproc\xproc\java\samples\choose.xml (The system cannot find the path specified)
    at java.io.FileInputStream.open(Native Method)
    at java.io.FileInputStream.(FileInputStream.java:106)
    at java.io.FileInputStream.(FileInputStream.java:66)
    at sun.net.www.protocol.file.FileURLConnection.connect(FileURLConnection.java:70)
    at sun.net.www.protocol.file.FileURLConnection.getInputStream(FileURLConnection.java:161)
    at java.net.URL.openStream(URL.java:1007)
    at org.xproc.parsers.XMLParser.open(XMLParser.java:128)
    ... 3 more

So finally I replaced '+' by '%20' in the URL encoded string:

    String user_dir = System.getProperty("user.dir");
    String path = URLEncoder.encode(user_dir).replace("+", "%20");
    URI cwd = new URI("file:/" + path + "/");

I am sure there would be better way to handle that, but I think that this gives you the idea.

Hope that helps.

Thanks for having made your implementation public. Best regards,

--drkm

—Posted by Florent Georges on 11 Jul 2007 @ 10:21 UTC #

Thanks, Florent! (And I think the issues you pointed out are now fixed in the repository.)

With respect to where to send bug reports, I think I remembered to say where in the release notes and the project page :-)

The best thing is to use one of the project mailing lists or the issue tracker at xproc.dev.java.net.

—Posted by Norman Walsh on 11 Jul 2007 @ 12:18 UTC #

First I want to thank you for the nice work! XML Pipeline is very crucial to our application and I am so glad to see a decent open source implementation.

My question is, how can we use xml catalogs to validate when using xproc? Thank you!

—Posted by Dazhi Jiao on 20 Jul 2007 @ 05:36 UTC #