ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From peter reilly <peter.rei...@corvil.com>
Subject Re: XML property
Date Tue, 25 Nov 2003 14:58:58 GMT
On Tuesday 25 November 2003 13:44, Jan.Materne@rzf.fin-nrw.de wrote:
> I remember ... several months ago I read about a way to iterate over a xml
> file using XPath ...
>
> yep: www.krysalis.org/cgi-bin/krywiki.pl?AntJXPath
>
> I had nothing done with that, but maybe its useful for you.

The code for jxpath and xmldom has been placed is in the embed proposal.
The tasks/types can be used nearly as-is in ant 1.6:

  <jxpath/> <!-- register the jxpath property prefix -->

  <!-- load the conf.xml as a reference to a dom object "conf.xml" -->
  <xmldom id="conf.xml" file="conf.xml"/>
 
  <!-- iterate over the xpath contents of conf/utility/project -->
  <ac:for list="${jxpath:/references/conf.xml/root/conf/utility/project}"
          param="project">
    <ac:sequential>
      <echo>Do project '${project}'</echo>
    </ac:sequential>
  </ac:for>

outputs:
Do project 'a'
Do project 'b'
Do project 'c'
Peter
>
>
> Jan
>
> > -----Original Message-----
> > From: Morten S. Mortensen [mailto:morten.mortensen@tietoenator.com]
> > Sent: Tuesday, November 25, 2003 12:47 PM
> > To: Ant Users List
> > Subject: RE: XML property
> >
> >
> >
> > ...Just saw the referred answer from last week, because I
> > miss the ability to read lists too - would be very, very
> > usable, if lists could be picked from somewhere inside a
> > XML-config-something-file and converted *without* using XSLT.
> >
> > Something to consider for a future version of "xmlproperty" -
> > or a custom task, which I do.
> >
> > Regarding a custom task, I do consider implementing a
> > antcall/foreach-variant, which should corresponds to a
> > sequential, SAX-like traversal, since this could partly or
> > fully cope with more complex elements not just having a
> > simple body. It is a thought.
> >
> > Regards,
> > Morten Sabroe Mortensen
> >
> >
> > -----Original Message-----
> > From: Jan.Materne@rzf.fin-nrw.de [mailto:Jan.Materne@rzf.fin-nrw.de]
> > Sent: 25. november 2003 09:01
> > To: user@ant.apache.org
> > Subject: RE: XML property
> >
> >
> > That was asked (and answered) last week :-)
> > http://marc.theaimsgroup.com/?l=ant-user&m=106923753023384&w=2
> >
> >
> > Jan
> >
> > > -----Original Message-----
> > > From: Laurent P. [mailto:worklap@yahoo.fr]
> > > Sent: Tuesday, November 25, 2003 8:54 AM
> > > To: Ant Users List
> > > Subject: XML property
> > >
> > >
> > > Hello,
> > >
> > > I 'm using Ant 1.5.3 under WSAD 5.1.
> > > I would like to access properties list via <xmlproperty>.
> > >
> > > My XML file :
> > > <conf>
> > >    <utility>
> > >       <project>a</project>
> > >       <project>b</project>
> > >       <project>b</project>
> > >    </utility>
> > > </conf>
> > >
> > > I would like to access all <project> properties (a, b, c) as a
> > > coma-separed list (or any list) to iterate on it with <foreach>.
> > >
> > > <xmlproperty file="file.xml"/>
> > > <echo message="${conf.utility.project}"/> ==> [echo] a
> > > I have only the first child of <utility>.
> > >
> > > I tried with :
> > > <conf>
> > >    <utility>
> > >       <project name="aa">a</project>
> > >       <project name="bb">b</project>
> > >       <project name="cc">c</project>
> > >    </utility>
> > > </conf>
> > > but I had the same result.
> > >
> > > Any idea?
> > >
> > > Thank's for advance.
> > > Laurent
> >
> > ---------------------------------------------------------------------
> >
> > > To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> > > For additional commands, e-mail: user-help@ant.apache.org
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> > For additional commands, e-mail: user-help@ant.apache.org


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


Mime
View raw message