Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. XML / XSL
  4. Reading XML file with VB.Net

Reading XML file with VB.Net

Scheduled Pinned Locked Moved XML / XSL
csharpxmlhelptutorial
6 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    sybux2000
    wrote on last edited by
    #1

    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

    A 1 Reply Last reply
    0
    • S sybux2000

      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

      A Offline
      A Offline
      adaoja
      wrote on last edited by
      #2

      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

      S 1 Reply Last reply
      0
      • A adaoja

        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

        S Offline
        S Offline
        sybux2000
        wrote on last edited by
        #3

        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

        A 1 Reply Last reply
        0
        • S sybux2000

          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

          A Offline
          A Offline
          adaoja
          wrote on last edited by
          #4

          Hi I guess you mean XmlElement.Name ? Regards Daniel

          S 1 Reply Last reply
          0
          • A adaoja

            Hi I guess you mean XmlElement.Name ? Regards Daniel

            S Offline
            S Offline
            sybux2000
            wrote on last edited by
            #5

            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>

            A 1 Reply Last reply
            0
            • S sybux2000

              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>

              A Offline
              A Offline
              adaoja
              wrote on last edited by
              #6

              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

              1 Reply Last reply
              0
              Reply
              • Reply as topic
              Log in to reply
              • Oldest to Newest
              • Newest to Oldest
              • Most Votes


              • Login

              • Don't have an account? Register

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • World
              • Users
              • Groups