[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

XML Schema validation errors


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 

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
 

Stylus Studio has published XML-DEV in RSS and ATOM formats, enabling users to easily subcribe to the list from their preferred news reader application.


Stylus Studio Sponsored Links are added links designed to provide related and additional information to the visitors of this website. they were not included by the author in the initial post. To view the content without the Sponsor Links please click here.

Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.