W3C home > Mailing lists > Public > xmlschema-dev@w3.org > February 2003

Re: a problem with derivation by restriction

From: Henry S. Thompson <ht@cogsci.ed.ac.uk>
Date: 12 Feb 2003 15:52:25 +0000
To: "Stoyka Stoyanova" <stoyka@practicorp.com>
Cc: <xmlschema-dev@w3.org>
Message-ID: <f5bbs1hfqdi.fsf@erasmus.inf.ed.ac.uk>

"Stoyka Stoyanova" <stoyka@practicorp.com> writes:

> I try to validate my XML against XSD Schema (MyScheme.xsd - see below) using the XmlValidatingReader in my C# project.
> Here is the error messge I've received:
>     "XMLValidatingReader class cannot allow changing of attributes restriction."

That's a pretty obscure message.
> 
> but XMLSPY 5 has validate the same file successfully.

It shouldn't -- you schema is not valid.

> I've found that if the attribute (MinValue or MaxValue) is changed
> from "optional" to "prohibited", the XMLValidatingReader does'n
> generate an error.

See below.

> Is that scheme correct or no?

No.

> Could you suggest me any XML validating parser?

XSV [1] for one -- you can use it online at [2].

>   <xs:attribute name="MinValue" type="xs:decimal" use="optional" />

>      <xs:attribute name="MinValue" use="required" />

There's your problem -- XSV says:

 "restricting attribute with type
 {http://www.w3.org/2001/XMLSchema}anySimpleType not derived from
 declared base's attribute's type
 http://www.w3.org/2001/XMLSchema{decimal}"

In other words, because you didn't give a type for MinValue it
defaulted to anySimpleType, which is not a restriction of decimal.
Just add type="xs:decimal" and you should be OK.

ht

[1] http://www.ltg.ed.ac.uk/~ht/xsv-status.html
[2] http://www.w3.org/2001/03/webdata/xsv
-- 
  Henry S. Thompson, HCRC Language Technology Group, University of Edinburgh
                      Half-time member of W3C Team
     2 Buccleuch Place, Edinburgh EH8 9LW, SCOTLAND -- (44) 131 650-4440
	    Fax: (44) 131 650-4587, e-mail: ht@cogsci.ed.ac.uk
		     URL: http://www.ltg.ed.ac.uk/~ht/
 [mail really from me _always_ has this .sig -- mail without it is forged spam]
Received on Wednesday, 12 February 2003 10:52:17 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 11 January 2011 00:14:36 GMT