473,385 Members | 1,587 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Inherited Schema/ XmlValidatingReader problem.

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
Nov 12 '05 #1
3 1154
Sorry I forgot to mention

But the actual error is that the attribute 'documentBase:locked' is not declared.

Mark

Nov 12 '05 #2

Hi Joe Hoggood,

We have reviewed your post. We will do some research on your issue. We will
reply to you ASAP.

Thanks for your understanding.

Best regards,
Jeffrey Tan
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.
Nov 12 '05 #3
Hi Mark,

Thank you for using the community. I am Luke. I chekced your code and I
found it is a known issue with XmlValidatingReader. This prolem may be
fixed in next release of .NET framework 1.1 service pack. Currently, we
suggest put all the schema in one xsd file to avoid this problem.

Luke
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

Nov 12 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Lee Chapman | last post by:
Has anyone successfully been able to use an XmlValidatingReader (Framework 1.1) to validate documents against XML Schemas that haven't been added to the XmlValidatingReader.Schemas collection...
1
by: Andy | last post by:
I am having some trouble validating XML using the XmlValidatingReader. I have created some xml and used the visual studio to generate the schema. So I am confident that the xml and schema match. ...
0
by: Harold Putman | last post by:
The XmlValidatingReader seems to have changed drastically in .Net Frameworks 1.0 SP3 and beyond with regards to validating XML files that are XML Schemas. Consider the following code: ---...
5
by: paul_zaoldyeck | last post by:
does anyone know how to validate an xml file against multiple defined schema? can you show me some examples? i'm making here an xml reader.. thank you
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.