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

>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 UTC