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

Re: Validation of schema element with non-schema attribute

From: Henry S. Thompson <ht@inf.ed.ac.uk>
Date: Fri, 20 Feb 2004 09:58:42 +0000
To: "Noga Atsil" <Noga.Atsil@smarteam.com>
Cc: <xmlschema-dev@w3.org>, "Keren Friedman" <Keren.Friedman@smarteam.com>
Message-ID: <f5b7jyioywd.fsf@erasmus.inf.ed.ac.uk>

This one is tricky -- since you have used {NS}att as an attribute in
your schema document, you need the schema for NS available _when that
document is validated_.  The xs:import makes it available for
validating other instances, which is not the same thing.

With the following changes, XSV produces the expected error ('value'
is not a decimal):

NS.xsd:
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
  elementFormDefault="qualified" attributeFormDefault="unqualified"
  targetNamespace="NS">
	<xs:attribute name="att" type="xs:integer"/>
</xs:schema>

AttValidation.xsd:
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:p="NS"
elementFormDefault="qualified" attributeFormDefault="unqualified"
   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
   xsi:schemaLocation="NS NS.xsd">
	<xs:element name="myElement">
		<xs:complexType>
			<xs:sequence></xs:sequence>
			<xs:attribute name="myAttribute" type="xs:string" p:att="value"/>
		</xs:complexType>
	</xs:element>
</xs:schema>

ht
-- 
 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@inf.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 Friday, 20 February 2004 04:58:58 GMT

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