У меня возникли проблемы с методами ReadXmlSchema и ReadXml для DataTable. Я получаю сообщение об ошибке «DataTable не поддерживает вывод схемы из Xml».
Фрагмент кода:
Я пробовал
Table.ReadXmlSchema(new StringReader(File.ReadAllText(XsdFilePath)));
Table.ReadXml(new StringReader(File.ReadAllText(XmlFilePath)));
И
Table.ReadXmlSchema(XsdFilePath);
Table.ReadXml(XmlFilePath);
Фрагмент XML:
<ScreenSets>
<ScreenSet id="Credit 1">
<Screen xmlFile="sb-credit1.en.xml" tabText="Recommendation" isCached="false">
<Buttons>
<Button id="btnClosePresentation"/>
</Buttons>
</Screen>
</ScreenSet>
<ScreenSet id="Credit 2">
<Screen xmlFile="sb-credit2.en.xml" tabText="Recommendation" isCached="false">
<Buttons>
<Button id="btnClosePresentation"/>
</Buttons>
</Screen>
</ScreenSet>
<ScreenSet id="Credit 3">
<Screen xmlFile="sb-credit3.en.xml" tabText="Recommendation" isCached="false">
<Buttons>
<Button id="btnClosePresentation"/>
</Buttons>
</Screen>
</ScreenSet>
</ScreenSets>
XSD:
<?xml version="1.0" encoding="utf-8"?>
<xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="ScreenSets">
<xs:complexType>
<xs:sequence>
<xs:element maxOccurs="unbounded" name="ScreenSet">
<xs:complexType>
<xs:sequence>
<xs:element name="Screen">
<xs:complexType>
<xs:sequence>
<xs:element name="Buttons">
<xs:complexType>
<xs:sequence>
<xs:element maxOccurs="unbounded" name="Button">
<xs:complexType>
<xs:attribute name="id" type="xs:string" use="required" />
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
<xs:attribute name="xmlFile" type="xs:string" use="required" />
<xs:attribute name="tabText" type="xs:string" use="required" />
<xs:attribute name="isCached" type="xs:boolean" use="required" />
</xs:complexType>
</xs:element>
</xs:sequence>
<xs:attribute name="id" type="xs:string" use="required" />
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>