Groups | Blog | Home
all groups > dotnet xml > september 2004 >

dotnet xml : XmlValidatingReader gives errors from inline schema


apa57 NO[at]SPAM hotmail.com
9/21/2004 3:59:47 AM
Hi there,

I do have a dataset which I use to write a XML file with inline
schema. A second
application should use a XmlvalidatingReader to read the xml file
again.

Now I get errors like: The
'http://tempuri.org/LicenceFile.xsd:LicenceData' element is not
declared.

I'm a bit surprised since it is the inline schema and xml that was
generated by the WriteXml method of the dataset and I didn't change
anything there. I would have expected that schema and xml data do
match when they are created by the dataset method. Did I miss
something ?

below is the xml file with the inline schema:

<?xml version="1.0" standalone="yes"?>
<LicenceFile xmlns="http://tempuri.org/LicenceFile.xsd">
<xs:schema id="LicenceFile"
targetNamespace="http://tempuri.org/LicenceFile.xsd"
xmlns:mstns="http://tempuri.org/LicenceFile.xsd"
xmlns="http://tempuri.org/LicenceFile.xsd"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:msdata="urn:schemas-microsoft-com:xml-msdata"
attributeFormDefault="qualified" elementFormDefault="qualified">
<xs:element name="LicenceFile" msdata:IsDataSet="true">
<xs:complexType>
<xs:choice maxOccurs="unbounded">
<xs:element name="LicenceData">
<xs:complexType>
<xs:sequence>
<xs:element name="X1" type="xs:string" />
<xs:element name="X2" type="xs:string" />
<xs:element name="X3" type="xs:string" />
<xs:element name="X4" type="xs:string" />
<xs:element name="X5" type="xs:string" />
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:choice>
</xs:complexType>
</xs:element>
</xs:schema>
<LicenceData>
<X1>038XXXXX0B1</X1>
<X2>69712-XXX-XXXXXX-XXXXX</X2>
<X3>Microsoft(R) Windows(R) Server 2003, Standard Edition</X3>
<X4>3790</X4>
<X5>79XXX60</X5>
</LicenceData>
Zafar Abbas [MSFT]
9/21/2004 10:08:42 AM
The validating reader "sees" the LicenceFile element before it reads the
inline schema, since it can not validate that element, it would not properly
validate its content i..e LicenceData
[quoted text, click to view]

AddThis Social Bookmark Button