That error message looks wrong given that you seem to be getting the correct result. I'll investigate that for a new release.

On 26/02/2010 19:54, Gilbert Rebhan wrote:
-------- Original Message  --------
Subject: Re: Ant xmlproperty question
From: canadatom<tomoodes...@gmail.com>
To: user@ant.apache.org
Date: 26.02.2010 15:43

thanks for reply, I used xmlproperty, now I am trying to extract url from
psf.project.reference

<psf>
   <project reference="v1.0,http://blahblahblah1,desc1"/>
   <project reference="v1.1,http://blahblahblah2,desc2"/>
   <project reference="v1.2,http://blahblahblah3,desc3"/>
</psf>

<for list="${psf.project.reference}" param="ref">
              <sequential>
        <propertyregex property="url" input="@{ref}"
regexp="(http)(.*)" select="\0"/>
                <echo>${url}</echo>
        </sequential>
</for>
The above code doesn't work properly, please advice. Is there a better way
to do it?
i would use the xmltask [1] (recommended for xml related stuff),
combined with xpath [2] =


<?xml version="1.0" encoding="UTF-8"?>
<project>
<!-- Import XMLTask -->
<taskdef name="xmltask"
classname="com.oopsconsultancy.xmltask.ant.XmlTask"/>

<target name="depends">
<xmltask source="./example.xml">
  <regexp path="//@reference" pattern=".+,(h.+),.+" replace="$1"/>
  <copy path="//@reference" append="true" property="foobar"
   propertyseparator="${line.separator}"/>
</xmltask>
</target>

<target name="main" depends="depends">
   <echo>$${foobar} = ${line.separator}${foobar}</echo>
</target>
</project>


Buildfile: /home/ant/foo.xml
depends:
   [xmltask] Cannot append values to properties
   [xmltask] Cannot append values to properties
   [xmltask] Cannot append values to properties
main:
      [echo] ${foobar} =
      [echo] http://blahblahblah1
      [echo] http://blahblahblah2
      [echo] http://blahblahblah3
BUILD SUCCESSFUL
Total time: 388 milliseconds


the message "Cannot append values to properties"
is a bit annoying but you may simply ignore it, i don't know
how to get rid of it


[1] http://www.oopsconsultancy.com/software/xmltask/
[2] http://www.zvon.org/xxl/XPathTutorial/General/examples.html



Regards, Gilbert





---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscr...@ant.apache.org
For additional commands, e-mail: user-h...@ant.apache.org

--
Brian Agnew                  http://www.oopsconsultancy.com
OOPS Consultancy Ltd
Tel: +44 (0)7720 397526
Fax: +44 (0)20 8682 0012


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscr...@ant.apache.org
For additional commands, e-mail: user-h...@ant.apache.org

Reply via email to