hi,
i have an xml file looks like that
1: <Library>
2: <Book id="1" name="anything">
3: <Versions>
4: <version id="1" language="Ar"/>
5: <version id="2" language="En"/>
6: </Versions>
7: <Chapters>
8: <chapter id="1" LangID="5">File1Path.xml</chapter>
9: <chapter id="1" LangID="6">File1Path.xml</chapter>
10: </Chapters>
11: </Book>
12: </Library>
this xml file was created by Deserializing other Class
when i try to make myDataSet Read this file it read it as 5 tables (Book, Versions, Version, Chapters, Chapter)
when actualy
1. Version(line 4,5) is a raw in Versions table (line 3)
2. and chapter(line 8,9) is a raw in Chapters table (line7)
i wrote .XSD file but its still read it as 5 tables, so
A) how can i specify what is a table and what is a datarow in the XSD file
B) how can i Exempt an attribute like LangID(line 8,9) in the chapter node from being loaded to the dataset
thanks in advance

DataSet Nested Rows
joe breese
You may implement your own reader that populates a given dataset from a specific xml, instead of having dataset to load this xml. dataset xml loader has expectations from the document.
Example:
static void test2()
{
System.Data.DataTable dt = new System.Data.DataTable();
XmlReader xr = XmlTextReader.Create("XmlFile1.xml");
xr.ReadToDescendant("version");
dt.Columns.Add("id");
dt.Columns.Add("language");
do
{
xr.MoveToFirstAttribute();
string id = xr.Value;
xr.MoveToNextAttribute();
string lang = xr.Value;
dt.Rows.Add(id, lang);
xr.MoveToElement();
}
while (xr.ReadToFollowing("version"));
xr.Close();
Debug.WriteLine(dt.Rows.Count);
foreach (System.Data.DataRow row in dt.Rows)
{
Debug.WriteLine(row[0] + " " + row[1]);
}
}
outputs:
2
1 Ar
2 En
jk67
hi,
thank you Sinan,
i guess ReadXml depend on XmlSerialization in xmlSerialization i can control how the object will be serialized XmlElement
<version>...</version>
<version>...</version>
or XmlArray,
< Versions>
<version>...</version>
<version>...</version>
</versions>
so i was wondering is this allowed in dataset through the Schema or not if not i think you solution will be the best to avoid system reflection which take much time
thank you
king4south
hi,
sounds like there is no way to indecate this to the readxml serialization
thanks