Reading XML file with VB.Net
-
Hi, I'm trying to read a XML file in vb. I've found some code to explain how to read it using a dataset. The problem is that I can't read sub-section of my main table DVD. Here is the XML code of my file : 099720116493.9 099720-116493 Les Mystérieuses Cités d'Or L'integrale Les Mystérieuses Cités d'Or L'integrale Collector's Edition 2 Owned 90 AL 1982 2000-10-25 974 Animation 1.33 PAL False False True False False False False True False True False True True False False False False False False Sony Music Video
French MPEG Audio Stream Mono
0 0 0 0 $0.00 USD
-
Hi, I'm trying to read a XML file in vb. I've found some code to explain how to read it using a dataset. The problem is that I can't read sub-section of my main table DVD. Here is the XML code of my file : 099720116493.9 099720-116493 Les Mystérieuses Cités d'Or L'integrale Les Mystérieuses Cités d'Or L'integrale Collector's Edition 2 Owned 90 AL 1982 2000-10-25 974 Animation 1.33 PAL False False True False False False False True False True False True True False False False False False False Sony Music Video
French MPEG Audio Stream Mono
0 0 0 0 $0.00 USD
Hi I would load the xmldocument into a XmlDocument-class. Then I would use SelectNodes to fetch the proper information. Dim lstNode As XmlNodeList Dim xmlDoc As New XmlDocument() xmlDoc.Load("...\...path\file.xml") lstNode = xmlDoc.SelectNodes(strChoose) (strChoose is the "xpathway" to your information) (For each XmlNode in XmlNodeList, do build a string, use XmlNode.ChildNodes ) Regards // Daniel
-
Hi I would load the xmldocument into a XmlDocument-class. Then I would use SelectNodes to fetch the proper information. Dim lstNode As XmlNodeList Dim xmlDoc As New XmlDocument() xmlDoc.Load("...\...path\file.xml") lstNode = xmlDoc.SelectNodes(strChoose) (strChoose is the "xpathway" to your information) (For each XmlNode in XmlNodeList, do build a string, use XmlNode.ChildNodes ) Regards // Daniel
-
Thanks for the answer. Is it possible to know the name of the XML Element ? In my case I'd like to know, in the order, that I'm in : DVD ID UPC Title etc... Sybux
Hi I guess you mean XmlElement.Name ? Regards Daniel
-
Hi I guess you mean XmlElement.Name ? Regards Daniel
HI, I'm not familiar with XML name but I just want to know (from my exemple) the name of the "category" I'm in. The category for me is etc... If this is XMLElement so I need to get those information from the XMLNode (if possible). Thx Sybux </x-turndown>
-
HI, I'm not familiar with XML name but I just want to know (from my exemple) the name of the "category" I'm in. The category for me is etc... If this is XMLElement so I need to get those information from the XMLNode (if possible). Thx Sybux </x-turndown>
Now I´m lost, I´ve found an example from MS Imports System Imports System.IO Imports System.Xml public class Sample public shared sub Main() Dim doc as XmlDocument = new XmlDocument() doc.LoadXml("" & _ "1-861001-57-5" & _ "Pride And Prejudice" & _ "") 'Display information on the ISBN element. Dim elem as XmlElement elem = CType(doc.DocumentElement.ChildNodes.Item(0),XmlElement) Console.Write("{0} = {1}", elem.Name, elem.InnerText) Console.WriteLine(" namespaceURI=" + elem.NamespaceURI) end sub end class You can try that one. XmlElement.Name gives the name of the node. :confused: // Daniel