- From: Henry S. Thompson <ht@cogsci.ed.ac.uk>
- Date: 24 Aug 2001 11:37:30 +0100
- To: Ken Haiya <kenhaiya@trestla.com>
- Cc: <xmlschema-dev@w3.org>
Ken Haiya <kenhaiya@trestla.com> writes:
> I have an issue with attributes that are declared under the schema element.
>
> Given the following global declarations (assuming default namespace is that
> of XML Schema, targetNamespace = "myNamespace", elementFormDefault =
> "qualified", attributeFormDefault = "unqualified":
>
> <attribute name = "foo" type = "string"/>
>
> <element name = "bar">
> <complexType>
> <attribute name = "baz" type = "integer"/>
> </complexType>
> </element>
>
> Is the following markup valid in an instance (assuming default namespace =
> "myNamespace" and xmlns:my = "myNamespace")?
>
> <bar baz="27" my:foo="boo"/>
>
> Since foo was never explicitly declared as an attribute of <bar>, shouldn't
> the validation fail?
Yes, it should give an error.
> Or is it the case that a global attribute can be added to *any*
> element whether declared by the element's type or not.
No. Attributes and elements are parallel in this regard -- only
allowed if the relevant type definition explicitly 'ref's a global
declaration or includes a local declaration for them.
ht
--
Henry S. Thompson, HCRC Language Technology Group, University of Edinburgh
W3C Fellow 1999--2001, part-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/
Received on Friday, 24 August 2001 06:37:07 UTC