I need to retrieve some values from an HTML file. I need to use Ant so I can use these values in other parts of my script.
Can this even be achieved in Ant?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
As stated in the other answers you can’t do this in “pure” XML. You need to embed a programming language. My personal favourite is Groovy, it’s integration with ANT is excellent.
Here’s a sample which retrieves the logo URL, from the groovy homepage:
build.xml
Build uses the ivy plug-in to retrieve all 3rd party dependencies.
The parsing logic is pure groovy programming. I love the way you can easily walk the page’s DOM tree:
ivy.xml
Ivy is similar to Maven. It manages your dependencies on 3rd party software. Here it’s being used to pull down groovy and the HTMLCleaner library the groovy logic is using:
How to install ivy
Ivy is a standard ANT plugin. Download it’s jar and place it in one of the following directories:
I don’t know why the ANT project doesn’t ship with ivy.