Question about an xpath depending on two xml nodes - XML SOAP

This is a discussion on Question about an xpath depending on two xml nodes - XML SOAP ; Hi, in my case I've got the following XML document: <doc> <item> <foo>1</foo> <bar>a</bar> </item> <item> <foo>2</foo> <bar>b</bar> </item> </doc> My question is, if it is possible to read out the value of a child if another childnode has a ...

+ Reply to Thread
Results 1 to 3 of 3

Question about an xpath depending on two xml nodes

  1. Default Question about an xpath depending on two xml nodes

    Hi,

    in my case I've got the following XML document:

    <doc>
    <item>
    <foo>1</foo>
    <bar>a</bar>
    </item>
    <item>
    <foo>2</foo>
    <bar>b</bar>
    </item>
    </doc>

    My question is, if it is possible to read out the value of a child if
    another childnode has a specific value. In my example I want to read out
    the value of the foo node when the value of the bar node is an 'a'. Is
    this possible?

    Thanks in advance
    Martin

  2. Default Re: Question about an xpath depending on two xml nodes

    Martin Horst wrote:

    > My question is, if it is possible to read out the value of a child if
    > another childnode has a specific value. In my example I want to read out
    > the value of the foo node when the value of the bar node is an 'a'. Is
    > this possible?


    Yes, easily,
    /doc/item[bar = 'a']/foo


    --

    Martin Honnen --- MVP XML
    http://JavaScript.FAQTs.com/

  3. Default Re: Question about an xpath depending on two xml nodes

    Hi,

    Martin Honnen schrieb:
    > Martin Horst wrote:
    >
    >> My question is, if it is possible to read out the value of a child if
    >> another childnode has a specific value. In my example I want to read
    >> out the value of the foo node when the value of the bar node is an
    >> 'a'. Is this possible?

    >
    > Yes, easily,
    > /doc/item[bar = 'a']/foo
    >
    >


    yeah thanks. This is realy easy. I thought this is only possible with
    attributes. I think I'm falling in love with xpaths.


    Best regards
    Martin

+ Reply to Thread

Similar Threads

  1. xpath and sorting nodes
    By Application Development in forum DOTNET
    Replies: 0
    Last Post: 08-08-2007, 05:42 PM
  2. XPath - returning nodes if all childnodes exist
    By Application Development in forum XML SOAP
    Replies: 1
    Last Post: 07-03-2007, 07:21 AM
  3. Re: XPATh getting the following-sibling of a set of nodes
    By Application Development in forum XML SOAP
    Replies: 0
    Last Post: 12-21-2006, 11:48 PM
  4. xpath to check for equal values in different nodes
    By Application Development in forum XML SOAP
    Replies: 2
    Last Post: 05-25-2006, 07:53 AM
  5. Replies: 6
    Last Post: 04-25-2005, 03:37 PM