Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

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.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8523891
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T07:32:19+00:00 2026-06-11T07:32:19+00:00

I am currently loading properties from an XML file in Ant. However, I’d like

  • 0

I am currently loading properties from an XML file in Ant. However, I’d like to perform my current ant task inside a for loop while loading a new XML properties file for the same set of properties each time.

I’m aware of the existence of ant-contrib’s var task which allows me to override properties. However, I’m unsure of how to combine this with loading properties from an XML file. I thought at first about iterating through all of the properties and then setting them to new values using the propertyregex task. Unfortunately, as I started writing code to do that I realized I didn’t know how to actually load the property values still, since they can’t overwrite previously set properties. (Well, they can using the var task, but this can’t be used to load from an XML file as far as I can tell.)

Any ideas? What I’m ideally looking for is a task that would be called something like

<xmlvars file="myxmlpropertyfile.xml"/>

which would function just like

<xmlproperty file="myxmlpropertyfile.xml"/>

with the exception that it overwrites the variables.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T07:32:21+00:00Added an answer on June 11, 2026 at 7:32 am

    One of the things you can do with the <xmlproperty> task is to prefix each property with a specific value. Why not simply use the name of your parameter as a prefix?

    Otherwise, you could use the <echoproperties> task to unset all of the properties, and then loop through the next iteration of your <for> task.

    Something like this, but this isn’t tested:

     <for param="my.directory">
         <fileset dir="${some.directory}"/>
         <sequential>
             <xmlproperty file="@{my.directory}/myxmlpropertyfile.xml"
                prefix="foo-fighters"/>
              <blah, blah, blah/>
              <for param="reset.var">
                  <echoproperty prefix=foo-fighters"/>
                  <sequential>
                      <var name="@{reset.var}"
                         unset="true"/>
                  </sequential>
              </for>
         </sequential>
     </for>
    

    Basically, you use the outer <for> loop to loop through your directories, and use <xmlproperty> to set the property names. The <blah blah blah/> means do what you want. Then, before you go to the next iteration of your outer <for> loop, you do an inner <for> loop that will unset all the variables you previously set in the <xmlproperty> task.

    The trick is using a variable prefix that will guarantee that the variable names are easily found. Thus foo-fighters.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am reading properties file from java DAO implementation for loading properties object as
I'm having some issues with loading a (.properties) file from the webcontent folder in
Currently I am loading data from a previous session into my application using the
We're currently using folders inside webroot to store images and videos which we're loading
Currently i have an application that reads and writes several properties from one or
I have a properties file that I currently have in this folder: /src/webapp/WEB-INF/classes/my.properties I
I'm having a strange problem with cakephp. Im currently loading some data from the
Currently,I know how to do a lazy implementation of the loading procedure of the
I am currently looking at jQuery mobile and its system of loading web pages
I'm loading layers of images to make a single image. I'm currently stacking them

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.