Re: Applicative attribute

"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.

ht

[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 UTC