Reading XML subtree

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Jose Oliver

    #1

    Reading XML subtree

    I am trying to figure out the best approach on reading a
    portion of an XML file.

    I have the following:

    <Employees>

    <Employee>
    <Name>John Doe</Name>
    <Address>...
    </Employee>

    <Employee>
    <Name>Jane Doe</Name>
    <Address>...
    </Employee>

    I only need to read all the child elements below the
    <Address> for John Doe.

    How can I do this?

    - j. oliver



  • Peter Rilling

    #2
    Re: Reading XML subtree

    Just load it into an XmlDocument and use an XPath.

    It's been a while, but something like "/Employees/Employee[Name = 'John
    Doe']/Address/*".

    "Jose Oliver" <jose_oliver@ho tmail.com> wrote in message
    news:02b501c395 db$cdb34440$a30 1280a@phx.gbl.. .[color=blue]
    > I am trying to figure out the best approach on reading a
    > portion of an XML file.
    >
    > I have the following:
    >
    > <Employees>
    >
    > <Employee>
    > <Name>John Doe</Name>
    > <Address>...
    > </Employee>
    >
    > <Employee>
    > <Name>Jane Doe</Name>
    > <Address>...
    > </Employee>
    >
    > I only need to read all the child elements below the
    > <Address> for John Doe.
    >
    > How can I do this?
    >
    > - j. oliver
    >
    >
    >[/color]


    Comment

    Working...