ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Rebhan, Gilbert" <Gilbert.Reb...@huk-coburg.de>
Subject RE: RegExp help needed!
Date Mon, 07 Dec 2009 15:45:53 GMT


-----Original Message-----
From: Jowie [mailto:joe.nash@mac.com] 
Sent: Monday, December 07, 2009 4:06 PM
To: user@ant.apache.org
Subject: RE: RegExp help needed!

/*
Hi Gilbert,

What I am trying to say is... I have done exactly how you say, despite what
my last message says (some weird URL encoding is deleting one of my lines!)
and it returns a list of repeating

     [echo] img = /brain_games_main/Image.ashx?ID=647
     [echo] img = /brain_games_main/Image.ashx?ID=647
     [echo] img = /brain_games_main/Image.ashx?ID=647
     [echo] img = /brain_games_main/Image.ashx?ID=647

rather than different IDs each time...

Sorry for the confusion!
*/

i'm sorry too, the xpath expression was wrong, so here we go

your input =

<Question ID="531" Subject="L" Category="Punc" Presentation="PT01"
  Engine="MC01" Body="test" Media="/bgmain/Image.ashx?ID=12">
  <TipID />
  <Answers>
    <Answer ID="1457" Valid="false" Position="1"
      Media="/bgmain/Image.ashx?ID=112">txt
    </Answer>
    <Answer ID="1458" Valid="true" Position="2"
      Media="/bgmain/Image.ashx?ID=113">txt
    </Answer>
    <Answer ID="1459" Valid="false" Position="3"
      Media="/bgmain/Image.ashx?ID=114">txt
    </Answer>
    <Answer ID="1460" Valid="false" Position="4"
      Media="/bgmain/Image.ashx?ID=115">txt
    </Answer>
  </Answers>
</Question>


and =

<xmltask source="xpathtest.xml">
<call path="//*[@Media]">
  <param name="img" path="@Media"/>
  <actions>
      <echo>img = @{img}</echo>
  </actions>
</call>
</xmltask>

gives =

     [echo] img = /bgmain/Image.ashx?ID=12
     [echo] img = /bgmain/Image.ashx?ID=112
     [echo] img = /bgmain/Image.ashx?ID=113
     [echo] img = /bgmain/Image.ashx?ID=114
     [echo] img = /bgmain/Image.ashx?ID=115


if you need only the @Media attributes under from Answer
nodes, use the expresssion  =
<call path="//Answer[@Media]">
...

gives =

     [echo] img = /bgmain/Image.ashx?ID=112
     [echo] img = /bgmain/Image.ashx?ID=113
     [echo] img = /bgmain/Image.ashx?ID=114
     [echo] img = /bgmain/Image.ashx?ID=115




Gilbert


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


Mime
View raw message