ReadXML () has some problem reading when branchname is same as leaf name

EDN Admin

Well-known member
Joined
Aug 7, 2010
Messages
12,794
Location
In the Machine
Hello

I use ReadXML() to read XML file and load data into vb .net DataTable.

In all cases it runs fine else then in one case when I have branch name same as leaf name like below
<div style="color:black; background-color:white
<pre><span style="color:blue <ProductList><br/><<span style="color:#a31515 ParentProduct<span style="color:blue >
<span style="color:blue <<span style="color:#a31515 ParentProductID<span style="color:blue >6899<span style="color:blue </<span style="color:#a31515 ParentProductID<span style="color:blue >
<span style="color:blue <<span style="color:#a31515 ParentID<span style="color:blue >64453<span style="color:blue </<span style="color:#a31515 ParentID<span style="color:blue >
<span style="color:blue <<span style="color:#a31515 IDNumber<span style="color:blue >3011<span style="color:blue </<span style="color:#a31515 IDNumber<span style="color:blue >
<span style="color:blue <<span style="color:#a31515 IDType<span style="color:blue >Tag<span style="color:blue </<span style="color:#a31515 IDType<span style="color:blue >
<span style="color:blue <<span style="color:#a31515 ParentProduct<span style="color:blue >60421<span style="color:blue </<span style="color:#a31515 ParentProduct<span style="color:blue >
<span style="color:blue <<span style="color:#a31515 ParentIDNumber<span style="color:blue >S2305<span style="color:blue </<span style="color:#a31515 ParentIDNumber<span style="color:blue >
<span style="color:blue <<span style="color:#a31515 ParentIDType<span style="color:blue >Model Tag<span style="color:blue </<span style="color:#a31515 ParentIDType<span style="color:blue >
<span style="color:blue </<span style="color:#a31515 ParentProduct<span style="color:blue >
</ProductList><br/>[/code]



When I read this xml from the file to my datatable,
The datatable has all the columns but not "ParentProduct". Instead of having "ParentProduct" it has "ParentProduct_id" and also it inserts and empty row .
For example for my given xml it fills up datatable with
ParentProductID ParentID IDNumber IDType ParentProduct_ID ParentIDNumber ParentIDType
6899 64453 3011 Tag
0 52305 Model Tag
<empty> <empty> <empty> <empty> 1
<empty> <empty>

Why it gets confused here and how can i fix my datatable so that it gets ParentProduct Value instead of ParentProdust_id






<br/>
<br/>

View the full article
 
Back
Top