Quick Prototype result:
Variables and Namespace Setup:
We are tricking the datatable conversion with the help of LINQ and JSON
arrJObjects =
(From row In xDoc.Root.Descendants(xnsDefault + "Table").First().Descendants(xnsDefault+"Row")
Where row.Elements().Count > 5
Let JPrps = row.Elements(xnsDefault + "Cell").Select(Function (x,i) New JProperty("Col" & i.toString, x.Value)).toArray
Select jo = New JObject(JPrps)).toArray
We filter for rows having more then 5 cells
then we are creating JProperties from the cell and its value
we convert it into a JObject
And return it as an array of JObjects
dtResult =
JSonConvert.DeserializeObject(Of DataTable)(JsonConvert.SerializeObject(arrJObjects))
Serializing arrJObject to JSON and desrializing it to datatable will create us the datatable
Next Things you can do: Handling the first row and assign it as column headers
Also have a look here:
Handling XML Namespaces:
LINQ Starter
Find starter help here:
ppr_XMLBox_SpreadSheetXML.xaml (8.3 KB)