xpathnodeiterator.getattribute

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

    xpathnodeiterator.getattribute

    i have XpathNodeIterat or iterator. and i have some "od" attributes

    when i took that nodes with that attribute i dont get anything when i call
    iterator.Curren t.GetAttribute( "od", "")

    people please help, i cant do it anymore. this xml parser will kill me

    thanks!
  • Jon Skeet [C# MVP]

    #2
    Re: xpathnodeiterat or.getattribute

    gigs <gigs@hi.t-com.hrwrote:
    i have XpathNodeIterat or iterator. and i have some "od" attributes
    >
    when i took that nodes with that attribute i dont get anything when i call
    iterator.Curren t.GetAttribute( "od", "")
    >
    people please help, i cant do it anymore. this xml parser will kill me
    Could you post a short but complete program which demonstrates the
    problem?

    See http://www.pobox.com/~skeet/csharp/complete.html for details of
    what I mean by that.

    --
    Jon Skeet - <skeet@pobox.co m>
    Web site: http://www.pobox.com/~skeet
    Blog: http://www.msmvps.com/jon.skeet
    C# in Depth: http://csharpindepth.com

    Comment

    • gigs

      #3
      Re: xpathnodeiterat or.getattribute

      Jon Skeet [C# MVP] wrote:
      gigs <gigs@hi.t-com.hrwrote:
      >i have XpathNodeIterat or iterator. and i have some "od" attributes
      >>
      >when i took that nodes with that attribute i dont get anything when i call
      >iterator.Curre nt.GetAttribute ("od", "")
      >>
      >people please help, i cant do it anymore. this xml parser will kill me
      >
      Could you post a short but complete program which demonstrates the
      problem?
      >
      See http://www.pobox.com/~skeet/csharp/complete.html for details of
      what I mean by that.
      >
      thanks for replay, but i did it.

      Comment

      • Martin Honnen

        #4
        Re: xpathnodeiterat or.getattribute

        gigs wrote:
        i have XpathNodeIterat or iterator. and i have some "od" attributes
        >
        when i took that nodes with that attribute i dont get anything when i
        call iterator.Curren t.GetAttribute( "od", "")
        Well you will have to provide more details if you want specific help.

        Here is a working sample, the XML document is

        <?xml version="1.0" encoding="utf-8" ?>
        <root>
        <foo od="1"/>
        <foo od="2"/>
        </root>

        and the C# code

        XPathDocument doc = new XPathDocument(@ "..\..\XMLFile2 .xml");
        XPathNavigator nav = doc.CreateNavig ator();
        foreach (XPathNavigator nav2 in nav.Select("roo t/foo"))
        {
        Console.WriteLi ne("od: {0}", nav2.GetAttribu te("od", ""));
        }

        which outputs

        od: 1
        od: 2

        If you want help on your specific problem then you need to provide the
        XML you have and the exact code you have, all reduced to a minimum but
        complete enough to allow us to reproduce the problem.


        --

        Martin Honnen --- MVP XML

        Comment

        Working...