[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

RE: help me in writing schema file for the xml

  • To: "shashishekhar" <shashishekhar@t...>, <xml-dev@l...>
  • Subject: RE: help me in writing schema file for the xml
  • From: "Jahanshahi, Fariba" <fariba.jahanshahi@e...>
  • Date: Mon, 21 Nov 2005 11:36:54 -0600
  • Thread-index: AcXunv7VTi95EJPLTJm3Phyj5R43EAAIwGUw
  • Thread-topic: help me in writing schema file for the xml

writing a schema
Title: Message
I am not an expert but I believe what you're asking would be achieved by following:
 

<xs:simpleType name="AgeType">

<xs:restriction base="xs:integer"/>

</xs:simpleType>

<xs:simpleType name="GenderType">

<xs:restriction base="xs:string"/>

</xs:simpleType>

<xs:simpleType name="LangType">

<xs:restriction base="xs:string">

<xs:enumeration value="English"/>

<xs:enumeration value="French"/>

</xs:restriction>

</xs:simpleType>

<xs:complexType name="SType">

<xs:complexContent>

<xs:extension base="tns:SH">

<xs:sequence>

<xs:element name="Subject" type="tns:LangType" maxOccurs="unbounded"/>

</xs:sequence>

</xs:extension>

</xs:complexContent>

</xs:complexType>

<xs:complexType name="SH">

<xs:choice maxOccurs="2">

<xs:element name="Age" type="tns:AgeType"/>

<xs:element name="Gender" type="tns:GenderType"/>

</xs:choice>

</xs:complexType>

<xs:element name="Data">

<xs:complexType>

<xs:choice maxOccurs="unbounded">

<xs:element ref="tns:_Base"/>

</xs:choice>

</xs:complexType>

</xs:element>

<xs:element name="_Base" abstract="true"/>

<xs:element name="Name" type="tns:SType" substitutionGroup="tns:_Base"/>

 
 

Regards,

Fariba Jahanshahi

Data Architect
EDS – US Data Engineering Capability

( phone : +01-972-604-9600
( mobile phone/pager :
+ mailto:fariba.jahanshahi@e...
  mail-stop:  A3-3A-40
   work-loc: 5400 Legacy Drive, Plano, TX 75024


-----Original Message-----
From: shashishekhar [mailto:shashishekhar@t...]
Sent: Monday, November 21, 2005 7:18 AM
To: xml-dev@l...
Subject: help me in writing schema file for the xml


 
Hello All
       I need ur help writing xml schema for scepific xml file described below:
 
Well, in 1 line the problem is that I want sub elements to occur in any order and schema should allow any number of occurances of the elements. I tried using sequence, choice and all group but could not write effective solution. Let me make myself more clear.
 
say my xml file is: 
     <Name>
           <Age>10</Age>
           <Sex>Male</Male>
        <Subject>English</Subject>
        <Subject>French</Subject>
        <Subject>German</Subject
    </Name>
 
    i.e 'Name' can contain 1 occurance of 'Age',1 occurance of  'Sex' and multiple occurances of Subject. But the major problem is how to write schema allowing the child elements to occur in any order.  'Age', 'Sex' and Subject can occur in any order. Plz help me writing the schema for this xml file.
 
Lots n Lots of thanks in advance
 
with regards
Shashi Shekhar
 

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
 

Stylus Studio has published XML-DEV in RSS and ATOM formats, enabling users to easily subcribe to the list from their preferred news reader application.


Stylus Studio Sponsored Links are added links designed to provide related and additional information to the visitors of this website. they were not included by the author in the initial post. To view the content without the Sponsor Links please click here.

Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.