Saxon and setBaseOutputURI result in "URI with authority" error

I use saxon to create 5 html files from 1 xml file. Whenever I run code windows, it runs smoothly and creates all the necessary files. However, when I run the code on unix, this leads to this error:

Failed to create output file file:/output1.html: Permission denied 

Searching stackoverflow, I found out that it was trying to write to the root directory, which made me try setBaseOutputURI ().

I am trying to make saxon output html files to / foo / biz / html _out, so I wrote this code:

 String filePathUri = "file://foo/biz/html_out/"; xsltTransformer.setBaseOutputURI(filePathUri); 

The error is now reading

 net.sf.saxon.s9api.SaxonApiException: Cannot write to URI file://foo/output1.html (URI has an authority component) at net.sf.saxon.s9api.XsltTransformer.transform(XsltTransformer.java:454) 

My questions:

  • I came to the correct conclusion that I need to use setBaseOutputURI?

  • Am I spelling URI incorrectly?

  • Is there anything else I should try, given that the code works fine on Windows?

+4
source share
1 answer

Found an answer!

I had to use "file: /// foo / biz / html_out" as a URI. An additional slash left a line in the path text.

+10
source

Source: https://habr.com/ru/post/1491639/


All Articles