Re: Schema that mandates elements and attributes from disparate namespaces?

Hi Gavin,

You need to define three schema files (one for each namespace and the main 
one that is not associated with any namespace).  Then in, for example, the 
no-namespace schema, do:

    <xs:element ref="bar:charlie"/>

or:

    <xs:attribute ref="foo:msg"/>

The reffed to elements and attributed in the reffed XSD file do have to be 
global though.  I don't know whether this presents a problem when reffing 
parts of SVG.

HTH,

Pete Cordell
Codalogic
For XML C++ data binding visit http://www.codalogic.com/lmx/

----- Original Message ----- 
From: "Gavin Kistner" <>
To: <xmlschema-dev@w3.org>
Sent: Friday, March 14, 2008 2:01 AM
Subject: Schema that mandates elements and attributes from disparate 
namespaces?


>
> How can I write a schema that requires an XML file to have a structure 
> like the following?
>
>   <root xmlns:foo="http://foo.com" xmlns:bar="http://bar.com">
>     <alpha>This is in the default namespace</alpha>
>     <bravo foo:msg="This namespaced attribute is required on bravo 
> elements." >
>       <bar:charlie>This namespaced element is required as a child of 
> bravo.</bar:charlie>
>     </bravo>
>   </root>
>
> What I'm trying to do is create a specific derivation of SVG, that  allows 
> certain namespaced elements and attributes in specific  locations. I don't 
> want to just extend SVG to allow various non- namespaced attributes and 
> elements; I want to require those specific  namespaced items.
>
> Thanks in advance!
>
>
> 

Received on Friday, 14 March 2008 10:09:03 UTC