OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.


Help: OASIS Mailing Lists Help | MarkMail Help



   XML Schema validation errors

[ Lists Home | Date Index | Thread Index ]

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,

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

<xs:attribute name="attr1" type="xs:string"

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:restriction base="xs:string">
      <xs:enumeration value="value1"/>
      <xs:enumeration value="value2"/>

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.






Do you Yahoo!?
New and Improved Yahoo! Mail - 100MB free storage!


News | XML in Industry | Calendar | XML Registry
Marketplace | Resources | MyXML.org | Sponsors | Privacy Statement

Copyright 2001 XML.org. This site is hosted by OASIS