473,398 Members | 2,393 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,398 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 6482
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: panik | last post by:
Hi, say I have an xml file with an X number of nodes I want to loop through (to, for example, display each node as a HyperLink in an asp.net webpage). Which of both is best practice: 1. Loop...
0
by: Ilian Nilsson | last post by:
Hi Al If I try to use the following code lines in an recursive (recurse down in Xml tree) manner the XPathNodeIterator gets reset in it's parent method call, which will end up in that all nodes...
2
by: avnrao via .NET 247 | last post by:
Hi, please clarify this doubt about XPathNodeIterator..the following XSLT uses this.. my doubt is, by looking at the XSLT, i thought the output to be Book1..but the actual output is...
3
by: John A Grandy | last post by:
XPathNodeIterator.Current.GetAttribute(localName As String, namespaceURI As String) i believe that localName should be set equal to the name of the attribute. but what should namespaceURI be...
3
by: KJ | last post by:
It is true that there is no way to get the outerXml of XPathNodeIterator.Current? Please say it isn't so.
2
by: Volkan | last post by:
Hi, I'm trying to compare two XML documents and i'm using XPath queries to select nodes. XPathNavigator's Select method runs fast enough and returns an XPathNodeIterator object. When i try to...
4
by: RobG | last post by:
I have always accessed attributes such as disabled using the DOM element property, however I was wondering about implementing a more generic function to get the values of attributes - which of...
3
by: gigs | last post by:
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...
6
by: Kindler Chase | last post by:
I'm trying to iterate through a set of nodes and then edit/delete specific attributes using XPathNodeIterator. Adding attributes is no problem. My first question is how do I delete an attribute...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.