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 12:18:15 GMT
 
-----Original Message-----
From: Jowie [mailto:joe.nash@mac.com] 
Sent: Monday, December 07, 2009 1:02 PM
To: user@ant.apache.org
Subject: RegExp help needed!

/*
Hi all,

I'm fumbling my way around Ant and finding the help on the web really
confusing. I am using Ant simply as a macro copy/download/find-replace
utility and am an ActionScript programmer, not a Java one.

Anyway... There's one bit I'm stuck on and really need your help please!

I have used Ant to download an XML file and store it locally. I now need a
way of going through the XML, finding all the image URL attributes,
downloading those images and replacing all the URLs in the XML to local
relative paths. So far, all I have is:

		<loadfile property="questions" srcFile="${local.path}GetAllQuestions.xml"
/>
		<propertyregex input="${questions}" property="questions.output"
regexp="Media=&quot;(.*?)&quot;" select="\1" global="true" />
		<echo message="${questions.output}" />

*/

regexp for xml or html is not recommended, better use xmltask and the power of xpath =

xmltask
http://www.oopsconsultancy.com/software/xmltask/

xpath
http://www.w3schools.com/Xpath/
http://www.zvon.org/xxl/XPathTutorial/General/examples.html


so you would go like that =

<xmltask source="">
 <call path="//module/*[liefertyp/text()='build']" target="yourdownloadtarget">
  <param name..." path="..."/>
   ...
  </call>
</xmltask>


you may post a snippet of your xml file to get the right xpath expression.


Regards, Gilbert




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


Mime
View raw message