At 04:45 PM 8/30/01 +0200, you wrote:
>Hi all,
>
>I have problems using namespaces and schema together in an application.
>To be honest I don't no much about namespaces and schemas yet but have
>to learn it. Ok, so what I am looking for is a simple xml-file like
>personal-schema.xml and a corresponding xsd-file like personal.xsd but
>which both uses also namespaces. Well, I know I could also start and
>read the complete schema definition, but I would prefer to look at a
>simple example first, so I get an idea what it's all about. Perhaps
>somebody has something like that and would be so kind to post it here.


I think this is what you want:

[personal-schema-namespace.xml]
<my:personnel xmlns:my="urn:myns" 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; 
xsi:schemaLocation="urn:myns personal-namespace.xsd">
   <my:person id="Big.Boss" >
     <my:name><my:family>Boss</my:family> <my:given>Big</my:given></my:name>
     <my:email>[EMAIL PROTECTED]</my:email>
   </my:person>
</my:personnel>

[personal-namespace.xsd]
<schema xmlns='http://www.w3.org/2001/XMLSchema' xmlns:ns="urn:myns" 
targetNamespace="urn:myns">

  <element name="personnel">
   <complexType>
    <sequence>
      <element ref="ns:person" minOccurs='1' maxOccurs='unbounded'/>
    </sequence>
   </complexType>
  </element>

  <element name="person">
   <complexType>
    <sequence>
      <element ref="ns:name"/>
      <element ref="ns:email" minOccurs='0' maxOccurs='unbounded'/>
      <element ref="ns:url"   minOccurs='0' maxOccurs='unbounded'/>
      <element ref="ns:link"  minOccurs='0' maxOccurs='1'/>
    </sequence>
    <attribute name="id"  type="ID" use='required'/>
    <attribute name="note" type="string"/>
    <attribute name="contr" default="false">
     <simpleType>
      <restriction base = "string">
        <enumeration value="true"/>
        <enumeration value="false"/>
      </restriction>
     </simpleType>
    </attribute>
    <attribute name="salary" type="integer"/>
   </complexType>
  </element>

  <element name="name">
   <complexType>
    <sequence>
     <element ref="ns:family"/>
     <element ref="ns:given"/>
    </sequence>
   </complexType>
  </element>

  <element name="family" type='string'/>

  <element name="given" type='string'/>

  <element name="email" type='string'/>

  <element name="url">
   <complexType>
    <attribute name="href" type="string" default="http://"/>
   </complexType>
  </element>

  <element name="link">
   <complexType>
    <attribute name="manager" type="IDREF"/>
    <attribute name="subordinates" type="IDREFS"/>
   </complexType>
  </element>

  <notation name='gif' public='-//APP/Photoshop/4.0' system='photoshop.exe'/>

</schema>

Alberto

-------------------------------
Alberto Massari
eXcelon Corp.
http://www.StylusStudio.com


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to