L
lgbjr
Hi All,
I need some help getting data from an XML file into a dataset. The XML file
has more data in it than I actually need. So, what I think I need to do is
to create a dataset with the tables and columns that I need, then use the
dataset.ReadXml to put the data into the tables.
So, I've created a dataset, created 3 tables, each with 2 columns. I have
three dataviews on a form linked to these tables. So far, this is what I'm
doing:
Private Sub Load_XML_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Load_XML.Click
Dim result As DialogResult = XML_Picker.ShowDialog
If result = Windows.Forms.DialogResult.OK Then
Dim fsReadXml As New System.IO.FileStream(XML_Picker.FileName,
System.IO.FileMode.Open)
Dim myXmlReader As New System.Xml.XmlTextReader(fsReadXml)
DataSet1.ReadXml(myXmlReader, XmlReadMode.IgnoreSchema)
myXmlReader.Close()
End If
End Sub
I have an XSLT file for the XML file, but I'm not sure how to use it or if I
need it to aid in getting this data into the dataset. I'm sure I'm missing
100 steps in doing this, but I don't know what they are. All of the examples
I have looked at show how to write an XML file from a dataset, then read
that XML file into a new dataset. Unfortunately, none of the samples create
a file that looks anything like the XML file I'm starting with, so I'm a bit
lost.
TIA
Lee
I need some help getting data from an XML file into a dataset. The XML file
has more data in it than I actually need. So, what I think I need to do is
to create a dataset with the tables and columns that I need, then use the
dataset.ReadXml to put the data into the tables.
So, I've created a dataset, created 3 tables, each with 2 columns. I have
three dataviews on a form linked to these tables. So far, this is what I'm
doing:
Private Sub Load_XML_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Load_XML.Click
Dim result As DialogResult = XML_Picker.ShowDialog
If result = Windows.Forms.DialogResult.OK Then
Dim fsReadXml As New System.IO.FileStream(XML_Picker.FileName,
System.IO.FileMode.Open)
Dim myXmlReader As New System.Xml.XmlTextReader(fsReadXml)
DataSet1.ReadXml(myXmlReader, XmlReadMode.IgnoreSchema)
myXmlReader.Close()
End If
End Sub
I have an XSLT file for the XML file, but I'm not sure how to use it or if I
need it to aid in getting this data into the dataset. I'm sure I'm missing
100 steps in doing this, but I don't know what they are. All of the examples
I have looked at show how to write an XML file from a dataset, then read
that XML file into a new dataset. Unfortunately, none of the samples create
a file that looks anything like the XML file I'm starting with, so I'm a bit
lost.
TIA
Lee