ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Rebhan, Gilbert" <>
Subject RE: RegExp help needed!
Date Mon, 07 Dec 2009 14:12:27 GMT
-----Original Message-----
From: Jowie [] 
Sent: Monday, December 07, 2009 1:40 PM
Subject: RE: RegExp help needed!

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

So from this, I need to:
1. Find any Media attribute, nested or otherwise (e.g. in E4X,
2. Store each of these to download them
3. Replace the values in the XML with local path equivalents, e.g.
4. Go through stored list, download the images and put them in the right
place (I know how to do that bit with copy url)


a quick response to get you going =

<project name="bla" default="main" basedir=".">
  <!-- Import XMLTask -->
  <taskdef name="xmltask" classname="com.oopsconsultancy.xmltask.ant.XmlTask"/>

  <target name="depends">
    <xmltask source="xpathtest.xml">
      <call path="/Question/Answers/*" target="foo">
        <param name="img" path="@Media" />

  <target name="foo">

<!-- do something with img or write to a file like that, there may be
another way with xmltask buffer too, never used it, see xmltask docs
    <echo file="foo.txt" append="true">${img}${line.separator}</echo>
    <echo>Image = ${img}</echo>

  <target name="xmlreplace">
    <xmltask source="xpathtest.xml" dest="xxxpathtest.xml" report="true">
      <regexp path="/Question/Answers/*/@Media"

  <target name="main" depends="depends,xmlreplace"/>

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

View raw message