You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ant.apache.org by Alexey Solofnenko <al...@mdli.com> on 2002/05/06 21:24:30 UTC
[SUBMIT] to read XML file
Hello,
I have tweaked <property> task a little to load values from XML file. The
loaded property names are: node1/node2/node2.Attribute or node/1/node2#TEXT.
If there are several nodes with the same names the first node's value will
be taken. Attached please find the source and a diff from version 1.48 .
This is an example how it works:
build2.xml:
<project default="main" basedir=".">
<property xmlFile="build2.xml"/>
<target name="main">
<echo message="Target.name=${project/target.name}">
Basedir=${project.basedir}
Target.name=${project/target.name}
Message=${project/target/echo.message}
</echo>
<echo>
Text:
${project/target/echo#TEXT}
======================================================
</echo>
</target>
<target name="main3">
<echo>
Basedir=${project.basedir}
Target.name=${project/target.name}
Message=${project/target/echo.message}
</echo>
</target>
</project>
Output:
Buildfile: build2.xml
main:
[echo] Target.name=main
[echo] Basedir=.
[echo] Target.name=main
[echo] Message=Target.name=main
[echo]
[echo] Text:
[echo] Basedir=.
[echo] Target.name=main
[echo] Message=Target.name=main
[echo]
[echo] ======================================================
[echo]
BUILD SUCCESSFUL
Total time: 1 second
--
{ http://trelony.cjb.net/ } Alexey N. Solofnenko
{ http://www.inventigo.com/ } Inventigo LLC
Pleasant Hill, CA (GMT-8 usually)