Re: Selecting multiple fields, out of order, in a single Java XPathexpression

Discussion in 'XML' started by Martin Honnen, Jul 18, 2008.

  1. A. W. Dunstan wrote:

    > <top>
    > <date>
    > <year>2008</year>
    > <month>07</month>
    > <day>18</day>
    > <date>
    > </top>
    >
    > I'd like to do something like this (in Java):
    >
    > String date = anXPathObject.evaluate("/top/date/[day,month,year]", doc);
    >
    > and wind up with date having a value of "18072008". The "[day,month,year]"
    > (or whatever the syntax is) would tell XPath 'I
    > want /top/date/day, /top/date/month and /top/date/year extracted and
    > concatenated'.


    The XPath expression is
    concat(/top/date/day, /top/date/month, /top/date/year)

    --

    Martin Honnen
    http://JavaScript.FAQTs.com/
    Martin Honnen, Jul 18, 2008
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. darrel
    Replies:
    0
    Views:
    307
    darrel
    Sep 28, 2005
  2. Dave
    Replies:
    1
    Views:
    1,244
    Roy Schestowitz
    Jan 25, 2005
  3. Replies:
    0
    Views:
    275
  4. Eric
    Replies:
    1
    Views:
    153
  5. ela
    Replies:
    12
    Views:
    335
    Uri Guttman
    Apr 6, 2009
Loading...

Share This Page