W3C home > Mailing lists > Public > xmlschema-dev@w3.org > September 2004

Newbie question: Needed help in namespace problems in xsds

From: Imran Khan <imran@veritas.com>
Date: Thu, 2 Sep 2004 15:52:35 +0530
To: <xmlschema-dev@w3.org>
Cc: <2imkhan@gmail.com>
Message-ID: <EOELKDPBCOOJOCPGGAIDCEOLCOAA.imran@veritas.com>

Hi,

	I am trying to refer to my type of "string" "int" "enum" defined in say
MyDefintions.xsd, this type is made of Type complexType. ( Names are kept
same for the reason/sake of compatibility and matching against database
tables). I am grouping them in < xsd:group... > tag and providing it as a
<xsd:choice.. in my root element of table.

After defining my types ( ie. int, string, boolean) i would like to use them
in the xsd elements i am declaring ahead for usage. I would like to know how
do i handle the namespace problem out here. Also it seems that
targetnamespace only takes URI  and does not refer to current dir by default
first. I would like to know an alternative to this too.

Some of the xsd and xml excerpts are as follows which have the problems.

types.xsd
====================================
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
            elementFormDefault="qualified">

   <xsd:element name="enum">
    <xsd:complexType>
        <xsd:sequence>
            <xsd:element name="ValidRange">
            <xsd:simpleType>
                <xsd:list itemType="xsd:string"/>
            </xsd:simpleType>
            </xsd:element>
        </xsd:sequence>
    </xsd:complexType>
   </xsd:element>

   <xsd:element name="string">
    <xsd:complexType>
        <xsd:sequence>
            <xsd:element name="Value" type="xsd:string"/>
        </xsd:sequence>
    </xsd:complexType>
   </xsd:element>

   <xsd:element name="int">
    <xsd:complexType>
        <xsd:sequence>
            <xsd:element name="Value" type="xsd:int"/>
        </xsd:sequence>
    </xsd:complexType>
   </xsd:element>

====================================

Defintion.xsd

<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
            xmlns:sntlType='types.xsd'
            targetNamespace="uri:types.xsd"
            elementFormDefault="qualified">


   <!--    -->
   <!-- known types out here are string, int, float,Enumerated,boolean
dervied Enumeration
   define them globally -->

   <xsd:group name="Type">
    <xsd:sequence>
        <xsd:sequence>
            <xsd:element name="String" type="sntlType:string"/>
            <xsd:element name="int" type="sntlType:int"/>
            <xsd:element name="float" type="sntlType:float"/>
            <xsd:element name="boolean" type="sntlType:boolean"/>
        </xsd:sequence>
    </xsd:sequence>
   </xsd:group>

   <xsd:group name="ResourcePolicy">
        <xsd:sequence>
            <xsd:element name="Create">
                <xsd:complexType>
                <xsd:sequence>
                    <xsd:element name="LogicModule" type="xsd:string"/>
                </xsd:sequence>
                <xsd:attribute name="name" use="required"
type="xsd:string"/>
            </xsd:complexType>
            </xsd:element>
            <xsd:element name="Reserve">

@@@@@@@@@@@@@@@ CUT @@@@@@@@@@@@@@@@@@
<xsd:element name="Property" >
	<xsd:complexType>
      	<xsd:sequence>
            	<xsd:element name="DisplayName" type="xsd:string"/>
                  <xsd:element name="Description" type="xsd:string"/>
                  <xsd:element name="Value" type="xsd:string"/>
                  <xsd:element name="DefaultValue" type="xsd:string"/>
                  <xsd:choice >
                  	<xsd:group ref="Type"/>
			</xsd:choice>
                  <xsd:element name="Units" type="xsd:string"/>
                  <xsd:element name="Unitenumeration">
                  	<xsd:simpleType>
	                  	<xsd:list itemType="xsd:string"/>
      			</xsd:simpleType>
			</xsd:element>
                  <xsd:element name="Minim

@@@@@@@@@@@@@@@ CUT @@@@@@@@@@@@@@@@@@
========================================
Received on Thursday, 2 September 2004 10:28:00 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 7 January 2015 14:56:06 UTC