Re: A (simple) XPath Question.

Discussion in 'XML' started by Mukul Gandhi, Dec 7, 2008.

  1. Mukul Gandhi

    Mukul Gandhi Guest

    Here is another way (not as elegant as Martin's solution),

    /*[local-name() = 'ItemInformation']/*[local-name() = 'ItemDetails']/*
    [local-name() = 'Title']

    Though this will cause a problem, if there are elements with same
    local name but different namespace URIs. But it seems this could work
    for you.

    Writing like this

    //*[local-name() = 'Title']

    could have been easily acceptable, but writing local-name() function
    at every step is certainly inelegant. you can use what I wrote if you
    want ...

    On Dec 6, 8:05 pm, Bubba <> wrote:
    > Hi Group,
    >
    > I have been given a file in the following format:
    >
    > <ItemInformation xmlns="http://tempuri.org/ItemInfo.xsd">
    >    <ItemDetails>
    >      <Title>This is the item title</Title>
    >      <State>This is the item state</State>
    >      <ItemCost ... />
    >      <ItemCost ... />
    >      <ReOrder>
    >         <MinLevel>25000</MinLevel>
    >         <MaxLevel ... />
    >      </ReOrder>
    >    </ItemDetails>
    > </ItemInformation>
    >
    > The ItemInfo.xsd file does not exist. But how do I extract the Title
    > element using XPath from this file? I've tried all manner of syntax but
    > never get any results, can anyone help here please.
    Mukul Gandhi, Dec 7, 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. Marvin_123456

    "Memory leak" in javax.xml.xpath.XPath

    Marvin_123456, Jul 29, 2005, in forum: Java
    Replies:
    4
    Views:
    1,964
    jan V
    Jul 29, 2005
  2. Alastair Cameron
    Replies:
    1
    Views:
    7,391
    SQL Server Development Team [MSFT]
    Jul 8, 2003
  3. Anna
    Replies:
    0
    Views:
    519
  4. goog
    Replies:
    0
    Views:
    504
  5. Tjerk Wolterink

    XPath: efficiency in xpath expressions

    Tjerk Wolterink, Nov 13, 2004, in forum: XML
    Replies:
    1
    Views:
    1,622
    Richard Tobin
    Nov 13, 2004
Loading...

Share This Page