A
abaker.junk
I have the following code:
Dim ds As New Data.DataSet("inventory")
Dim dt As New Data.DataTable("desk")
'dt.TableName = "desk"
With dt
.Columns.Add("item")
.Columns.Add("qty")
End With
dt.Rows.Add(New Object() {"Paper Clip", 100})
dt.Rows.Add(New Object() {"Stapler", 1})
dt.Rows.Add(New Object() {"Tape", 2})
ds.Tables.Add(dt)
At this point, ds.GetXml will produces the following XML:
<inventory>
<desk>
<item>Paper Clip</item>
<qty>100</qty>
</desk>
<desk>
<item>Stapler</item>
<qty>1</qty>
</desk>
<desk>
<item>Tape</item>
<qty>2</qty>
</desk>
</inventory>
What is the best way with VB.net to make the XML look like this
instead:
<inventory>
<desk>
<item qty='100'>Paper Clip</item>
<item qty='1'>Stapler</item>
<item qty='2'>Tape</item>
</desk>
</inventory>
Dim ds As New Data.DataSet("inventory")
Dim dt As New Data.DataTable("desk")
'dt.TableName = "desk"
With dt
.Columns.Add("item")
.Columns.Add("qty")
End With
dt.Rows.Add(New Object() {"Paper Clip", 100})
dt.Rows.Add(New Object() {"Stapler", 1})
dt.Rows.Add(New Object() {"Tape", 2})
ds.Tables.Add(dt)
At this point, ds.GetXml will produces the following XML:
<inventory>
<desk>
<item>Paper Clip</item>
<qty>100</qty>
</desk>
<desk>
<item>Stapler</item>
<qty>1</qty>
</desk>
<desk>
<item>Tape</item>
<qty>2</qty>
</desk>
</inventory>
What is the best way with VB.net to make the XML look like this
instead:
<inventory>
<desk>
<item qty='100'>Paper Clip</item>
<item qty='1'>Stapler</item>
<item qty='2'>Tape</item>
</desk>
</inventory>