Or use something like XMLTask... http://www.oopsconsultancy.com/software/xmltask/index.html
Jake Quoting [EMAIL PROTECTED]: > This is what I have been doing to arrange my data in XML files. Its a bit > crooked way of organizing data but > it is read very easily and readily available in properties. > e.g. in your case I would change the format of the XML file to something > like this. > > <servers> > <server1>Machine1</server1> > <server2>Machine2</server2> > </servers> > <serverdetails> > <Machine1> > <ip>172.16.1.24</ip> > <JVM1> > <scripts> > <jvmStop>jvm1_stopscript.sh</jvmStop> > <jvmStart>jvm1_startscript.sh</jvmStart> > </scripts> > </JVM1> > <JVM3> > <scripts> > <jvmStop>jvm3_stopscript.sh</jvmStop> > <jvmStart>jvm3_startscript.sh</jvmStart> > </scripts> > </JVM3> > </Machine1> > <Machine2> > <Machine2> > </serverdetails> > > Notice that the data in <server> becomes the tag in <serverdetail> also to > uniquely identify different JVMs , you > have to make the JVM1 from attribute to a tag. > > Now to access this code > <xmlproperty file="XMLFIle" semanticattributes="true"/> > > this will create properties e.g. servers.server1=Machine1 , > serverdetails.Machine1.ip=172... > > For accessing specific machine details, the machine name has to come from > outside and you can > use the property-copy task in ant-contrib > For itterating over all machines, use the for or for-each task of > ant-contrib. > > This way you will have a very clean code. > all the best > bhaskar > > > > Hello: > > I am trying to figure out how to handle the data being passed to me by my > IT > department. They finally agreed to send me an xml document (see snippet > below) and that should have made my life much simpler. > > Maybe I should describe what I'm trying to do: > I am attempting to stop multiple resin jvm's on a given server. The xml > document I am getting from IT looks like: > <servers> > <server> > <name>Machine1</name> > <ip>172.16.1.24</ip> > <jvm name="JVM1"> > <scripts> > <jvmStop>jvm1_stopscript.sh</jvmStop> > <jvmStart>jvm1_startscript.sh</jvmStart> > </scripts> > </jvm> > <jvm name="JVM3"> > <scripts> > <jvmStop>jvm3_stopscript.sh</jvmStop> > <jvmStart>jvm3_startscript.sh</jvmStart> > </scripts> > </jvm> > </server> > <server> > <name>Machine2</name> > <ip>172.16.1.25</ip> > <jvm name="JVM2"> > <scripts> > <jvmStop>jvm2_stopscript.sh</jvmStop> > <jvmStart>jvm2_startscript.sh</jvmStart> > </scripts> > </jvm> > </server> > </servers> > > I've tried the task that Peter Reilly attached to one of the emails about > a > month ago for an XPath iterator but I can't seem to get it to work with > the > current ant-contrib tasks. I've also thought about doing this with the > xslt > task but that also seems like a headache (I can get a comma delimited > property for the different jvm names on a given server and then another > xslt > step to actually pull out the script names that I will then execute -- but > that just seems clunky). > > Has anyone else run into this type of problem or have some other solution > that I'm missing? Any recommendations on the xml document (I can get IT > to > change it if needed). The number of servers/jvms will change depending on > any number of factors so it's not always just going to be 2 machines and 3 > jvms... > > In advance, my hair thanks you (I've been pulling it out all morning > trying > to grasp how to handle this!). > Thanks, > Brent > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]