Hi,
By calling Dataset.WriteXml, my code produces XML as listed
below.
The user can also load the XML file, and I will use
Dataset.ReadXML to do
this. Preferably before calling that method, I would like to
validate the
schema of the XML to ensure that it has the same structure
as an XML file
produced by WriteXml. How can I do that?
At present, I am loading the XML file and writing code like
this:
ValidXml =
(LoadedOk) &
(dsKeysAndValues.Tables[dsnKeysAndValues].Columns[KeyGroup]
!= null) &
(dsKeysAndValues.Tables[dsnKeysAndValues].Columns[ValueGroup
] != null) ;
The code not only doesn't work, but it also doesn't seem
elegant - if the
XML file is large, it will take time just to load the file,
before I can
validate it.
How can I validate the schema of XML to ensure that it
matches what I am
expecting?
Thanks for your help, pointers, and time!
Richard
The mystery is out there - in the XML-Files (X-files music
follows.)
XML produced using WriteXml:
<?xml version="1.0"
standalone="yes"?>
<KeysAndValues>
<xs:schema id="KeysAndValues"
xmlns=""
xmlns s=&qu
ot;http://www.w3.
org/2001/XMLSchema"
xmlns:msdata="urn:schemas-microsoft-com ml-ms
data">
<xs:element name="KeysAndValues"
msdata:IsDataSet="true"
msdata:Locale="en-CA">
<xs:complexType>
<xs:choice maxOccurs="unbounded">
<xs:element name="KeysAndValues">
<xs:complexType>
<xs:sequence>
<xs:element name="Key"
minOccurs="0">
<xs:simpleType>
<xs:restriction
base="xs:string">
<xs:maxLength value="50"
/>
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="Value"
minOccurs="0">
<xs:simpleType>
<xs:restriction
base="xs:string">
<xs:maxLength value="255"
/>
</xs:restriction>
</xs:simpleType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:choice>
</xs:complexType>
</xs:element>
</xs:schema>
<KeysAndValues>
<Key> K1</Key>
<Value> V9999</Value>
</KeysAndValues>
===================================
This list is hosted by DevelopMentorŪ http://www.develop.com
View archives and manage your subscription(s) at http://discuss.develop.com
|