ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Gilbert Rebhan <>
Subject Re: Ant xmlproperty question
Date Fri, 26 Feb 2010 19:54:44 GMT
-------- Original Message  --------
Subject: Re: Ant xmlproperty question
From: canadatom <>
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"?>
<!-- Import XMLTask -->
<taskdef name="xmltask"

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

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

Buildfile: /home/ant/foo.xml
  [xmltask] Cannot append values to properties
  [xmltask] Cannot append values to properties
  [xmltask] Cannot append values to properties
     [echo] ${foobar} =
     [echo] http://blahblahblah1
     [echo] http://blahblahblah2
     [echo] http://blahblahblah3
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


Regards, Gilbert

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message