XML Data

  • Thread starter Thread starter NachoShaw
  • Start date Start date
N

NachoShaw

Guest
Hey

Was kinda hoping that getting XML data from XML would be more straight forward than it is... It seems a bit limited with multiple ways of getting the same data, i have found my self with different methods and its becoming a little confusing.

I need to iterate through a series of Elements to get the nodes name & value. This is what im using

xml_doc.Load(loadedXMLdocAsPath)
Dim revisionNodeList As XmlNodeList = xml_doc.GetElementsByTagName("revision")
For Each node1 As XmlNode In revisionNodeList
Debug.Print(node1.Name & " - " & node1.Value)
Next

Dim generalNodeList As XmlNodeList = xml_doc.GetElementsByTagName("general")
For Each node2 As XmlNode In generalNodeList
Debug.Print(node2.Name & " - " & node2.Value)
Next


The only results i get are

revision -

general -

for each element, there are about 20 nodes with data than i need to get. What is the best most efficient less complicated way of getting the node data name & value?

Also


i have 5 elements in total. This current method is looping the xml document 5 times (1 for each). is there a more efficient way of doing this so that im only looping the xml document once? its a large document and takes a good 5 mins to complete. If i could reduce the amount of iterations, the speed would improve. I was thinking about looping the whole xml into a temporary datatable and obtain my results that way but first i need to get the data out!


any help is greatly appreciated


Thanks



Nacho is the derivative of Nigel - True fact! I am self taught in VB.Net. 50% of the time, I am right 100% of the time!

Continue reading...
 
Back
Top