Looking for some XML guidance

RibTime

Member
Joined
Aug 11, 2005
Messages
10
Location
South Coast UK
Programming Experience
10+
I'm quite new to VB.net and now seem to be jumping into the fire by trying to process an XML file into an Access Database.

Here is what I have

If I run code

PHP:
Dim ds As New DataSet("XMLDataSet")
Dim xmlDocument As New XmlDocument
 
xmlDocument = New XmlDocument
xmlDocument.Load("Z:\ReadXML\XML Source\vtvSmall.xml")
 
ds.ReadXml("Z:\ReadXML\XML Source\vtvSmall.xml")
 
 
DataGrid1.DataSource = ds
 
Dim introw As Integer
 
For introw = 0 To (ds.Tables(0).Rows.Count - 1)
 
Debug.WriteLine(ds.Tables(0).Rows(introw).Item(0))
Debug.WriteLine(ds.Tables(1).Rows(introw).Item(0))
 
Next

Against the following XML file, which I have shortened for this post..

PHP:
<xyz_report>
<xyz_data>
<volser>V00024</volser>
<management_class>STKV</management_class>
<Subsystem_Name>SYSTEMA</Subsystem_Name>
<ABC_instance>
<volser>ABC006</volser>
<block_id>274184E9</block_id>
<date_migrated>2005SEP01</date_migrated>
</ABC_instance>
</xyz_data>
<xyz_data>
<volser>V00025</volser>
<management_class>STKV</management_class>
<Subsystem_Name>SYSTEMA</Subsystem_Name>
<ABC_instance>
<volser>ABC006</volser>
<block_id>02400E24</block_id>
<date_migrated>2005MAR02</date_migrated>
</ABC_instance>
</xyz_data>
</xyz_report>

I get

PHP:
V00024
ABC006
V00025
ABC006

as output.

Within the XML tags "ABC_instance" there may be multiple <volser> & <block_id> entries.

I want to turn this into a single row item in access. What is the best way to do this?

I guess I can test for how many entries are in "ds.Tables(1)." and assign each instanance to a variable which I use in the SQL, along with the "ds.Tables(0)." stuff, but would be interested to know if there is a better way?

Thanks

RibTime
 
Back
Top