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

RE: Restricting global 'CommonType' elements in instance document s

From: Cams Ismael <Ismael.Cams@siemens.com>
Date: Tue, 25 Mar 2003 10:02:57 +0100
Message-ID: <57FD2C3A246F76438CA6FDAD8FE9F1957ABC6C@hrtades7.atea.be>
To: "'xmlschema-dev@w3.org'" <xmlschema-dev@w3.org>
>The problem is that, under the current design, there is no way to restrict
an instance document from providing <POBox> as the root element, since it's
[Cams Ismael] > a global element in an included schema. 

>I'd like to keep these basic commonTypes as they are (for future growth)
but also constrain the available root for instance documents.

Hello Viju,
 
what I do when I have some common types, is to define them only as
simpleTypes and complexTypes. When I need an element of that type I create
that element on the moment I need it. So what I should do is:
 
CommonTypes.xsd:
<schema>
    <simpleType name="POBoxType">
        <xsd:restriction base="xsd:string"/>
    </simpleType>
 
client schema:
    <schema>
          <include schemaLocation="CommonTypes.xsd">
          <element name="Foo">
                <complexType>
                      <element name="POBox" type="POBoxType">
                </complexType>
          <element>
     </schema>
 
Now you prevent from using the POBoxType as global element, but it's it
still usable by other schemas.
 
Kind regards,
IsmaŽl

 
Received on Tuesday, 25 March 2003 04:03:10 GMT

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