Questions tagged [selectsinglenode]

Selects the first Xml Node that matches the XPath expression

.NET
Selects the first XmlNode that matches the XPath expression. Any prefixes found in the XPath expression are resolved using the supplied XmlNamespaceManager.

Namespace:  System.Xml
Assembly:  System.Xml (in System.Xml.dll)

http://msdn.microsoft.com/en-us/library/h0hw012b(v=vs.110).aspx

Java

public abstract java.lang.Object selectSingleNode(java.lang.Object context)
                                           throws JDOMException

Evaluates the wrapped XPath expression and returns the first entry in the list of selected nodes (or atomics). Parameters: context - the node to use as context for evaluating the XPath expression. Returns: the first selected item, which may be of types: Element, Attribute, Text, CDATA, Comment, ProcessingInstruction, Boolean, Double, String, or null if no item was selected. Throws: JDOMException - if the evaluation of the XPath expression on the specified context failed.

http://www.jdom.org/docs/apidocs.1.1/org/jdom/xpath/XPath.html#selectSingleNode(java.lang.Object)

126 questions
-1
votes
1 answer

My Foreach Loop loops through a list of ChildNodes under a Main Node, and only selects the firstNode

I'm trying to loop through a list of ChildNodes under a main node, and I have the list of ChildNodes in a XMLNodeList. I've successfully looped through it, and that part of the code works, but it will only select the firstnode of the NodeList as I'm…
-1
votes
2 answers

XmlDocument SelectSingleNode of improperly formed XML

I have a XmlDocument which is not properly formed I want to do a XmlDocument.SelectSingleNode for 'lecturer' tag.…
Null Head
  • 2,877
  • 13
  • 61
  • 83
-2
votes
1 answer

htmlagilitypack selectsinglenode returning null

The problem about that is, it runs correctly just once in a 20 try or so and it is totally random. Couldnt handle the situation... help will be appreciated ^^ WebClient client = new WebClient(); client.Encoding = Encoding.UTF8; …
Can Arda Aydin
  • 204
  • 2
  • 13
-2
votes
1 answer

Parsing through innerHTML with HtmlAgilityPack

Just trying to figure out how to parse information from already parsed information. foreach (HtmlNode node in doc.DocumentNode.SelectNodes("//div [@class=\"result-link\"]")) { if (node == null) Console.WriteLine("debug"); else { …
Jordan M
  • 1
  • 2
  • 13
-2
votes
2 answers

how can i use a variable in this SelectSingleNode statement

how can i use a variable in this SelectSingleNode statement oldCd = root.SelectSingleNode("/students/student[id={0}]",id);
Hammam Muhareb
  • 355
  • 1
  • 4
  • 11
-3
votes
1 answer

What is wrong with this file or code?

What is happening \ what is the difference ? I'm trying to return a specific node from an XML File. XML File:
Pablo Costa
  • 125
  • 4
  • 14
1 2 3
8
9