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:
    <simpleType name="POBoxType">
        <xsd:restriction base="xsd:string"/>
client schema:
          <include schemaLocation="CommonTypes.xsd">
          <element name="Foo">
                      <element name="POBox" type="POBoxType">
Now you prevent from using the POBoxType as global element, but it's it
still usable by other schemas.
Kind regards,

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

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 23:15:09 UTC