Unanswered: Load XML file to an array in VB.Net Console application
Spent lots of time looking around , reading MSDN help and whatnot.
I don`t seem to get the right answer still.
What I would like to do is To parse XML file to an array in vb.net console application.The XML file is very simple. The thing is that after I have the values of the XML file in an array I will need to be able to use the values in the array as parameters so I can compare against them while reading a txt file row by row.
So far I got the XML file read and displayed in the cmd prompt window.No idea how would I get further to accomplish the rest.
I think If I can get the first step bind the XML elements in an array the rest I will manage , although never done that before.
Here is an example of the XML file
Ok a little bit explaining what is what
String Name element is the string bit I will need to lookup/ compare against in the text file , it will be of type String.
CountStart end positions will be used to tell the program from what character in the text file in each row would the search for the particular string start searching the string and CountEnd is the last Character where the search in the row in the text file should stop.These should be of type integer
For example let say we have a text file that has a row like this
VVNNMN HUIMKOIB BGTUUOLKJHG VFAAAAAAAANMMM
and let`s suppose the AAAAAAAA is between the 96 and 103 character in every row. So what we need to do is verify if any of the strings in the XML document with their corresponding start and end count positions are present in a row in the original file.
Every row will be checked.
I am not really sure how I can pass the element values in an array and then maybe in the code for reading the text file I should refer to every value in the array as parameter.
I would be really grateful if anyone can help me out.
So far what I managed to write as code is:
Dim m_xmld As XmlDocument
Dim m_nodelist As XmlNodeList
Dim m_node As XmlNode
'Create the XML Document
m_xmld = New XmlDocument()
'Load the Xml file
'Get the list of name nodes
m_nodelist = m_xmld.SelectNodes("/Strings/String")
'Loop through the nodes
For Each m_node In m_nodelist
'Get the Name Element Value
Dim NameValue = m_node.ChildNodes.Item(0).InnerText
'Get the Count Start Position Value
Dim CountStartPositionValue = m_node.ChildNodes.Item(1).InnerText
'Get the Count End Position Value
Dim CountEndPositionValue = m_node.ChildNodes.Item(2).InnerText
'Write Result to the Console
Console.Write(" Name: " & NameValue & " CountStartPositionValue: " _
& CountStartPositionValue & " CountEndPositionValue: " _