The quotes look OK to me

("-p edit.inlines.convert ' c-c-Author span class=\"c-c-Author\" '" would work too.)

but the Java snippet below (may be incomplete?) cannot work because the w2x command is missing input file and output file arguments.

1) First of all, please try to run your command outside your server, in a Terminal, and check that it works.

See https://www.xmlmind.com/w2x/_distrib/doc/manual/index.html#w2x_command

2) "/home/ubuntu/XMLMind/w2x-pro-1_8_0/bin/w2x" is just a shell script. So why not invoke a custom, very simple, shell script itself invoking stock w2x shell script? This way, no more quote problems.

3) It's also possible to put all w2x command-line options in a text file and use just the "-f" option. By doing this, no more quote headaches.

See https://www.xmlmind.com/w2x/_distrib/doc/manual/index.html#w2x_command

4) I would expect a server to invoke w2x using its Java API rather than the w2x shell script, but may be you have good reasons to use this approach.

See https://www.xmlmind.com/w2x/_distrib/doc/manual/index.html#embed

See https://www.xmlmind.com/w2x/_distrib/doc/api/overview-summary.html

5) Anyway, even if you insist on running the w2x command-line from within Java, there are ways other than Runtime.getRuntime().exec(String command) to do so.

For example, slightly lower level but no quotes, no string concatenation, involved:

A) Runtime.getRuntime().exec(String[] cmdarray)
https://docs.oracle.com/javase/8/docs/api/java/lang/Runtime.html#exec-java.lang.String:A-

OR

B) ProcessBuilder
https://docs.oracle.com/javase/8/docs/api/java/lang/ProcessBuilder.html





---
PS: Your support request is about Java programming and not about our product. Therefore we don't feel obligated to answer it. We did it just to show our good will.




On 2/11/20 6:13 PM, Mahmood, Alam wrote:

I am trying to add parameter in the conversion but whenever I add double quote inside a String in Java it does not work. I am running the application in Linux server. Below is my code:

String command= "/home/ubuntu/XMLMind/w2x-pro-1_8_0/bin/w2x -o docbook5";

command= command+ " -p transform.hierarchy-name article ";

command= command+ "-p edit.inlines.convert \"c-c-Author span class='c-c-Author'\""; //this line does not work

*for*(File file: listOfFiles) {

// for _linux_ server

*if*(file.isFile()) {

                            String _FileName_= file.getName();

*try*{

                                  Process _proc_=Runtime./getRuntime/().exec(command);

                            } *catch*(IOException e) {

*return*e.toString();

                            }

What’s the right format for this?


--
XMLmind Word To XML Support List
[email protected]
https://www.xmlmind.com/mailman/listinfo/w2x-support

Reply via email to