---
title: "Read all nodes and elements in XML (VB.net)"  
description: "Read all nodes and elements in XML (VB.net)"  
author: "Andrew Deniel"  
published: 2013-06-11  
updated: 2019-04-18  
canonical: https://www.mindstick.com/forum/1043/read-all-nodes-and-elements-in-xml-vb-dot-net  
category: "vb.net"  
tags: ["vb.net"]  
reading_time: 1 minute  

---

# Read all nodes and elements in XML (VB.net)

Hi [Expert](https://www.mindstick.com/articles/13120/an-expert-financial-advice-will-improve-your-finances),\
I'm [trying](https://answers.mindstick.com/qa/93698/6-mistakes-couples-are-trying-to-save-money) to read an [xml file](https://www.mindstick.com/forum/360/how-to-read-xml-file-in-php), there is no [problem](https://yourviews.mindstick.com/view/81399/tackling-the-problem-of-unemployment-during-corona-pandemic) to doing this\
But, in this case I will not know anything about this xml file, I just want to read everything, including all child nodes and get the [name](https://yourviews.mindstick.com/view/87450/how-to-generate-a-brand-name-using-linkedin-comprehensive-guide) and [value](https://www.mindstick.com/articles/23219/an-optimized-description-adds-value-to-experience-and-in-turn-effectively-guest-posting-packages) from each [node](https://www.mindstick.com/forum/161418/what-is-node-js-and-how-does-it-work).\
This [code](https://yourviews.mindstick.com/view/85458/alan-turing-the-mastermind-behind-cracking-the-enigma-code-during-world-war-ii) gives me only the name of the first node and skips all [children](https://yourviews.mindstick.com/view/81386/mobile-app-based-education-curse-or-boon-for-our-children):\
**Dim xml As New XmlDocument****xml.Load(myxml.xml)****For Each node As XmlNode In xml.DocumentElement.SelectNodes("*")** **MsgBox(node.Name)****Next**\
Since i don't know dept or anything, i don't know how I will do this. And every solution I find is based by knowing element names.\
Thanks in advance.

## Replies

### Reply by rahul kumar

Hope this will help you....\
\
http://vb.net-informations.com/xml/open-xml-vb.net.htm\
\
Patter\

### Reply by AVADHESH PATEL

Hi Andrew,\
You can try as following\
**Dim xml As New Xml.XmlTextReader(sFilePath)**\
**While xml.Read** **If xml.NodeType = Xml.XmlNodeType.Element Then** **MessageBox.Show(xml.Name)** **End If****End While****\**I hope it resolve your problem.


---

Original Source: https://www.mindstick.com/forum/1043/read-all-nodes-and-elements-in-xml-vb-dot-net

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
