Hi
In C# 2008 I have made a typed dataset called ParametersDataSet.xsd
It has a table called Parameters the table has two fields: Temperatures and Voltages
When it writes the XML it looks like this:
<?xml version="1.0" standalone="yes"?>
<DocumentElement>
<ParametersTable>
<Temperatures>12,30</Tempe
ratures>
<Voltages>3,5</Voltages>
</ParametersTable>
</DocumentElement>
The xsd that VS has generated looks like this:
<?xml version="1.0" encoding="utf-8"?>
<xs:schema id="parametersDataset" targetNamespace="
http://tempuri.org/parametersDataset.xsd" xmlns:mstns="
http://tempuri.org/parametersDataset.xsd" xmlns="
http://tempuri.org/parametersDataset.xsd" xmlns:xs="
http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-
microsoft-
com:xml-ms
data" xmlns:msprop="urn:schemas-
microsoft-
com:xml-ms
prop" attributeFormDefault="qual
ified" elementFormDefault="qualif
ied">
<xs:annotation>
<xs:appinfo source="urn:schemas-micros
oft-com:xm
l-msdataso
urce">
<DataSource DefaultConnectionIndex="0"
FunctionsComponentName="Qu
eriesTable
Adapter" Modifier="AutoLayout, AnsiClass, Class, Public" SchemaSerializationMode="I
ncludeSche
ma" xmlns="urn:schemas-microso
ft-com:xml
-msdatasou
rce">
<Connections />
<Tables />
<Sources />
</DataSource>
</xs:appinfo>
</xs:annotation>
<xs:element name="parametersDataset" msdata:IsDataSet="true" msdata:UseCurrentLocale="t
rue" msprop:Generator_DataSetNa
me="parame
tersDatase
t" msprop:Generator_UserDSNam
e="paramet
ersDataset
" msprop:EnableTableAdapterM
anager="tr
ue">
<xs:complexType>
<xs:choice minOccurs="0" maxOccurs="unbounded">
<xs:element name="ParametersTable" msprop:Generator_UserTable
Name="Para
metersTabl
e" msprop:Generator_RowDelete
dName="Par
ametersTab
leRowDelet
ed" msprop:Generator_TableClas
sName="Par
ametersTab
leDataTabl
e" msprop:Generator_RowChange
dName="Par
ametersTab
leRowChang
ed" msprop:Generator_RowClassN
ame="Param
etersTable
Row" msprop:Generator_RowChangi
ngName="Pa
rametersTa
bleRowChan
ging" msprop:Generator_RowEvArgN
ame="Param
etersTable
RowChangeE
vent" msprop:Generator_RowEvHand
lerName="P
arametersT
ableRowCha
ngeEventHa
ndler" msprop:Generator_TableProp
Name="Para
metersTabl
e" msprop:Generator_TableVarN
ame="table
Parameters
Table" msprop:Generator_RowDeleti
ngName="Pa
rametersTa
bleRowDele
ting">
<xs:complexType>
<xs:sequence>
<xs:element name="Temperatures" msprop:Generator_UserColum
nName="Tem
peratures"
msprop:Generator_ColumnPro
pNameInRow
="Temperat
ures" msprop:Generator_ColumnVar
NameInTabl
e="columnT
emperature
s" msprop:Generator_ColumnPro
pNameInTab
le="Temper
aturesColu
mn" type="xs:string" minOccurs="0" />
<xs:element name="Voltages" msprop:Generator_UserColum
nName="Vol
tages" msprop:Generator_ColumnPro
pNameInRow
="Voltages
" msprop:Generator_ColumnVar
NameInTabl
e="columnV
oltages" msprop:Generator_ColumnPro
pNameInTab
le="Voltag
esColumn" type="xs:string" minOccurs="0" />
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:choice>
</xs:complexType>
</xs:element>
</xs:schema>
The problem is that the xml has an elemnt called DocumentElement and the XSD requires it to be called parametersDataset
So the question is what is microsoft thinking about? I mean I have made the dataset in the ide so the xsd text is autogenerated. I have saved the xml file using the DataSet that is based on the xsd and they end up not matching and thus I can't validate the xml from other programs like xmlspy !!! grrrr
As I need to be able to edit the xml in xmlspy I need the xml to be validatable. It is not.
I have tried to change the DocumentElement field in the xml to parametersDataset
Then I can't use the method: myTable.ReadXml("C:\\myXml
.xml"); It fails
I have also tried to edit the xsd and change from parametersDataset to DocumentElement
That also gives me an error when I try to read in the xml again
Is there a work around? Have I misunderstood something?
Thanks in advance
Lars Iversen