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

Re: Applicative attribute

From: Henry S. Thompson <ht@cogsci.ed.ac.uk>
Date: 14 Feb 2003 11:02:16 +0000
To: "Bruno Chatel" <bcha@chadocs.net>
Cc: <xmlschema-dev@w3.org>
Message-ID: <f5b7kc36s7b.fsf@erasmus.inf.ed.ac.uk>

"Bruno Chatel" <bcha@chadocs.net> writes:

> Hi,
> I want to use some "applicative attributes" in XMLdocuments
> that are processed with schemas.
> The idea I found was to use a particular namespace for these attributes
> without modifying my "target" schemas.
> Something like this :
> doc.xsd : targerNamespace = http://www.mutu-xml.org/mydoc
>     describes doc components (content model) in this namespace
>     an element test is only declared as empty witout attributes
> doc.xml : 
>   <doc xmlns="http://www.mutu-xml.org/mydoc" 
>     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>     xmlns:app=http://www.mutu-xml.org/mydoc/appl
>     xsi:schemaLocation="http://www.mutu-xml.org/mydoc doc.xsd">
>     <test app:id="1"/>
> </doc>
> But it is rejected by a validator (such as Xerces) indicating that
>   app:id us not allowed to appear in element 'test'
> I am ok with this message... but is there a way to indicate that all
> attributes of a namespace ( particlular one or any other than the targetNamespace)
>  must be ignored ?

Sure, just add <xs:anyAttribute namespace="##other"/> to your element
declaration.  If you want it on all your elements, define an empty
type with <xs:anyAttribute namespace="##other"/> and derive all your
other type definitions by extension from it -- that's what the schema
for schema [1] does, for example.


[1] http://www.w3.org/2001/XMLSchema.xsd
  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 Friday, 14 February 2003 06:02:08 GMT

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