本文整理汇总了C#中DataSet.ReadXmlSchema方法的典型用法代码示例。如果您正苦于以下问题:C# DataSet.ReadXmlSchema方法的具体用法?C# DataSet.ReadXmlSchema怎么用?C# DataSet.ReadXmlSchema使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DataSet
的用法示例。
在下文中一共展示了DataSet.ReadXmlSchema方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: UnusedComplexTypesIgnored
public void UnusedComplexTypesIgnored()
{
string xs = @"<xs:schema xmlns:xs='http://www.w3.org/2001/XMLSchema' id='hoge'>
<xs:element name='Root'>
<xs:complexType>
<xs:sequence>
<xs:element name='Child' type='xs:string' />
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:complexType name='unusedType'>
<xs:sequence>
<xs:element name='Orphan' type='xs:string' />
</xs:sequence>
</xs:complexType>
</xs:schema>";
var ds = new DataSet();
ds.ReadXmlSchema(new StringReader(xs));
// Here "unusedType" table is never imported.
AssertDataSet("ds", ds, "hoge", 1, 0);
AssertDataTable("dt", ds.Tables[0], "Root", 1, 0, 0, 0, 0, 0);
}
示例2: Test6
public void Test6()
{
DataSet RegionDS = new DataSet();
RegionDS.ReadXmlSchema(new StringReader(RegionXsd));
XmlDataDocument DataDoc = new XmlDataDocument(RegionDS);
DataDoc.Load(new StringReader(RegionXml));
DataDoc.DataSet.EnforceConstraints = false;
XmlElement newNode = DataDoc.CreateElement("Region");
XmlElement newChildNode = DataDoc.CreateElement("RegionID");
newChildNode.InnerText = "64";
XmlElement newChildNode2 = null;
try
{
newChildNode2 = DataDoc.CreateElement("something else");
Assert.False(true);
}
catch (XmlException)
{
}
newChildNode2 = DataDoc.CreateElement("something_else");
newChildNode2.InnerText = "test node";
newNode.AppendChild(newChildNode);
newNode.AppendChild(newChildNode2);
DataDoc.DocumentElement.AppendChild(newNode);
TextWriter text = new StringWriter();
//DataDoc.Save (text);
DataDoc.DataSet.WriteXml(text);
string TextString = text.ToString();
string substring = TextString.Substring(0, TextString.IndexOf("\n") - 1);
TextString = TextString.Substring(TextString.IndexOf("\n") + 1);
for (int i = 0; i < 21; i++)
{
substring = TextString.Substring(0, TextString.IndexOf("\n"));
TextString = TextString.Substring(TextString.IndexOf("\n") + 1);
}
Assert.True(substring.IndexOf(" <Region>") != -1);
substring = TextString.Substring(0, TextString.IndexOf("\n"));
TextString = TextString.Substring(TextString.IndexOf("\n") + 1);
Assert.True(substring.IndexOf(" <RegionID>64</RegionID>") != -1);
substring = TextString.Substring(0, TextString.IndexOf("\n"));
TextString = TextString.Substring(TextString.IndexOf("\n") + 1);
Assert.True(substring.IndexOf(" </Region>") != -1);
substring = TextString.Substring(0, TextString.Length);
Assert.True(substring.IndexOf("</Root>") != -1);
}
示例3: CloneCopy2
public void CloneCopy2()
{
var ds = new DataSet();
ds.ReadXmlSchema(new StringReader(DataProvider.store));
ds.Clone();
}
示例4: myTypedDataSet
protected myTypedDataSet(SerializationInfo info, StreamingContext context)
{
string strSchema = ((string)(info.GetValue("XmlSchema", typeof(string))));
if ((strSchema != null))
{
var ds = new DataSet();
ds.ReadXmlSchema(new XmlTextReader(new StringReader(strSchema)));
if ((ds.Tables["Order Details"] != null))
{
Tables.Add(new Order_DetailsDataTable(ds.Tables["Order Details"]));
}
if ((ds.Tables["Orders"] != null))
{
Tables.Add(new OrdersDataTable(ds.Tables["Orders"]));
}
DataSetName = ds.DataSetName;
Prefix = ds.Prefix;
Namespace = ds.Namespace;
Locale = ds.Locale;
CaseSensitive = ds.CaseSensitive;
EnforceConstraints = ds.EnforceConstraints;
Merge(ds, false, MissingSchemaAction.Add);
InitVars();
}
else
{
InitClass();
}
GetSerializationData(info, context);
CollectionChangeEventHandler schemaChangedHandler = new CollectionChangeEventHandler(SchemaChanged);
Tables.CollectionChanged += schemaChangedHandler;
Relations.CollectionChanged += schemaChangedHandler;
}
示例5: Test4
public void Test4()
{
DataSet RegionDS = new DataSet();
RegionDS.ReadXmlSchema(new StringReader(RegionXsd));
XmlDataDocument DataDoc = new XmlDataDocument(RegionDS);
DataDoc.Load(new StringReader(RegionXml));
Assert.True(RegionDS.EnforceConstraints);
DataTable table = DataDoc.DataSet.Tables["Region"];
DataRow newRow = table.NewRow();
newRow[0] = "new row";
newRow[1] = "new description";
table.Rows.Add(newRow);
TextWriter text = new StringWriter();
text.NewLine = "\n";
DataDoc.Save(text);
string TextString = text.ToString();
string substring = TextString.Substring(0, TextString.IndexOf(s_EOL));
TextString = TextString.Substring(TextString.IndexOf(s_EOL) + s_EOL.Length);
substring = TextString.Substring(0, TextString.IndexOf(s_EOL));
TextString = TextString.Substring(TextString.IndexOf(s_EOL) + s_EOL.Length);
Assert.True(substring.IndexOf("<Root>") != -1);
substring = TextString.Substring(0, TextString.IndexOf(s_EOL));
TextString = TextString.Substring(TextString.IndexOf(s_EOL) + s_EOL.Length);
Assert.True(substring.IndexOf(" <Region>") != -1);
substring = TextString.Substring(0, TextString.IndexOf(s_EOL));
TextString = TextString.Substring(TextString.IndexOf(s_EOL) + s_EOL.Length);
Assert.True(substring.IndexOf(" <RegionID>1</RegionID>") != -1);
substring = TextString.Substring(0, TextString.IndexOfAny(new[] { '\r', '\n' }));
TextString = TextString.Substring(TextString.IndexOf(s_EOL) + s_EOL.Length);
// Regardless of NewLine value, original xml contains CR
// (but in the context of XML spec, it should be normalized)
Assert.Equal(" <RegionDescription>Eastern", substring);
substring = TextString.Substring(0, TextString.IndexOfAny(new[] { '\r', '\n' }));
TextString = TextString.Substring(TextString.IndexOf(s_EOL) + s_EOL.Length);
Assert.Equal(" </RegionDescription>", substring);
substring = TextString.Substring(0, TextString.IndexOf(s_EOL));
TextString = TextString.Substring(TextString.IndexOf(s_EOL) + s_EOL.Length);
Assert.True(substring.IndexOf(" </Region>") != -1);
substring = TextString.Substring(0, TextString.IndexOf(s_EOL));
TextString = TextString.Substring(TextString.IndexOf(s_EOL) + s_EOL.Length);
Assert.True(substring.IndexOf(" <Region>") != -1);
substring = TextString.Substring(0, TextString.IndexOf(s_EOL));
TextString = TextString.Substring(TextString.IndexOf(s_EOL) + s_EOL.Length);
Assert.True(substring.IndexOf(" <RegionID>2</RegionID>") != -1);
substring = TextString.Substring(0, TextString.IndexOf(s_EOL));
TextString = TextString.Substring(TextString.IndexOf(s_EOL) + s_EOL.Length);
Assert.True(substring.IndexOf(" <RegionDescription>Western") != -1);
substring = TextString.Substring(0, TextString.IndexOf(s_EOL));
TextString = TextString.Substring(TextString.IndexOf(s_EOL) + s_EOL.Length);
Assert.True(substring.IndexOf(" </RegionDescription>") != -1);
substring = TextString.Substring(0, TextString.IndexOf(s_EOL));
TextString = TextString.Substring(TextString.IndexOf(s_EOL) + s_EOL.Length);
Assert.True(substring.IndexOf(" </Region>") != -1);
substring = TextString.Substring(0, TextString.IndexOf(s_EOL));
TextString = TextString.Substring(TextString.IndexOf(s_EOL) + s_EOL.Length);
Assert.True(substring.IndexOf(" <Region>") != -1);
substring = TextString.Substring(0, TextString.IndexOf(s_EOL));
TextString = TextString.Substring(TextString.IndexOf(s_EOL) + s_EOL.Length);
Assert.True(substring.IndexOf(" <RegionID>3</RegionID>") != -1);
substring = TextString.Substring(0, TextString.IndexOf(s_EOL));
TextString = TextString.Substring(TextString.IndexOf(s_EOL) + s_EOL.Length);
Assert.True(substring.IndexOf(" <RegionDescription>Northern") != -1);
substring = TextString.Substring(0, TextString.IndexOf(s_EOL));
TextString = TextString.Substring(TextString.IndexOf(s_EOL) + s_EOL.Length);
Assert.True(substring.IndexOf(" </RegionDescription>") != -1);
substring = TextString.Substring(0, TextString.IndexOf(s_EOL));
TextString = TextString.Substring(TextString.IndexOf(s_EOL) + s_EOL.Length);
Assert.True(substring.IndexOf(" </Region>") != -1);
substring = TextString.Substring(0, TextString.IndexOf(s_EOL));
TextString = TextString.Substring(TextString.IndexOf(s_EOL) + s_EOL.Length);
Assert.True(substring.IndexOf(" <Region>") != -1);
substring = TextString.Substring(0, TextString.IndexOf(s_EOL));
TextString = TextString.Substring(TextString.IndexOf(s_EOL) + s_EOL.Length);
Assert.True(substring.IndexOf(" <RegionID>4</RegionID>") != -1);
substring = TextString.Substring(0, TextString.IndexOfAny(new[] { '\r', '\n' }));
TextString = TextString.Substring(TextString.IndexOf(s_EOL) + s_EOL.Length);
// Regardless of NewLine value, original xml contains CR
// (but in the context of XML spec, it should be normalized)
//.........这里部分代码省略.........
示例6: TestMoreThanOneRepeatableColumns
public void TestMoreThanOneRepeatableColumns()
{
var ds = new DataSet();
ds.ReadXmlSchema(new StringReader(
@"<xsd:schema xmlns:xsd=""http://www.w3.org/2001/XMLSchema"">
<xsd:element name=""root"">
<xsd:complexType>
<xsd:sequence>
<xsd:element name=""x"" maxOccurs=""2"" />
<xsd:element ref=""y"" maxOccurs=""unbounded"" />
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name=""y"" />
</xsd:schema>"));
AssertDataSet("014", ds, "NewDataSet", 3, 2);
DataTable dt = ds.Tables[0];
AssertDataTable("parent", dt, "root", 1, 0, 0, 2, 1, 1);
AssertDataColumn("key", dt.Columns[0], "root_Id", false, true, 0, 1, "root_Id", MappingType.Hidden, typeof(int), DBNull.Value, string.Empty, -1, string.Empty, 0, string.Empty, false, true);
dt = ds.Tables[1];
AssertDataTable("repeated", dt, "x", 2, 0, 1, 0, 1, 0);
AssertDataColumn("data_1", dt.Columns[0], "x_Column", false, false, 0, 1, "x_Column", MappingType.SimpleContent, typeof(string), DBNull.Value, string.Empty, -1, string.Empty, 0, string.Empty, false, false);
AssertDataColumn("refkey_1", dt.Columns[1], "root_Id", true, false, 0, 1, "root_Id", MappingType.Hidden, typeof(int), DBNull.Value, string.Empty, -1, string.Empty, 1, string.Empty, false, false);
dt = ds.Tables[2];
AssertDataTable("repeated", dt, "y", 2, 0, 1, 0, 1, 0);
AssertDataColumn("data", dt.Columns[0], "y_Column", false, false, 0, 1, "y_Column", MappingType.SimpleContent, typeof(string), DBNull.Value, string.Empty, -1, string.Empty, 0, string.Empty, false, false);
AssertDataColumn("refkey", dt.Columns[1], "root_Id", true, false, 0, 1, "root_Id", MappingType.Hidden, typeof(int), DBNull.Value, string.Empty, -1, string.Empty, 1, string.Empty, false, false);
AssertDataRelation("rel", ds.Relations[0], "root_x", true, new string[] { "root_Id" }, new string[] { "root_Id" }, true, true);
AssertDataRelation("rel", ds.Relations[1], "root_y", true, new string[] { "root_Id" }, new string[] { "root_Id" }, true, true);
}
示例7: ReadAnnotatedRelations_MultipleColumns
public void ReadAnnotatedRelations_MultipleColumns()
{
var ds = new DataSet();
ds.ReadXmlSchema(new StringReader(
@"<?xml version=""1.0"" standalone=""yes""?>
<xs:schema id=""NewDataSet"" xmlns="""" xmlns:xs=""http://www.w3.org/2001/XMLSchema"" xmlns:msdata=""urn:schemas-microsoft-com:xml-msdata"">
<xs:element name=""NewDataSet"" msdata:IsDataSet=""true"">
<xs:complexType>
<xs:choice maxOccurs=""unbounded"">
<xs:element name=""Table1"">
<xs:complexType>
<xs:sequence>
<xs:element name=""col_x0020_1"" type=""xs:int"" minOccurs=""0"" />
<xs:element name=""col2"" type=""xs:int"" minOccurs=""0"" />
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name=""Table2"">
<xs:complexType>
<xs:sequence>
<xs:element name=""col1"" type=""xs:int"" minOccurs=""0"" />
<xs:element name=""col_x0020__x0020_2"" type=""xs:int"" minOccurs=""0"" />
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:choice>
</xs:complexType>
</xs:element>
<xs:annotation>
<xs:appinfo>
<msdata:Relationship name=""rel"" msdata:parent=""Table1"" msdata:child=""Table2"" msdata:parentkey=""col_x0020_1 col2"" msdata:childkey=""col1 col_x0020__x0020_2"" />
</xs:appinfo>
</xs:annotation>
</xs:schema>"));
Assert.Equal(1, ds.Relations.Count);
Assert.Equal("rel", ds.Relations[0].RelationName);
Assert.Equal(2, ds.Relations[0].ParentColumns.Length);
Assert.Equal(2, ds.Relations[0].ChildColumns.Length);
Assert.Equal(0, ds.Tables[0].Constraints.Count);
Assert.Equal(0, ds.Tables[1].Constraints.Count);
AssertDataRelation("TestRel", ds.Relations[0], "rel", false, new string[] { "col 1", "col2" },
new string[] { "col1", "col 2" }, false, false);
}
示例8: ElementHasIdentityConstraint
public void ElementHasIdentityConstraint()
{
string constraints = @"
<xs:key name='key'>
<xs:selector xpath='./any/string_is_OK/R1'/>
<xs:field xpath='Child2'/>
</xs:key>
<xs:keyref name='kref' refer='key'>
<xs:selector xpath='.//R2'/>
<xs:field xpath='Child2'/>
</xs:keyref>";
string xsbase = @"<xs:schema xmlns:xs='http://www.w3.org/2001/XMLSchema' xmlns:msdata='urn:schemas-microsoft-com:xml-msdata'>
<xs:element name='DS' msdata:IsDataSet='true'>
<xs:complexType>
<xs:choice>
<xs:element ref='R1' />
<xs:element ref='R2' />
</xs:choice>
</xs:complexType>
{0}
</xs:element>
<xs:element name='R1' type='RootType'>
{1}
</xs:element>
<xs:element name='R2' type='RootType'>
</xs:element>
<xs:complexType name='RootType'>
<xs:choice>
<xs:element name='Child1' type='xs:string'>
{2}
</xs:element>
<xs:element name='Child2' type='xs:string' />
</xs:choice>
<xs:attribute name='Attr' type='xs:integer' />
</xs:complexType>
</xs:schema>";
// Constraints on DataSet element.
// Note that in xs:key xpath is crazy except for the last step
string xs = string.Format(xsbase, constraints, string.Empty, string.Empty);
var ds = new DataSet();
ds.ReadXmlSchema(new StringReader(xs));
Assert.Equal(1, ds.Relations.Count);
// Constraints on another global element - just ignored
xs = string.Format(xsbase, string.Empty, constraints, string.Empty);
ds = new DataSet();
ds.ReadXmlSchema(new StringReader(xs));
Assert.Equal(0, ds.Relations.Count);
// Constraints on local element - just ignored
xs = string.Format(xsbase, string.Empty, string.Empty, constraints);
ds = new DataSet();
ds.ReadXmlSchema(new StringReader(xs));
Assert.Equal(0, ds.Relations.Count);
}
示例9: PrefixedTargetNS
public void PrefixedTargetNS()
{
string xs = @"<xs:schema xmlns:xs='http://www.w3.org/2001/XMLSchema' xmlns:msdata='urn:schemas-microsoft-com:xml-msdata' xmlns:x='urn:foo' targetNamespace='urn:foo' elementFormDefault='qualified'>
<xs:element name='DS' msdata:IsDataSet='true'>
<xs:complexType>
<xs:choice>
<xs:element ref='x:R1' />
<xs:element ref='x:R2' />
</xs:choice>
</xs:complexType>
<xs:key name='key'>
<xs:selector xpath='./any/string_is_OK/x:R1'/>
<xs:field xpath='x:Child2'/>
</xs:key>
<xs:keyref name='kref' refer='x:key'>
<xs:selector xpath='.//x:R2'/>
<xs:field xpath='x:Child2'/>
</xs:keyref>
</xs:element>
<xs:element name='R3' type='x:RootType' />
<xs:complexType name='extracted'>
<xs:choice>
<xs:element ref='x:R1' />
<xs:element ref='x:R2' />
</xs:choice>
</xs:complexType>
<xs:element name='R1' type='x:RootType'>
<xs:unique name='Rkey'>
<xs:selector xpath='.//x:Child1'/>
<xs:field xpath='.'/>
</xs:unique>
<xs:keyref name='Rkref' refer='x:Rkey'>
<xs:selector xpath='.//x:Child2'/>
<xs:field xpath='.'/>
</xs:keyref>
</xs:element>
<xs:element name='R2' type='x:RootType'>
</xs:element>
<xs:complexType name='RootType'>
<xs:choice>
<xs:element name='Child1' type='xs:string'>
</xs:element>
<xs:element name='Child2' type='xs:string' />
</xs:choice>
<xs:attribute name='Attr' type='xs:integer' />
</xs:complexType>
</xs:schema>";
// No prefixes on tables and columns
var ds = new DataSet();
ds.ReadXmlSchema(new StringReader(xs));
AssertDataSet("ds", ds, "DS", 3, 1);
DataTable dt = ds.Tables[0];
AssertDataTable("R3", dt, "R3", 3, 0, 0, 0, 0, 0);
AssertDataColumn("col1", dt.Columns[0], "Attr", true, false, 0, 1, "Attr", MappingType.Attribute, typeof(long), DBNull.Value, string.Empty, -1, string.Empty, 0, string.Empty, false, false);
}
示例10: IsDataSetOnLocalElementIgnored
public void IsDataSetOnLocalElementIgnored()
{
string xsbase = @"<xs:schema xmlns:xs='http://www.w3.org/2001/XMLSchema' xmlns:msdata='urn:schemas-microsoft-com:xml-msdata'>
<xs:element name='Root' type='unusedType'>
</xs:element>
<xs:complexType name='unusedType'>
<xs:sequence>
<xs:element name='Child' type='xs:string' msdata:IsDataSet='True' />
</xs:sequence>
</xs:complexType>
</xs:schema>";
// msdata:IsDataSet does not affect even if the value is invalid
string xs = string.Format(xsbase, "true");
var ds = new DataSet();
ds.ReadXmlSchema(new StringReader(xs));
// Child should not be regarded as DataSet element
AssertDataSet("ds", ds, "NewDataSet", 1, 0);
}
示例11: LocaleOnRootWithoutIsDataSet
public void LocaleOnRootWithoutIsDataSet()
{
string xs = @"<xs:schema xmlns:xs='http://www.w3.org/2001/XMLSchema' xmlns:msdata='urn:schemas-microsoft-com:xml-msdata'>
<xs:element name='Root' msdata:Locale='ja-JP'>
<xs:complexType>
<xs:sequence>
<xs:element name='Child' type='xs:string' />
</xs:sequence>
<xs:attribute name='Attr' type='xs:integer' />
</xs:complexType>
</xs:element>
</xs:schema>";
var ds = new DataSet();
ds.ReadXmlSchema(new StringReader(xs));
AssertDataSet("ds", ds, "NewDataSet", 1, 0);
Assert.Equal("fi-FI", ds.Locale.Name); // DataSet's Locale comes from current thread
DataTable dt = ds.Tables[0];
AssertDataTable("dt", dt, "Root", 2, 0, 0, 0, 0, 0);
Assert.Equal("ja-JP", dt.Locale.Name); // DataTable's Locale comes from msdata:Locale
AssertDataColumn("col1", dt.Columns[0], "Attr", true, false, 0, 1, "Attr", MappingType.Attribute, typeof(long), DBNull.Value, string.Empty, -1, string.Empty, 0, string.Empty, false, false);
AssertDataColumn("col2", dt.Columns[1], "Child", false, false, 0, 1, "Child", MappingType.Element, typeof(string), DBNull.Value, string.Empty, -1, string.Empty, 1, string.Empty, false, false);
}
示例12: NestedReferenceNotAllowed
public void NestedReferenceNotAllowed()
{
string xs = @"<xs:schema xmlns:xs='http://www.w3.org/2001/XMLSchema' xmlns:msdata='urn:schemas-microsoft-com:xml-msdata'>
<xs:element name='Root' type='unusedType' msdata:IsDataSet='true'>
</xs:element>
<xs:complexType name='unusedType'>
<xs:sequence>
<xs:element name='Child' type='xs:string' />
</xs:sequence>
</xs:complexType>
<xs:element name='Foo'>
<xs:complexType>
<xs:sequence>
<xs:element ref='Root' />
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>";
// DataSet element cannot be converted into a DataTable.
// (i.e. cannot be referenced in any other elements)
var ds = new DataSet();
Assert.Throws<ArgumentException>(() =>
{
ds.ReadXmlSchema(new StringReader(xs));
});
}
示例13: IsDataSetAndTypeIgnored
public void IsDataSetAndTypeIgnored()
{
string xsbase = @"<xs:schema xmlns:xs='http://www.w3.org/2001/XMLSchema' xmlns:msdata='urn:schemas-microsoft-com:xml-msdata'>
<xs:element name='Root' type='unusedType' msdata:IsDataSet='{0}'>
</xs:element>
<xs:complexType name='unusedType'>
<xs:sequence>
<xs:element name='Child' type='xs:string' />
</xs:sequence>
</xs:complexType>
</xs:schema>";
// Even if a global element uses a complexType, it will be
// ignored if the element has msdata:IsDataSet='true'
string xs = string.Format(xsbase, "true");
var ds = new DataSet();
ds.ReadXmlSchema(new StringReader(xs));
AssertDataSet("ds", ds, "Root", 0, 0); // name is "Root"
// But when explicit msdata:IsDataSet value is "false", then
// treat as usual.
xs = string.Format(xsbase, "false");
ds = new DataSet();
ds.ReadXmlSchema(new StringReader(xs));
AssertDataSet("ds", ds, "NewDataSet", 1, 0);
}
示例14: SimpleTypeComponentsIgnored
public void SimpleTypeComponentsIgnored()
{
string xs = @"<xs:schema xmlns:xs='http://www.w3.org/2001/XMLSchema'>
<xs:element name='Root' type='xs:string'/>
<xs:attribute name='Attr' type='xs:string'/>
</xs:schema>";
var ds = new DataSet();
ds.ReadXmlSchema(new StringReader(xs));
// nothing is imported.
AssertDataSet("ds", ds, "NewDataSet", 0, 0);
}
示例15: TestAnnotatedRelation2
public void TestAnnotatedRelation2()
{
var ds = new DataSet();
ds.ReadXmlSchema(new StringReader(
@"<xs:schema xmlns:xs=""http://www.w3.org/2001/XMLSchema"" xmlns:msdata=""urn:schemas-microsoft-com:xml-msdata"">
<!-- just modified MSDN example -->
<xs:element name=""ds"" msdata:IsDataSet=""true"">
<xs:complexType>
<xs:choice maxOccurs=""unbounded"">
<xs:element name=""p"">
<xs:complexType>
<xs:sequence>
<xs:element name=""pk"" type=""xs:string"" />
<xs:element name=""name"" type=""xs:string"" />
<xs:element name=""c"">
<xs:annotation>
<xs:appinfo>
<msdata:Relationship name=""rel""
msdata:parent=""p""
msdata:child=""c""
msdata:parentkey=""pk""
msdata:childkey=""fk""/>
</xs:appinfo>
</xs:annotation>
<xs:complexType>
<xs:sequence>
<xs:element name=""fk"" type=""xs:string"" />
<xs:element name=""count"" type=""xs:int"" />
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:choice>
</xs:complexType>
</xs:element>
</xs:schema>"));
AssertDataSet("102", ds, "ds", 2, 1);
DataTable dt = ds.Tables[0];
AssertDataTable("parent_table", dt, "p", 2, 0, 0, 1, 0, 0);
AssertDataColumn("pk", dt.Columns[0], "pk", false, false, 0, 1, "pk", MappingType.Element, typeof(string), DBNull.Value, string.Empty, -1, string.Empty, 0, string.Empty, false, false);
dt = ds.Tables[1];
AssertDataTable("child_table", dt, "c", 2, 0, 1, 0, 0, 0);
AssertDataColumn("fk", dt.Columns[0], "fk", false, false, 0, 1, "fk", MappingType.Element, typeof(string), DBNull.Value, string.Empty, -1, string.Empty, 0, string.Empty, false, false);
AssertDataRelation("rel", ds.Relations[0], "rel", true, new string[] { "pk" }, new string[] { "fk" }, false, false);
}