[Home] [By Thread] [By Date] [Recent Entries]

  • To: xml-dev <xml-dev@l...>
  • Subject: Fine namespace control in XML Schema
  • From: Daniel Prager <danielp@d...>
  • Date: Thu, 11 Jul 2002 12:56:47 +1000
  • Organization: Deakin University

Is it possible to add elements to distinct namespaces in an
XMLSchema and sub-elements to the global namespace
(since contect will disambiguate these nicely)?

E.g. Consider the following XML document:

----------------------------------------------------------------
<example xmlns:a="http://www.example.com/a"
   xmlns:b="http://www.example.com/b">

 <a:frog>
  <name> Spotted tree frog </name>
  <colour> Blue with red spots </colour>
  <leap> minimal </leap>
 </a:frog>

 <b:frog>
  <name> Cane toad </name>
  <poison> Nasty </poison>
  <fecundity> enormous </fecundity>
 </b:frog>
</example>
----------------------------------------------------------------

It satisfies the RELAX NG schema

----------------------------------------------------------------
<grammar xmlns="http://relaxng.org/ns/structure/1.0"
   xmlns:a="http://www.example.com/a"
   xmlns:b="http://www.example.com/b">

<start>
 <element name="example">
  <element name="a:frog"><ref name="frog"/></element>
  <element name="b:frog"><ref name="toad"/></element>
 </element>
</start>

<define name="frog">
 <element name="name"> <text/> </element>
 <element name="colour"> <text/> </element>
 <element name="leap"> <text/> </element>
</define>

<define name="toad">
 <element name="name"> <text/> </element>
 <element name="poison"> <text/> </element>
 <element name="fecundity"> <text/> </element>
</define>

</grammar>
----------------------------------------------------------------

I can't figure out how to disambiguate the two frog
elements in XML Schema (using XML namespaces).
I have looked at `any' and `elementFormDefault',
but neither seems to provide sufficient specifity.

Is there another way?

[ If not, is this kind of functionality on the cards for
XML Schema 1.1? ]


Many thanks

Daniel


--
Dr Daniel Prager
Research Fellow & Consultant
Deakin University & Freelance

Phone: +61 3 9251 7484
Web: www.deakin.edu.au/~danielp



Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member