Questions tagged [xpathnodeiterator]
30 questions
3
votes
3 answers
2
votes
2 answers
How can i access the index of an XML Child using an XPathNavigator?
I want to create a compilestring to use it with an XPathExpression. I already navigated to a subset and have created an iterator. Based on the current Position of that iterator I create a new currentNode. Now I want to create the exact expression…

Johannes
- 6,490
- 10
- 59
- 108
2
votes
1 answer
Move Next on Multiple Name Iterators
I have two XPathNodeIterator nodeI1 and nodeI2.
I have a loop which should go through each
while(nodeI1.MoveNext())
How can I get this loop to automatically start nodeI2.MoveNext() after nodeI1 is done? I don't want to copy paste all the code and…

user391986
- 29,536
- 39
- 126
- 205
2
votes
1 answer
How do i loop thourgh XPathNodeIterator and randomize its children?
As per title, i need to create a method in C#/.NET 4 that can jumble the order a XPathNodeIterator object. The method needs to loop though all the child items ("/*") to randomly reorder the children.
I need some help to some to get started - All i…

atp03
- 3,539
- 3
- 17
- 20
1
vote
1 answer
XPathNodeIterator Current Value only for Parent
I am new to XPath.
Using C# I am trying to read the XML file which has a parent node and multiple child nodes
With XPathNavigator, I do a Select on root/parent and assign this value to XPathNodeIterator
XPathNodeIterator ni =…

Mayur Kotlikar
- 1,315
- 2
- 8
- 11
1
vote
3 answers
How do I use XPath to get the value of an attribute in c#?
I'd like to pass in an xpath query and return the value of what I find.
I'm looking for the value of an attribute specifically.
_query = "//@RequestType";
I can get the node back, but I'm not sure how to get the string value out of it.
I want to…

ScArcher2
- 85,501
- 44
- 121
- 160
1
vote
1 answer
How can I get element value from XPathNodeIterator?
When I try to code as this,
XPathNodeIterator it;
string selectStr = "Equipment/Group/item";
it = nav.Select(selectStr);
while (it.MoveNext())
{
String strVal = "";
if (it.Current.HasChildren)
{
strVal =…

Nano HE
- 9,109
- 31
- 97
- 137
1
vote
1 answer
How do I modify node value while iterating with XPathNodeIterator?
I'm navigating XML document with XPathNodeIterator, and I want to change some nodes' values.
I can't figure out how :(
Here's the code I'm using:
XPathDocument docNav = new XPathDocument(path);
XPathNavigator nav =…

flamey
- 2,311
- 4
- 33
- 40
1
vote
1 answer
xPath Evaluate vs XPathNodeIterator
I am searching the fastest way to count some tags in a huge xml-file (120MB)
long Quantity;
XPathDocument xDocData = new XPathDocument(str_File_path);
XPathNavigator xNavData = xDocData.CreateNavigator();
//Option 1
XPathExpression xExp =…

Florian
- 380
- 3
- 20
1
vote
1 answer
When I search under XPathNodeIterator.Current.SelectSingleNode, It simply searches in whole xml document
Hi I'm iterating in a list of XML nodes under an XML document using XPathNodeIterator. While iterating if condition matches, I need particular value under that current node. Instead, SelectSingleNode is returning node from other parent node...Let me…

Reg
- 21
- 2
1
vote
0 answers
How to do convert a collection of XPathNavigator objects to a XPathNodeIterator
How do I convert a collection of XPathNavigator objects into a collection of XPathNodeIterator objects?
Below is a sample code:
public XPathNodeIterator RandomizeXPathNodeIterator(XPathNodeIterator iterator)
{
List list = new…

atp03
- 3,539
- 3
- 17
- 20
1
vote
0 answers
offsetLeft Value Changes Unexpectedly
Consider the following code segment:
var iframe = document.createElement('iframe');
iframe.src = 'foobar.html';
document.body.appendChild(iframe);
iframe.onload = function () {
var nodeIterator = iframe.contentDocument.createNodeIterator(
…

Micah Henning
- 2,125
- 1
- 18
- 26
0
votes
1 answer
Why is this XPath expression getting too much data?
I have a XPath expression that is supposed to return/get only one node out of the XML document. But it is getting more than the one. I don't understand why.
Code-behind:
Dim xmlNameTbl As XmlNameTable = rootDoc.NameTable
Dim xmlNS As…

dotnetN00b
- 5,021
- 13
- 62
- 95
0
votes
1 answer
Looping through XPathNodeIterator problem
I've created a XPathNodeIterator that contains a few short XML segments (each with a file description):
XPathNodeIterator segments = node.SelectDescendants("Segment", node.NamespaceURI, false);
Now, when trying to loop them, it seems that only the…

Lauri I
- 228
- 1
- 4
- 11
0
votes
0 answers
Extracting the current XPath of the node from XPathIterator C#
I am writing a C# function where I need to fetch the value of a node using Xpath and if the fetched values matches a given string, I need to pass the Xpath to an API which replaces the current value of the node with value stored in Database.
The…

Karan Parikh
- 311
- 3
- 18