I have been losing my mind trying to parse an XML document (with nested child
elements, not all of which appear in each parent node) into a DataGrid
object. What I want to do is "flatten" the XML document into a text
document with a single row for each parent node (that has all of the values
from all of the child nodes for that row)
The DataView within VS 2005 IDE displays my 15 or so child tables - and
knows that some parent rows don't have child rows in every relation - but
trying to get all the child tables to go with the correct parent row
programmaticall y is killing me.
Getting the parent node to bind to the DataGrid is simple
dsSource.ReadXm l(CStr(Session( "FilePath") ))
'Bind the XML to a DataGrid
dgMaster.DataSo urce = dsSource
dgMaster.DataBi nd()
dgMaster.Visibl e = True
Of course, we all know that this will only show me dsSource.Tables (0), not
ALL of them
Isn't there an easy way to get the values from all the child nodes to bind
and display on the same DataGrid rather than one separate DataGrid for each
child relation?
Obviously, the DataView within the VS 2005 IDE understands how to infer the
relationships between parent and child nodes (I guess with ParentRelations
and ChildRelations objects - and associated ID's)
I know the DOM is supposed to be able to parse through child nodes, but how
do I do that and get them all linked up to the correct parent row? Right
now the code I have uses all kinds of row counters and all kinds of loops
similar to
For i = 0 To dsSource.Tables .Count - 1
Next
My row counters (and associated arrays to track CurrentRow, LastRow, etc)
are constantly off by one or two rows.
Help!!! I know I missing something, but I'm so far down the rat hole I
can't find my way back out.
elements, not all of which appear in each parent node) into a DataGrid
object. What I want to do is "flatten" the XML document into a text
document with a single row for each parent node (that has all of the values
from all of the child nodes for that row)
The DataView within VS 2005 IDE displays my 15 or so child tables - and
knows that some parent rows don't have child rows in every relation - but
trying to get all the child tables to go with the correct parent row
programmaticall y is killing me.
Getting the parent node to bind to the DataGrid is simple
dsSource.ReadXm l(CStr(Session( "FilePath") ))
'Bind the XML to a DataGrid
dgMaster.DataSo urce = dsSource
dgMaster.DataBi nd()
dgMaster.Visibl e = True
Of course, we all know that this will only show me dsSource.Tables (0), not
ALL of them
Isn't there an easy way to get the values from all the child nodes to bind
and display on the same DataGrid rather than one separate DataGrid for each
child relation?
Obviously, the DataView within the VS 2005 IDE understands how to infer the
relationships between parent and child nodes (I guess with ParentRelations
and ChildRelations objects - and associated ID's)
I know the DOM is supposed to be able to parse through child nodes, but how
do I do that and get them all linked up to the correct parent row? Right
now the code I have uses all kinds of row counters and all kinds of loops
similar to
For i = 0 To dsSource.Tables .Count - 1
Next
My row counters (and associated arrays to track CurrentRow, LastRow, etc)
are constantly off by one or two rows.
Help!!! I know I missing something, but I'm so far down the rat hole I
can't find my way back out.
Comment