We need to call an executable from ant that takes xml as part of the argument. Using exec is easy enough, but one of the arguments includes an xml file. We tried loading the xml file using the loadfile target with striplinebreaks
<loadfile
property="xmlStuff"
srcFile="xmlFile.xml">
<filterchain>
<striplinebreaks/>
</filterchain>
</loadfile>
<exec executable="theCommand">
<arg value="Some other information and now our xml: '${xmlStuff}'" />
</exec>
Is there a way we can read and escape xml documents for use in this case?
EDIT since xmlStuff has quotes for its attributes they are ending the arg valute attribute quotes.
So the above example ends up like:
theCommand "Some other information and now our xml: '<outerTag myAtt="foobar"> <innerTag /> </outerTag>'"
Instead of:
theCommand Some other information and now our xml: '<outerTag myAtt="foobar"> <innerTag /> </outerTag>'
Is there any way to have essentially three layers of quotes?
One for the value attribute of the arg tag (could these perhaps not be included in the final command?).
One for within the arg tag to represent the nested string.
One for within the xmlStuff for attributes within.
This file is being injected into a database and is not available now.