John L. Clark wrote:
> I am receiving the error "Command execution has failed:
> java.net.MalFormedURLException: unknown protocol: c" on a command
> invocation under Windows (XP) that works under Linux. I believe the
> following section of a configuration file is causing the problem:
>
> <cfg:command name="docbook.translateChanges">
> <cfg:process>
> <cfg:copyDocument to="in.xml"/>
> <cfg:transform file="in.xml" stylesheet="xsl/change.xsl" to="out.xml"/>
> <cfg:upload base="file:///">
> <cfg:copyFile file="out.xml" to="%0" />
> </cfg:upload>
> </cfg:process>
> </cfg:command>
>
> When I change the 'base="file:///"' attribute to 'base="%0"' (motivated
> by the xsl configuration for docbook distributed with XXE), I get a
> similar exception under Linux, although instead it says "unknown
> protocol: /path/to/output/file".
More precisely, it says "no protocol: /path/to/output/file".
> Where is the "c" protocol coming from? I had thought that an
> appropriate specification for the "base" attribute would force the
> protocol.
Your problem comes from the fact that %0 is a file name. %0 should be an
URL. (On Unix a file name looks like an URL, not on Windows).
I can reproduce your problem if I modify
XXE_install_dir/config/docbook/xslMenu.incl for example.
The problem occurs with this modified macro:
---
<command name="docb.convertToPS">
<macro>
<sequence>
<command name="selectFile" parameter="saveFile" />
<command name="docb.toPS" parameter='"%0" "%1" "%2" "%_"' />
</sequence>
</macro>
</command>
---
not with the original one (parameter="saveFileURL" instead of
parameter="saveFile"):
---
<command name="docb.convertToPS">
<macro>
<sequence>
<command name="selectFile" parameter="saveFileURL" />
<command name="docb.toPS" parameter='"%0" "%1" "%2" "%_"' />
</sequence>
</macro>
</command>
---
I understand that your users may prefer the look and feel of the
standard file chooser, but here passing an URL to the macro is really
mandatory. Therefore you really need to use XXE's URL chooser.