Loading nested xml to dataset with adding relation columns (ID)

Ctysotaur

New Member
I want to load this xml with data relations between tables, as here: http://msdn.microsoft.com/en-US/library/ecb1hddt(v=vs.100).aspx\[code\]<DocumentElement> <Element1> <ChildElement1 attr1="value1" attr2="value2"/> <ChildElement2>Text2</ChildElement2> </Element1></DocumentElement>\[/code\]When I try to load it to DataSet, I suspect tables:
  • table Element1 with columns Element1_ID, ChildElement2
  • table ChildElement1 with columns attr1, attr2, Element1_ID
but the column Element1_ID is not added and I recieve tables without relation (I have tried various XmlReadModes):
  • table Element1 with column ChildElement2
  • table ChildElement1 with columns attr1, attr2
\[code\]DataSet myDataSet = new DataSet("DataSetXml");myDataSet.ReadXml("example.xml", XmlReadMode.InferSchema);foreach (DataTable table in myDataSet.Tables){ dataGridView1.DataSource = table; MessageBox.Show("Table " + table.TableName);}\[/code\]Is there a property or setting, that I set to get the relations?
 
Back
Top