Hi
I am encoutering a problem during the validation of an XML document
when using 'XmlValidingReader'.
My setup is as follows.
I have a schema 'Document.xsd' which is imported into a further schema
'DerivedDocument.xsd'. Our xml sample 'Instancedoc.xml' uses
'DerivedDocument.xsd' as its schema.
A piece of c# code, which utilises an XmlValidingReader succeeds to
validate the xml when NO attributes are used from 'Document.xsd', but
fails when these attributes are included.
However, we can succesfully import complexTypes from 'Document.xsd'
and have these valiate correctly.
Document.xsd:
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema targetNamespace="http://MyCompany/Core/Documents"
xmlns:documentBase="http://MyCompanu/Core/Documents"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
elementFormDefault="qualified" attributeFormDefault="unqualified">
<xs:complexType name="BaseDocument">
<xs:attribute name="name" type="xs:string" use="optional"/>
<xs:attribute name="locked" type="xs:boolean" use="optional"
default="true"/>
</xs:complexType>
</xs:schema>
DerivedDocument.xsd
<?xml version="1.0" encoding="utf-8"?>
<xs:schema targetNamespace="http://MyCompany/Department/Product/Documents/DerivedDocument"
xmlns:msdata="urn:schemas-microsoft-com:xml-msdata"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:mstns="http://MyCompany/Department/Product/Documents/DerivedDocuemnt"
xmlns="http://MyCompany/Department/Product/Documents/DerivedDocument"
xmlns:documentBase="http://MyCompany/Core/Documents"
elementFormDefault="qualified" attributeFormDefault="qualified"
id="CostOfTennor">
<xs:import namespace="http://MyCompany/Core/Documents"
schemaLocation="Document.xsd"/>
<xs:element name="Point" type="PointType"/>
<xs:complexType name="PointType">
<xs:sequence>
<xs:element name="Interval" type="xs:string"/>
<xs:element name="Value" type="xs:double"/>
</xs:sequence>
</xs:complexType>
<xs:element name="DerivedDocument">
<xs:complexType>
<xs:complexContent>
<xs:extension base="documentBase:BaseDocument">
<xs:sequence>
<xs:element name="Author" type="xs:string"/>
<xs:element name="Points" type="PointsType"/>
</xs:sequence>
</xs:extension>
</xs:complexContent>
</xs:complexType>
</xs:element>
<xs:element name="Points" type="PointsType"/>
<xs:complexType name="PointsType">
<xs:sequence minOccurs="0" maxOccurs="unbounded">
<xs:element name="Point" type="PointType"/>
</xs:sequence>
</xs:complexType>
</xs:schema>
Instancedoc.xml
<?xml version="1.0" encoding="UTF-8"?>
<n:DerivedDocument xmlns:n="http://MyCompany/Department/Product/Documents/DerivedDocument"
xmlns:documentBase="http://MyCompany/Core/Documents"
xmlns:msdata="urn:schemas-microsoft-com:xml-msdata"
xmlns:mstns="http://MyCompany/Department/Product/Documents/DerivedDocuemnt"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://MyCompany/Department/Product/Documents/DerivedDocument
DerivedDocument.xsd" documentBase:locked="false">
<n:Author>Me</n:Author>
<n:Points>
<n:Point>
<n:Interval>6 Months</n:Interval>
<n:Value>1.0</n:Value>
</n:Point>
<n:Point>
<n:Interval>6 Months</n:Interval>
<n:Value>2.0</n:Value>
</n:Point>
</n:Points>
</n:DerivedDocument>
Is this a bug with XmlValidingReader or am I constructing my
schemas/xml incorrectly?
Any help would be really appreciated
Mark