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. Visual Basic
  4. Reading XML

Reading XML

Scheduled Pinned Locked Moved Visual Basic
xmlhelptutorial
4 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.
  • V Offline
    V Offline
    vivek_cs
    wrote on last edited by
    #1

    How to read xml from a string object. Reading XML from XML file is fine. but how to read XML from a string, at that time there was error

    M 1 Reply Last reply
    0
    • V vivek_cs

      How to read xml from a string object. Reading XML from XML file is fine. but how to read XML from a string, at that time there was error

      M Offline
      M Offline
      Martin Smith
      wrote on last edited by
      #2

      Its hard to give an example without knowing what the XML data is, that said, below is an example that will create an x-path navigator for XML data taken from a string variable:

      Dim sReader As New IO.StringReader(My\_XML\_Text\_string)
      Dim xDoc As New Xml.XPath.XPathDocument(sReader)
      Dim xNav As Xml.XPath.XPathNavigator = xDoc.CreateNavigator()
      

      The variable My_XML_Text_string contains your XML data.... At this point you can navigate through the XML nodes and attributes using the xNav instance Regards, Martin

      V 1 Reply Last reply
      0
      • M Martin Smith

        Its hard to give an example without knowing what the XML data is, that said, below is an example that will create an x-path navigator for XML data taken from a string variable:

        Dim sReader As New IO.StringReader(My\_XML\_Text\_string)
        Dim xDoc As New Xml.XPath.XPathDocument(sReader)
        Dim xNav As Xml.XPath.XPathNavigator = xDoc.CreateNavigator()
        

        The variable My_XML_Text_string contains your XML data.... At this point you can navigate through the XML nodes and attributes using the xNav instance Regards, Martin

        V Offline
        V Offline
        vivek_cs
        wrote on last edited by
        #3

        Way is fine but Error I am receiving is same, Same in case of XmlDocument. Error "Root Element is missing"

        M 1 Reply Last reply
        0
        • V vivek_cs

          Way is fine but Error I am receiving is same, Same in case of XmlDocument. Error "Root Element is missing"

          M Offline
          M Offline
          Martin Smith
          wrote on last edited by
          #4

          It would seem there is a problem with your XML data and not your programming. The Root Node from your XML data is missing -- what is your XML data?? Martin

          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