Questions tagged [xmlnodelist]

XmlNodeList class represents an ordered collection of nodes

XmlNodeList class is present in both .NET and Java

.NET:
The XmlNodeList is returned by the following properties and methods.

  • XmlNode.ChildNodes - Returns an XmlNodeList containing all the children of the node.
  • XmlNode.SelectNodes - Returns an XmlNodeList containing a collection of nodes matching the XPath query.
  • GetElementsByTagName - Returns an XmlNodeList containing a list of all descendant elements that match the specified name.

Java
Implementation of the org.w3c.dom.NodeList interface

java.lang.Object
- extended by org.eclipse.persistence.platform.xml.XMLNodeList

119 questions
21
votes
4 answers

xpath to select nodes excluding by attribute value list

I would like to know if there is shorter approach to selecting a list of nodes ignoring the ones that have an attribute value specified in a list Working example: /item[not(@uid='id1') and not(@uid='id2')] Desired alternative: /item[not(@uid…
Aitorito
  • 225
  • 1
  • 2
  • 5
9
votes
1 answer

Combine XmlNodelist

Can any one please give me a solution to combine xmlNodelists to a single list .
Anjana
  • 1,381
  • 5
  • 21
  • 31
8
votes
3 answers

Loop through multiple subnodes in XML

VI VII abc def I have to loop through Classes to get 'Class' into…
user752709
  • 85
  • 1
  • 1
  • 4
5
votes
2 answers

Casting node to element giving ClassCastException

here n2 is my NodeList, and i just want to see the first child node of my root element public void ClickMe(View view){ Node rootElement=n2.item(0); NodeList child=rootElement.getChildNodes(); Node first=child.item(0); …
nam_ph
  • 233
  • 1
  • 3
  • 12
4
votes
2 answers

Parse node string to XMLNodeList

I'm curious, what would be the neatest way to parse a string of xml nodes to a XmlNodeList. For example; string xmlnodestr = "abc abc
wonea
  • 3,987
  • 17
  • 71
  • 134
4
votes
4 answers

How to get text inside an XmlNode

How do I get the text that is within an XmlNode? See below: XmlNodeList nodes = rootNode.SelectNodes("descendant::*"); for (int i = 0; i < nodes.Count; i++) { XmlNode node = nodes.Item(i); //TODO: Display only the text of only this node, …
joe
  • 15,556
  • 35
  • 90
  • 129
4
votes
2 answers

string to xmlNode delphi (or how to add an xml fragment to TXMLDocument)

I Have a few text strings that contain well formed XML. I would like to be able to (1) turn these strings into IXMLNodes then (2) append them to an existing XMLDocument. Preferably without declaring a new XMLDocument first. This doesn't seem…
sse
  • 924
  • 1
  • 9
  • 26
3
votes
3 answers

NodeList Data is not getting removed

I have an array object which has 3 objects. I want to remove all the objects except the first one. Here is my data which I got from XML: mrArr[0] = "Val" = "5" mrArr[1] =
David
  • 3,583
  • 3
  • 23
  • 48
3
votes
1 answer

appending a new node to a nodelist using foreach loop and XmlNodeList C#

Currently I am dealing with this is the type of XML: XML FILE With reference to the XML file, I want to check for a node, if the node is not found, I have to append the node to the file. I have tried the following code: private void…
3
votes
4 answers

How to get all child nodes of an XML in C#

I've an XML document like this: A 100 C 300 C1
1teamsah
  • 1,651
  • 3
  • 19
  • 38
3
votes
1 answer

How to get the full path of a node in XML file in java?

I have XML file parsed by XPath to get all the parameters in it, and then i want to get the full path to each parameter but my code didn't work for some reason. The Code: ArrayList names = new ArrayList(); ArrayList paths =…
Muhammed Refaat
  • 8,096
  • 11
  • 76
  • 108
2
votes
1 answer

Select XML node value by attribute value with multiple levels

I'm looking to get to value further in the XML code than I've seen examples for and with more attributes to consider. The XML code is:
BenG
  • 13,680
  • 4
  • 41
  • 57
2
votes
1 answer

printing list of xml nodes in c#

I am need bit of help on getting list of xml nodes and printing them. My code is as below: XmlDocument doc = new XmlDocument(); doc.Load("To44532.xml"); XmlNode xn = doc.DocumentElement; foreach (XmlNode xn2 in xn) …
2
votes
2 answers

VB.Net Use XmlNodeList in a parallel ForEach

I have a piece of code that iterates over the nodes in an XmlNodeList and creates a different object for each one depending on the node name and adds it to a list for printing. For Each node as XmlNode In nodeList Select Case…
starx207
  • 297
  • 2
  • 16
2
votes
5 answers

Reading an XML in C#

I'm using System.Xml to read a xml file in C#. First I open the file (locally)... and use foreach to get the values, like this: XmlNodeList titles = xmlDoc.GetElementsByTagName("title"); foreach (XmlNode title in titles) { rowNews = new…
Badr Hari
  • 7,255
  • 17
  • 60
  • 97
1
2 3 4 5 6 7 8