1s2a3n4j5e6e7v
1s2a3n4j5e6e7v

Reputation: 1259

Passing values from XML file to Ant

I've a XML configuration file and I want my ANT script to fetch the values from the XML file and act based on those values. Is it possible? If so please describe...

Upvotes: 1

Views: 1947

Answers (1)

SamG
SamG

Reputation: 666

You can use the xmlproperty property task. Lets say you have the xml file infoFile.xml

<?xml version="1.0" encoding="UTF-8"?>
<cat> 
<tabby> 
<name>Mittens</name>
<legs>4</legs> 
<colour>Ginger</colour>
</tabby>
</cat>

In your ANT script you can load it using 'xmlproperty'.

<xmlproperty file="infoFile.xml"/>

You can then access elements within that XML. ${cat.tabby.colour} More information can be found here. http://ant.apache.org/manual/Tasks/xmlproperty.html >

Upvotes: 5

Related Questions