<feed xmlns="http://www.w3.org/2005/Atom" xmlns:foaf="http://xmlns.com/foaf/0.1/"><title>norman.walsh.name: Comments on /2007/07/10/xproc001</title><link rel="alternate" type="text/html" href="http://norman.walsh.name/2007/07/10/xproc001"/><id>http://norman.walsh.name/2007/07/10/xproc001/comments.atom</id><updated>2012-05-23T11:55:22.376514Z</updated><entry><title>Comment 1 on /2007/07/10/xproc001</title><link rel="alternate" type="text/html" href="http://norman.walsh.name/2007/07/10/xproc001#comment0001"/><id>http://norman.walsh.name/2010/09/25/oauth#comment0001</id><published>2007-07-11T10:21:05Z</published><updated>2007-07-11T10:21:05Z</updated><author><name>Florent Georges</name><foaf:mbox_sha1sum>da39a3ee5e6b4b0d3255bfef95601890afd80709</foaf:mbox_sha1sum></author><content type="xhtml"><div xmlns="http://www.w3.org/1999/xhtml">
    <p>Hi Norman,</p>

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

<p>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.</p>

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

<pre>
(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)
</pre>

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

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

<p>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 "..."):</p>

<pre>
(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)
</pre>

<p>I replaced in org.xproc.parsers.XMLParser the following
line (118):</p>

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

<p>by:</p>

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

<pre>
(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)
</pre>

<p>Adding a slash after "file:" was enough to solve the problem:</p>

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

<p>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:</p>

<pre>
(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
</pre>

<p>So finally I replaced '+' by '%20' in the URL encoded string:</p>

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

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

<p>Hope that helps.</p>

<p>Thanks for having made your implementation public.  Best regards,</p>

<p>--drkm</p>
  </div></content></entry><entry><title>Comment 2 on /2007/07/10/xproc001</title><link rel="alternate" type="text/html" href="http://norman.walsh.name/2007/07/10/xproc001#comment0002"/><id>http://norman.walsh.name/2010/09/25/oauth#comment0002</id><published>2007-07-11T12:18:22Z</published><updated>2007-07-11T12:18:22Z</updated><author><name>Norman Walsh</name><foaf:mbox_sha1sum>da39a3ee5e6b4b0d3255bfef95601890afd80709</foaf:mbox_sha1sum></author><content type="xhtml"><div xmlns="http://www.w3.org/1999/xhtml">
    <p>Thanks, Florent! (And I think the issues you pointed out are now fixed in the repository.)
</p>
    <p>
With respect to where to send bug reports, I think I remembered to say where in the release notes and the project page :-)
</p>
    <p>
The best thing is to use one of the project mailing lists or the issue tracker at <a rel="nofollow" href="http://xproc.dev.java.net/">xproc.dev.java.net</a>.</p>
  </div></content></entry><entry><title>Comment 3 on /2007/07/10/xproc001</title><link rel="alternate" type="text/html" href="http://norman.walsh.name/2007/07/10/xproc001#comment0003"/><id>http://norman.walsh.name/2010/09/25/oauth#comment0003</id><published>2007-07-20T17:36:57Z</published><updated>2007-07-20T17:36:57Z</updated><author><name>Dazhi Jiao</name><foaf:mbox_sha1sum>da39a3ee5e6b4b0d3255bfef95601890afd80709</foaf:mbox_sha1sum></author><content type="xhtml"><div xmlns="http://www.w3.org/1999/xhtml">
    <p>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. 
</p>
    <p>
My question is, how can we use xml catalogs to validate when using xproc? Thank you!</p>
  </div></content></entry></feed>

