Revision [838]
This is an old revision of EmbeddingXmlsh made by DavidLee on 2009-10-29 17:58:03.
Embedding xmlsh
xmlsh is a pure java program and can be embedded into java applications easily.
The easiest way to integrate xmlsh is to create an instance of xmlsh command and execute it.
The following is an example of how to invoke xmlsh from within java.
import java.util.ArrayList; import java.util.List; import org.xmlsh.core.XValue; import org.xmlsh.sh.shell.Shell; // The method executing the task public void run_xmlsh() throws Exception { List<XValue> vargs = new ArrayList<XValue>(); vargs.add( new XValue("-c")); vargs.add( new XValue("xslt -f file.xsl < file.xml" )); org.xmlsh.commands.builtin.xmlsh cmd = new org.xmlsh.commands.builtin.xmlsh(); int ret = cmd.run(null , "xmlsh" , vargs); }