Java Mailing List Archive

http://www.ant-tasks.com/

Apache Ant Archive

» Ant Users List
» Ant Developers List
xmltask xpath bug ?!, buffer to property ?!

xmltask xpath bug ?!, buffer to property ?!

2007-07-10       - By Rebhan, Gilbert
Reply:     1     2     3  


Hi,

i have a problem with xmltask 1.14 and xpath.
i want a nodelist as property.

the relevant xml section looks like that
<module>
<modul.0>
<name>modul_A</name>
<label>020407_134553535</label>
<buildpossible>N</buildpossible>
</modul.0>
<modul.1>
<name>modul_B</name>
<label>to_be_build</label>
<buildpossible>J</buildpossible>
</modul.1>
</module>

with the xpath expression
//module/*/name/text()

i expect to get the nodelist containing both modulnames

modul_A
modul_B


but with
<xmltask source="props.xml">
 <copy path="count(//module/*/name/text())" property="name.count"/>
 <copy path="//module/*/name/text()" property="moduls.text"/>
</xmltask>
<echo>
 $${name.count} = ${name.count}
 $${moduls.text} = ${moduls.text}
</echo>

i get only
    [echo] ${name.count} = 2
    [echo] ${moduls.text} = modul_A

Is that a bug  or works as designed ?
i expected to get the nodelist with all matches

i believe it's because the property ${moduls.text} is set
at first match - which is modul_A - and the second match
get's not appended to that, because once set a (normal) property
is immutable in ant.

so i tried a buffer
<target name="init">
 <xmltask source="props.xml">
   <copy path="count(//module/*/name/text())" property="name.count"/>
   <copy path="//module/*/name/text()" buffer="moduls.text"
append="true"/>
   <print buffer="moduls.text"/>
  </xmltask>

that gives me
[xmltask] { buffer 'moduls.text' output
 [xmltask] modul_A
 [xmltask] } buffer 'moduls.text' output
 [xmltask] { buffer 'moduls.text' output
 [xmltask] modul_B
 [xmltask] } buffer 'moduls.text' output

so both modulnames are contained now, but how to get
that buffer in a property ?

Any ideas ?

Regards, Gilbert





---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@(protected)
For additional commands, e-mail: user-help@(protected)


©2008 ant-tasks.com - Jax Systems, LLC, U.S.A.