I have an XML file with the following content:
<root-tag>
<entry name="name1" value="/usr/bin" />
<entry name="full_path" value="${name2}" />
<entry name="name2" value="${name1}/dpkg" />
</root-tag>
I want to read this file in Ant and put the attribute value of value
in the <entry>
node whose name
value is "full_path" into a property with Ant.
I can easily do this, e.g. using <xmltask>
with its <copy>
element:
<copy path="root-tag/entry[@name='full_path']/@value" property="outputProperty" />
However, what I get is ${name2}
, which is meaningless to me. I need ${name2}
to be resolved into the ${name1}/dpkg
and then the ${name1}
part is resolved into /usr/bin
, as a result, /usr/bin/dpkg
.
And I must look for "full_path" because the other two names can't be predicted.
Since this is not entity reference, <xmltask>
can't automatically expand it.
How should I achieve my goal in Ant build file?