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
4
votes
5 answers

SelectNodes with XPath ignoring cases in node names

I have a problem similar to the question SelectNodes with XPath ignoring cases but in my case the uppercase/lowercase problem is in the node with the name 'application' (Sometimes is 'Application' other times 'application'). How would i apply the…
VSP
  • 2,367
  • 8
  • 38
  • 59
3
votes
1 answer

C# Using XPATH to select specific element with known values, then delete

I am new to xpath in C# and I am trying to select an element that has two specific values. This is what the XML format looks like 443
FeatherKing
  • 57
  • 2
  • 7
3
votes
2 answers

How to iterate through all element in XML in Select Nodes

I am really new at c#. I am creating a project where I need to extract data from a XML file. I can select one single node and loop through the innertext of that element. But I have several elemt in the XML file. I want to loop throght all the elemt…
tamrezh21
  • 125
  • 4
  • 14
3
votes
4 answers

Using SelectSingleNode with XPath returns NULL

I trying to modify an XML file with SelectSingleNode. The structure of file is
Sergey Konkin
  • 95
  • 1
  • 3
  • 9
2
votes
2 answers

XmlDocument.SelectSingleNode omit prefixes and namespaces

This question is a follow up of the answered question: XmlDocument.SelectSingleNode and prefix + xmlNamespace issue The problem is that its possible that in the future the namespaces prefixes of the xml received will be changed without warning, so…
VSP
  • 2,367
  • 8
  • 38
  • 59
2
votes
1 answer

I'm trying to replace Xpath with jQuery

Android browser not support XpathEvaluator Object. I'm trying to replace with Xpath with JQuery. For example, 01. oRoot.selectSingleNode("step/person"); -> $(oRoot).find("step person"); 02. oRoot.selectSingleNode("step/person[@color='red' and…
Jeuk Shin
  • 85
  • 2
  • 9
2
votes
2 answers

XML XPath SelectSingleNode issues

I am trying to select certain nodes inside of childnodes of the main document. XmlNodeList nodes = xml.SelectNodes("//RECORD"); for (int i = 0; i < nodes.Count; i++) { Console.WriteLine("Time: " +…
Kyle Uithoven
  • 2,414
  • 5
  • 30
  • 43
2
votes
2 answers

C# SelectSingleNode with NameSpace issues

I am using C# (.NET 2.0) -- actually trying to have it working on Mac OS X using MONO (I don't think MONO is the issue) Given the following XML fragment which has been retrieved as a XmlNode from a bigger XmlDocument:
2
votes
3 answers

SelectSingleNode and namespace - can't find nodes (using namespace mgr)

I have a relativly complex xml message I am recieving from a partner company. I need to parse up the xml to use it. I had it working fine, then they changed the message all around and now none of my SelectSingleNode commands work. Structure of the…
Alan Gieseke
  • 681
  • 2
  • 6
  • 8
2
votes
1 answer

XPath not working with SelectSingleNode

private const string TECHACCOUNTAMTITEM_AMT_XPATH = @"//Part[translate(@Type, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'abcdefghijklmnopqrstuvwxyz') =…
RahulJha
  • 63
  • 8
2
votes
1 answer

C# Xml SelectSingleNode returns null

I have this xml and want to extract the first Country out of the xml Hong KongCheung Chau
sunsun
  • 33
  • 1
  • 5
2
votes
1 answer

Selecting an XML Node

I am doing something very simple. I'm trying to retrieve a node from a small XML file.
TheFootClan
  • 165
  • 1
  • 3
  • 12
2
votes
1 answer

Select specific node next to another - C# - SelectSingleNode

I have an XML file that have two nodes with same name, and need to validate if the first one exist. I'm trying to do with SelectSingleNode and I found some XPath examples. XML File
2
votes
1 answer

xpath issue with selectSingleNode when switch to XML 6

This is my XML: When using DomDocument(ver 3) I could run the following(In VB6): Set objNode = objDom.documentElement.selectSingleNode("//.[@Index = '1']") This is to identify…
Doron
  • 21
  • 1
2
votes
3 answers

selectSingleNode works but not selectNodes

Javascript: var req=xmlDoc.responseXML.selectSingleNode("//title"); alert(req.text); as expected, returns the text of the first "title" node. but this var req=xmlDoc.responseXML.selectNodes("//title"); alert(req.text); returns "undefined." The…
1
2
3
8 9