W3C home > Mailing lists > Public > xmlschema-dev@w3.org > March 2008

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

From: Pete Cordell <petexmldev@codalogic.com>
Date: Fri, 14 Mar 2008 10:03:07 -0000
Message-ID: <007c01c885ba$9e367740$b800a8c0@Codalogic>
To: "Gavin Kistner" <phrogz@mac.com>, <xmlschema-dev@w3.org>

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 GMT

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