470,810 Members | 1,367 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,810 developers. It's quick & easy.

ReadXml to read recurring occurences of same tag?

Hello,

I have an xml file with the following snippet:

....... some tags
<ListItems>
<item> 1 </item>
<item> 2 </item>
<item> 3 </item>
</ListItems>

I need to populate a dataset containing a table with one column "Item"
with rows containining data from the item tag....i.e. 1,2,3.

if i Create a DataTable named "ListItems" and a column element in it
named "item" then only the first value is read.

if i Create a DataTable named "item" then no values are read but
exactly the same no. of rows are created in the grid having this
dataset as the source..... this is definitely a good sign as now I need
to get the data somehow.... but HOW?
Please help!

Thanks,
Vinit

Feb 7 '06 #1
4 1827
Are you using DatSet.ReadXml() ?????

--

Juan David Gómez Arenas.
Ingeniero de Desarrollo
InterGrupo S.A. - Medellín
Visite nuestro sitio: www.intergrupo.com
"Vinit" <vi********@gmail.com> wrote in message
news:11*********************@g44g2000cwa.googlegro ups.com...
Hello,

I have an xml file with the following snippet:

...... some tags
<ListItems>
<item> 1 </item>
<item> 2 </item>
<item> 3 </item>
</ListItems>

I need to populate a dataset containing a table with one column "Item"
with rows containining data from the item tag....i.e. 1,2,3.

if i Create a DataTable named "ListItems" and a column element in it
named "item" then only the first value is read.

if i Create a DataTable named "item" then no values are read but
exactly the same no. of rows are created in the grid having this
dataset as the source..... this is definitely a good sign as now I need
to get the data somehow.... but HOW?
Please help!

Thanks,
Vinit

Feb 7 '06 #2
Yes i am using dataset.readxml.

Feb 7 '06 #3
Hi Vinit,

If you are using DataSet.ReadXml, then there should be no problem.
This solution does not use a DataTable.
-----------------------------------------------------
Dim ds As DataSet = New DataSet()
ds.ReadXml("Temp.xml")

'Display the resulting Dataset into a Datagrid called dg
dg.DataSource = ds
dg.DataMember = "item"
------------------------------------------------------

Regards,

Cerebrus

Feb 8 '06 #4
Well I figured it out ....I was using ReadXml with the default
ReadSchema mode.....i used the InferSchema as the XmlReadMode and it
worked fine.....

Thanks 2 all who replied!

Feb 8 '06 #5

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

3 posts views Thread by Raj Chudasama | last post: by
1 post views Thread by steve | last post: by
1 post views Thread by keikoo | last post: by
1 post views Thread by ray well | last post: by
reply views Thread by =?Utf-8?B?TWVlbWEgSnVkeQ==?= | last post: by
2 posts views Thread by Tony Johansson | last post: by
reply views Thread by mihailmihai484 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.