I am trying to bulk copy some XML data into a SQL and am generally doing quite well. The XML data I have been given has a child node called "name" which is the same as in the parent node as shown in the highlight of the XML source below. Now I can retrive the data in the parent node using
bulk.ColumnMappings.Add("name", "Name")
but I cannot get any of the data from the child node "Catagory" or " Catagories". Have you any suggestions on how I can get this data.
<?xml version="1.0" ?>
<products>
<product>
<ProductId>12345</ProductId>
<name>Productname</name>
<description>"This is some description text"</description>
<Categories>
<Category>
<name>Category type</name>
<merchantName>Category subtype</merchantName>
</Category>
</Categories>
<fields/>
</product>
Etc…….
</products>
Many thanks in advance
Simon
How did you map to the "Catagory" or " Catagories" node? Make sure you've made proper mapping. For example if you read the xml into a DataSet, then the "Catagory"/" Catagories" will be in 2nd/3rd table respectively, because it is the 2nd/3rd level node (ignore the root node). I mean you can read the xml data use something like this:
Dim ds As New DataSet
ds.ReadXml("c:\XmlFiles\Products.xml", XmlReadMode.Auto)
No comments:
Post a Comment