ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Alexey Solofnenko <alex...@mdli.com>
Subject [SUBMIT] <property> to read XML file
Date Mon, 06 May 2002 19:24:30 GMT
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)


Mime
View raw message