Selects a list of nodes matching the XPath expression.
Questions tagged [selectnodes]
120 questions
55
votes
4 answers
SelectSingleNode returns null when tag contains xmlNamespace
I'm loading a string into an XML document that contains the following structure:
…

Shlomi Komemi
- 5,445
- 3
- 28
- 41
53
votes
4 answers
How to select all leaf nodes using XPath expression?
I believe it's possible but couldn't figure out the syntax. Something like this:
xmlNode.SelectNodes("//*[count(child::*) <= 1]")
but this is not correct.

newman
- 6,841
- 21
- 79
- 126
14
votes
3 answers
C# XmlDocument SelectNodes is not working
I want to get the value from XML file but I failed. Can you please help me point out the problem ?? Because I already tried very hard to test and googling but I still can't spot the problem.
XML :
…

user2402624
- 211
- 1
- 4
- 10
8
votes
2 answers
How to create Conditional Xpath statement?
I want to select xml node with conditional Xpath like-
xmlnode.SelectSingleNode("if (ns:substanceAdministration/ns:consumable/@typeCode == UNK) then evaluateThisXpath else evaluateOtherXpath")
my concern is-

patel
- 1,533
- 4
- 14
- 15
7
votes
3 answers
XElement to get all sub-element node names and values
I'm thinking of an approach something like this.
Please let me know if this can actually work this way:
For Sample XML:
abc
def
123
456
…

Loser Coder
- 2,338
- 8
- 42
- 66
6
votes
2 answers
XmlDocument.SelectSingleNode and prefix + xmlNamespace issue
I have the following string loaded to an XML document:
…

VSP
- 2,367
- 8
- 38
- 59
6
votes
2 answers
HtmlAgilityPack SelectNodes expression to ignore an element with a certain attribute
I am trying to select nodes except from script nodes and a ul that has a class called 'relativeNav'. Can someone please direct me to the right path? I have been searching for this for a week and I can't find it anywhere. Currently I have this but it…

thaky
- 63
- 1
- 4
5
votes
3 answers
XmlNodeList (why is this empty)
I can't understand why this NodeList is Empty
XmlDocument document = new XmlDocument();
document.Load(xmlpath);
XmlNodeList nodes = document.SelectNodes("/StructureResponse/rootItem/attributes/Attribute");
Here the XmlFile

Stefan Schnake
- 93
- 1
- 2
- 8
4
votes
6 answers
Basics of XmlNode.SelectNodes?
I'm not sure why this isn't working.
I have an XmlNode in a known-format. It is:
<[setting-name]>
<[block-of-xml-to-process]/>
<[block-of-xml-to-process]/>
<[block-of-xml-to-process]/>
…

Yes - that Jake.
- 16,725
- 14
- 70
- 96
4
votes
3 answers
SelectNodes and GetElementsByTagName
what are main differences between SelectNodes and GetElementsByTagName.

Jason
- 363
- 1
- 8
- 19
3
votes
4 answers
select elements with the name attribute name in special xml structure
below is the structure of my xml document. I just want to first take the value of every node then make a comparison of it with a given value. However I don't how to locate of each node using xml selectnodes…

user1154138
- 193
- 1
- 3
- 9
3
votes
2 answers
javascript selectNodes on parsed xml
How can I use the selectNode() function on a parsed XML message in javascript?