Reading From Multiple XML Files

This example code demonstrates reading data from multiple XML files. The code below is useful when you need to find specific text inside several XML files. The code uses DOM API, wherein the entire file is read into memory and stored in a hierarchical (tree-based) form to represent all the features of an XML document. This API is recommended if used on a lot of small files.

The file names are stored in a string which is splitted into and array. Using for each loop, it loads the files for further processing. In this case, it extracts data from "post" node list having "approved" status.

Sub ReadXmlFiles()

Dim str As String

Dim strArr() As String

str = "xmlfile1.xml,xmlfile2.xml,xmlfile3.xml"

strArr = str.Split(",")

For Each f As String In strArr

Dim xmldoc As XmlDocument = New XmlDocument()

Dim myNodes As XmlNodeList


Dim tnode As XmlNode
myNodes = root.SelectNodes(String.Format("post[status='app']"))

For Each tnode In tNodes

    // do something //


End Sub

VB.NET Code Snippets

Create Google-Style Snippets - Vb.NET code that uses regular expressions to create Google-style search results text snippets.

Reading From Multiple XML Files - Extract data from ultiple XML files and read the content using VB.NET

SRT To Text Online Converter - Online SEO tool to convert SRT file to text to extract closed caption info from YouTube video and create a transcript; strip transcript of stopwords; create list of most frequent keywords for search engine optimization.

Online Tool To Count Number of XML Sitemap Entries

Converting Strings To Hyperlinks

Count Words In A String

Display Random Image From XML File

Cross-Browser Text Centering

Extract N Number Of Words From String

Coding Bits and Bites

Visual Basic .NET, XML, Regular Expressions Code Snippets For Webmasters RSS Feed