Reading XML
-
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
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 -
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 -
Way is fine but Error I am receiving is same, Same in case of XmlDocument. Error "Root Element is missing"
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