xpathnodeiterator.getattribute

  • Thread starter Thread starter gigs
  • Start date Start date
G

gigs

i have XpathNodeIterator iterator. and i have some "od" attributes

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

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

thanks!
 
gigs said:
i have XpathNodeIterator iterator. and i have some "od" attributes

when i took that nodes with that attribute i dont get anything when i call
iterator.Current.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.
 
gigs said:
i have XpathNodeIterator iterator. and i have some "od" attributes

when i took that nodes with that attribute i dont get anything when i
call iterator.Current.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.CreateNavigator();
foreach (XPathNavigator nav2 in nav.Select("root/foo"))
{
Console.WriteLine("od: {0}", nav2.GetAttribute("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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top