XML parsing

  • Thread starter Thread starter DumberThanSnot
  • Start date Start date
D

DumberThanSnot

I have the following:

Dim xmlPSELL As New XmlDataDocument
Dim sXML as String

sXML = (some well formed XML code)

xmlPSELL.LoadXml(sXML)



so far this works just fine...
now I want to be able to load the sXML string into the xmlPSELL.DataSet.
How the heck do I do something like this:

xmlPSELL.DataSet.LoadXml(sXML)

Thanks,
Brian
 
Hi Brian,

If I see it good than is this a mistake that is often made.

A dataset can be represented and used as an XML file.

An XML file is not a dataset.

So you first have to create your dataset (using the designer, code does not
mather) and then you can fill that dataset.

Is your XML file conform the XML dataset than it is just read the dataset
with mydataset.readXML(myxmlfile.xml)

Others you will have to go to the XML file reading/processing your XML doc.

You can use for that the XMLreader or as you said by using loadXML

I hope this helps?

Cor
 
Cor,

I saw in the documentation where I could load it as a file. The only
problem is, I'm receiving the XML string via a TCP/IP packet... so, I would
hate to save every packet as a file, then load it in again. I guess my
ideal way to do this would be to convert the string to a format that the
readXML function could use.

But, I think you may be right... I might have to save it as a file first,
then read it in again.

Thanks for your help,
Brian
 
Hi,

It is very simple to do this. You should do something like this:

dataSet.LoadXml(new StringReader(sXml))

Thanks
 
Back
Top