W3C home > Mailing lists > Public > xmlschema-dev@w3.org > June 2001

Re: attributes with prefix in schema

From: Henry S. Thompson <ht@cogsci.ed.ac.uk>
Date: 20 Jun 2001 14:00:56 +0100
To: sandygao@ca.ibm.com
Cc: xmlschema-dev@w3.org
Message-ID: <f5bg0cv9ugn.fsf@cogsci.ed.ac.uk>
sandygao@ca.ibm.com writes:

> Hi all. I'm trying to understand how to process attributes with prefix in
> schema.
> The following segment is from "schema for schemas":
>  <xs:complexType name="openAttrs">
>    <xs:annotation>
>      <xs:documentation>
>        This type is extended by almost all schema types
>        to allow attributes from other namespaces to be
>        added to user schemas.
>      </xs:documentation>
>    </xs:annotation>
>    <xs:complexContent>
>      <xs:restriction base="xs:anyType">
>        <xs:anyAttribute namespace="##other" processContents="lax"/>
>      </xs:restriction>
>    </xs:complexContent>
>  </xs:complexType>
> I have three questions:
> 1. "This type is extended by almost all schema types to allow attributes
> from other namespaces to be added to user schemas." How about attributes
> from the schema namespace?

Not allowed -- definition of ##other means 'qualified, but not with

 For example:
>    <xsd:element name="ele" type="xsd:string" xsd:use="invalid"/>
> Is "xsd:use" considered to be the same as "use", or is it not allowed to
> appear?

No, so yes, it's not allowed.

> 2. Does anyone know what are the exceptions of "almost all schema types"? I
> went through all XML Representations of schema elements. It seems to me
> that "{any attributes with non-schema namespace . . .}" doesn't appear in
> "group", "appInfo", and "document", so I suspect that these 3 doesn't allow
> attributes from other namespaces. Then I checked the schema for schemas,
> but "group" seems to have two different types: groupRef and namedGroup,
> where the first one extends "openAttrs" and the second one doesn't. Is this
> an errata? I would think that "group" should also allow attributes from
> other namespaces. (Otherwise, what makes it so different from others?)

Good catch -- I think you're right and namedGroup should be derived
from annotated (and thence from openAttrs).

> 3. Notice that processContents="lax", so it means we should validate those
> attributes if we can find the declarations. Then where are we supposed to
> find such declarations? Consider an example:
> <xsd:schema xmlns:xsd="..." xmlns:test="test" targetNamespace="test">
>   <xsd:attribute name="att" type="xsd:decimal"/>
>   <xsd:element name="ele" test:att="invalid"/>
> </xsd:schema>
> Then are we supposed to validate "test:att" against the type "xsd:decimal"?

It would be odd to do it that way, but I guess it might work.  The
normal way to do it would be to define the annotation namespace in a
separate schema document, and make that available at validation time
(either via 'schemaLocation' or by direct provision to the schema
processor, e.g. on the command line).


  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 Wednesday, 20 June 2001 09:00:55 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 7 January 2015 14:55:52 UTC