Reading an xml file into Dataset

A

ALI-R

Hi All;

I'm reading the following xml file into a Dataset but there are only 4
datatables in my dataset (which should be 5)
Is that because I have two nodes with the same name (detail) in my xml file?
how can I fix this?

Thanks for your time.

<?xml version="1.0" ?>
- <report>
- <subreport>
- <header>
<sales_order>S218575</sales_order>
</header>
- <detail>
<sod_part>776545995278</sod_part>
<batch_code />
<input_qty />
</detail>
- <detail>
<sod_part>776545981110</sod_part>
<batch_code />
<input_qty />
</detail>
- <footer>
<total_qty>7</total_qty>
<total_wt>221.74</total_wt>
</footer>
</subreport>
</report>
 
K

Kai Brinkmann [MSFT]

The two <detail> nodes are being interpreted as different rows in one and
the same table, and this table has three columns: sod_part, batch_code, and
input_qty.

I'm not quire sure what you are expecting. It seems to make sense to use
just one detail table with sod_part as key. What are you trying to
accomplish?
--
Kai Brinkmann [MSFT]

Please do not send e-mail directly to this alias. This alias is for
newsgroup purposes only.
This posting is provided "AS IS" with no warranties, and confers no rights.
 
A

ALI-R

so ,,how come when I get this command "ds.Tables["detail"].Rows.Count" ,it
shows only "1" (it means that there is only one row in that table ,whereas
ther should be two,right?)

Thanks for yuor help.

Kai Brinkmann said:
The two <detail> nodes are being interpreted as different rows in one and
the same table, and this table has three columns: sod_part, batch_code, and
input_qty.

I'm not quire sure what you are expecting. It seems to make sense to use
just one detail table with sod_part as key. What are you trying to
accomplish?
--
Kai Brinkmann [MSFT]

Please do not send e-mail directly to this alias. This alias is for
newsgroup purposes only.
This posting is provided "AS IS" with no warranties, and confers no rights.


ALI-R said:
Hi All;

I'm reading the following xml file into a Dataset but there are only 4
datatables in my dataset (which should be 5)
Is that because I have two nodes with the same name (detail) in my xml
file?
how can I fix this?

Thanks for your time.

<?xml version="1.0" ?>
- <report>
- <subreport>
- <header>
<sales_order>S218575</sales_order>
</header>
- <detail>
<sod_part>776545995278</sod_part>
<batch_code />
<input_qty />
</detail>
- <detail>
<sod_part>776545981110</sod_part>
<batch_code />
<input_qty />
</detail>
- <footer>
<total_qty>7</total_qty>
<total_wt>221.74</total_wt>
</footer>
</subreport>
</report>
 
A

ALI-R

I'd like to simly extract "details" nodes and show them in a datagrid and
let the user edit some childs of it.
That's it.
Thanks
Kai Brinkmann said:
The two <detail> nodes are being interpreted as different rows in one and
the same table, and this table has three columns: sod_part, batch_code, and
input_qty.

I'm not quire sure what you are expecting. It seems to make sense to use
just one detail table with sod_part as key. What are you trying to
accomplish?
--
Kai Brinkmann [MSFT]

Please do not send e-mail directly to this alias. This alias is for
newsgroup purposes only.
This posting is provided "AS IS" with no warranties, and confers no rights.


ALI-R said:
Hi All;

I'm reading the following xml file into a Dataset but there are only 4
datatables in my dataset (which should be 5)
Is that because I have two nodes with the same name (detail) in my xml
file?
how can I fix this?

Thanks for your time.

<?xml version="1.0" ?>
- <report>
- <subreport>
- <header>
<sales_order>S218575</sales_order>
</header>
- <detail>
<sod_part>776545995278</sod_part>
<batch_code />
<input_qty />
</detail>
- <detail>
<sod_part>776545981110</sod_part>
<batch_code />
<input_qty />
</detail>
- <footer>
<total_qty>7</total_qty>
<total_wt>221.74</total_wt>
</footer>
</subreport>
</report>
 
A

ALI-R

Sorry ,I made a mistake for this posting ds.Tables["detail"].Rows.Count
exactly returns the number of "detail" nodes in the xml file.Say if there is
6 "detail" nodes in xml it returns 6 and if there is only 1 "detail" nodes
,it returns 1.

ALI-R said:
so ,,how come when I get this command "ds.Tables["detail"].Rows.Count" ,it
shows only "1" (it means that there is only one row in that table ,whereas
ther should be two,right?)

Thanks for yuor help.

Kai Brinkmann said:
The two <detail> nodes are being interpreted as different rows in one and
the same table, and this table has three columns: sod_part, batch_code, and
input_qty.

I'm not quire sure what you are expecting. It seems to make sense to use
just one detail table with sod_part as key. What are you trying to
accomplish?
--
Kai Brinkmann [MSFT]

