finding a specific child node

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • apandapion@gmail.com

    #1

    finding a specific child node

    I'm new to programatic manipulation of XML, and I'm sure I'm not doing
    everything in the best way. In specific, I have a number of pieces of
    code that look like this:

    string foo="";
    foreach (XmlNode xnii in xni.ChildNodes)
    {
    switch (xnii.Name)
    {
    case "foo":
    foo = xnii.InnerText;
    break;
    }
    }

    There's a better way to write that code block, I'm sure, but I'm
    working to reach a deadline to provide some XML interfaces to some Java
    coders and I don't have time to research best practices beyond relying
    on the generosity of the group.

    TIA,
    ap

  • Vadym Stetsyak

    #2
    Re: finding a specific child node

    Hello, apandapion@gmai l.com!

    a> There's a better way to write that code block, I'm sure, but I'm
    a> working to reach a deadline to provide some XML interfaces to some Java
    a> coders and I don't have time to research best practices beyond relying
    a> on the generosity of the group.

    You can use XmlNode.SelectS ingleNode(...) XmlNode.SelectN odes(...)

    --
    Regards, Vadym Stetsyak
    www: http://vadmyst.blogspot.com

    Comment

    Working...