471,357 Members | 1,177 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,357 software developers and data experts.

xpathnodeiterator.getattribute

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!
Jun 1 '08 #1
3 6381
gigs <gi**@hi.t-com.hrwrote:
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.

--
Jon Skeet - <sk***@pobox.com>
Web site: http://www.pobox.com/~skeet
Blog: http://www.msmvps.com/jon.skeet
C# in Depth: http://csharpindepth.com
Jun 1 '08 #2
Jon Skeet [C# MVP] wrote:
gigs <gi**@hi.t-com.hrwrote:
>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.
thanks for replay, but i did it.
Jun 1 '08 #3
gigs wrote:
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.
--

Martin Honnen --- MVP XML
http://JavaScript.FAQTs.com/
Jun 1 '08 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

reply views Thread by Ilian Nilsson | last post: by
2 posts views Thread by avnrao via .NET 247 | last post: by
3 posts views Thread by John A Grandy | last post: by
3 posts views Thread by KJ | last post: by
4 posts views Thread by RobG | last post: by
3 posts views Thread by gigs | last post: by
reply views Thread by XIAOLAOHU | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.