Please do not send e-mail directly to this alias. This alias is for
newsgroup purposes only.
This posting is provided "AS IS" with no warranties, and confers no rights.


ALI-R said:
Hi All;

I'm reading the following xml file into a Dataset but there are only 4
datatables in my dataset (which should be 5)
Is that because I have two nodes with the same name (detail) in my xml
file?
how can I fix this?

Thanks for your time.

<?xml version="1.0" ?>
- <report>
- <subreport>
- <header>
<sales_order>S218575</sales_order>
</header>
- <detail>
<sod_part>776545995278</sod_part>
<batch_code />
<input_qty />
</detail>
- <detail>
<sod_part>776545981110</sod_part>
<batch_code />
<input_qty />
</detail>
- <footer>
<total_qty>7</total_qty>
<total_wt>221.74</total_wt>
</footer>
</subreport>
</report>
 
K

Kai Brinkmann [MSFT]

You should data bind the grid to the Detail table then. Each detail node
will appear as one row in the grid. You can edit the data in the three
columns and save the changes back to the underlying dataset (which the table
belongs to). After that, just write the dataset back to XML to update the
file.
--
Kai Brinkmann [MSFT]

Please do not send e-mail directly to this alias. This alias is for
newsgroup purposes only.
This posting is provided "AS IS" with no warranties, and confers no rights.

ALI-R said:
I'd like to simly extract "details" nodes and show them in a datagrid and
let the user edit some childs of it.
That's it.
Thanks
Kai Brinkmann said:
The two <detail> nodes are being interpreted as different rows in one and
the same table, and this table has three columns: sod_part, batch_code, and
input_qty.

I'm not quire sure what you are expecting. It seems to make sense to use
just one detail table with sod_part as key. What are you trying to
accomplish?
--
Kai Brinkmann [MSFT]

Please do not send e-mail directly to this alias. This alias is for
newsgroup purposes only.
This posting is provided "AS IS" with no warranties, and confers no rights.


ALI-R said:
Hi All;

I'm reading the following xml file into a Dataset but there are only 4
datatables in my dataset (which should be 5)
Is that because I have two nodes with the same name (detail) in my xml
file?
how can I fix this?

Thanks for your time.

<?xml version="1.0" ?>
- <report>
- <subreport>
- <header>
<sales_order>S218575</sales_order>
</header>
- <detail>
<sod_part>776545995278</sod_part>
<batch_code />
<input_qty />
</detail>
- <detail>
<sod_part>776545981110</sod_part>
<batch_code />
<input_qty />
</detail>
- <footer>
<total_qty>7</total_qty>
<total_wt>221.74</total_wt>
</footer>
</subreport>
</report>
 
A

ALI-R

My datagrid is now bound and working,thanks for your help.
Now I have two other issues:

1)My datagrid is in another form and I need to return the value of a coulmn
which user has selected to the caller form (in a textbox),I know how the get
the value of an specific coulmn in the selected row ,but I don't know how to
return it to the called

2) I don't need all those columns from datagrid ,I need only 2 of it,Dose
Dataview help for this senario?

Thanks again
Kai Brinkmann said:
You should data bind the grid to the Detail table then. Each detail node
will appear as one row in the grid. You can edit the data in the three
columns and save the changes back to the underlying dataset (which the table
belongs to). After that, just write the dataset back to XML to update the
file.
--
Kai Brinkmann [MSFT]

Please do not send e-mail directly to this alias. This alias is for
newsgroup purposes only.
This posting is provided "AS IS" with no warranties, and confers no rights.

ALI-R said:
I'd like to simly extract "details" nodes and show them in a datagrid and
let the user edit some childs of it.
That's it.
Thanks
Kai Brinkmann said:
The two <detail> nodes are being interpreted as different rows in one and
the same table, and this table has three columns: sod_part, batch_code, and
input_qty.

I'm not quire sure what you are expecting. It seems to make sense to use
just one detail table with sod_part as key. What are you trying to
accomplish?
--
Kai Brinkmann [MSFT]

Please do not send e-mail directly to this alias. This alias is for
newsgroup purposes only.
This posting is provided "AS IS" with no warranties, and confers no rights.


Hi All;

I'm reading the following xml file into a Dataset but there are only 4
datatables in my dataset (which should be 5)
Is that because I have two nodes with the same name (detail) in my xml
file?
how can I fix this?

Thanks for your time.

<?xml version="1.0" ?>
- <report>
- <subreport>
- <header>
<sales_order>S218575</sales_order>
</header>
- <detail>
<sod_part>776545995278</sod_part>
<batch_code />
<input_qty />
</detail>
- <detail>
<sod_part>776545981110</sod_part>
<batch_code />
<input_qty />
</detail>
- <footer>
<total_qty>7</total_qty>
<total_wt>221.74</total_wt>
</footer>
</subreport>
</report>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top