← Prev in month ← Prev in thread
Next in thread → Next in month →

XML Schema validation errors

From
adf dsfa <>
To
,
Date
2004-07-30T06:40:22Z
ID
<>
Thread
XML Schema validation errors
My XML schema passes the validation of XMLSpy(2004)
without any problem, however, when I loaded it to
validate an instance XML document in my C# program, I
got many errors and warnings for the schema itself,
e.g.:


1. In complexType T1, an attribute is defined as: 

<xs:attribute name="attr1" type="xs:string"
use="prohibited"/>

But I got: 

Warning: The �attr1� attribute is equivalent to no
component since the value of prohibited for attribute
use serves to only prevent inheritance of an
identically named attribute use from the base type
definition.� An error occurred�
�
Is it just a kindly warning, which shouldn�t actually
prevent me from using it for validation?

�

2. And a same attribute is defined in a complexType
derived from T1 by restriction as: 

<xs:attribute name="attr1" type="xs:string"
use="prohibited" fixed="fixed_value"/>

But I got:

Error: The {base type definition} must have an
{attribute wildcard} and the {target namespace} of the
R's {attribute declaration} must be valid with respect
to that wildcard. An error occurred at �

What does it mean?

�

3. Another attribute is defined as: 
�����������������������������������������������
<xs:attribute name="attr2" use="required">
  <xs:simpleType>
��� <xs:restriction base="xs:string">
����� <xs:enumeration value="value1"/>
����� <xs:enumeration value="value2"/>
��� </xs:restriction>
� </xs:simpleType>
</xs:attribute>

I got:

Error: Invalid attribute restriction. An error
occurred at �

�

Can anybody here explain me the causes of the above
errors? And why it can pass XMLSpy�s validation, but
failed in C#�s library, System.Xml? Are above
errors/rules defined in W3C�s specifications? 

�

Another question is:

In my C# program, I am trying to load an XML Schema as
a normal XML file and validate it against
http://www.w3.org/2001/XMLSchema, which is defined as
namespace �xs� in the XML Schema. I am using
XmlValidatingReader for this purpose and set
ValidationType as DTD, Auto (I also tried Schema,
which turns out to be totally wrong), but none of them
works, since I added an element <xs:abcd/> in the
schema, but no errors returned. So how can I manually
validate an XML Schema just as a normal XML doc in C#?

Any of your help will be highly appreciated.

Thanks a lot.

Shen

�

�

�

�




	
		
__________________________________
Do you Yahoo!?
New and Improved Yahoo! Mail - 100MB free storage!
http://promotions.yahoo.com/new_mail
← Prev in month ← Prev in thread
Next in thread → Next in month →