[prev in list] [next in list] [prev in thread] [next in thread]
List: xml-dev
Subject: RE: [xml-dev] help me in writing schema file for the xml
From: "Jahanshahi, Fariba" <fariba.jahanshahi () eds ! com>
Date: 2005-11-21 17:36:54
Message-ID: A000D3966797254ABDF04DBB71ED6EB001344FA6 () usplm238 ! amer ! corp ! eds ! com
[Download RAW message or body]
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@eds.com
mail-stop: A3-3A-40
work-loc: 5400 Legacy Drive, Plano, TX 75024
-----Original Message-----
From: shashishekhar [mailto:shashishekhar@tataelxsi.co.in]
Sent: Monday, November 21, 2005 7:18 AM
To: xml-dev@lists.xml.org
Subject: [xml-dev] 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
[Attachment #3 (text/html)]
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD><TITLE>Message</TITLE>
<META http-equiv=Content-Type content="text/html; charset=us-ascii">
<META content="MSHTML 6.00.2900.2180" name=GENERATOR></HEAD>
<BODY>
<DIV><SPAN class=813443517-21112005><FONT face=Arial color=#0000ff size=2>I am
not an expert but I believe what you're asking would be achieved by
following:</FONT></SPAN></DIV>
<DIV><SPAN class=813443517-21112005><FONT face=Arial color=#0000ff
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=813443517-21112005><FONT color=#0000ff>
<P><</FONT>xs:simpleType<FONT color=#ff0000> name</FONT><FONT
color=#0000ff>="</FONT>AgeType<FONT color=#0000ff>"></FONT></P>
<P><FONT color=#0000ff><</FONT>xs:restriction<FONT color=#ff0000>
base</FONT><FONT color=#0000ff>="</FONT>xs:integer<FONT
color=#0000ff>"/></P></FONT>
<P><FONT color=#0000ff></</FONT>xs:simpleType<FONT
color=#0000ff>></P></FONT>
<P><FONT color=#0000ff><</FONT>xs:simpleType<FONT color=#ff0000>
name</FONT><FONT color=#0000ff>="</FONT>GenderType<FONT
color=#0000ff>"></P></FONT>
<P><FONT color=#0000ff><</FONT>xs:restriction<FONT color=#ff0000>
base</FONT><FONT color=#0000ff>="</FONT>xs:string<FONT
color=#0000ff>"/></P></FONT>
<P><FONT color=#0000ff></</FONT>xs:simpleType<FONT
color=#0000ff>></P></FONT>
<P><FONT color=#0000ff><</FONT>xs:simpleType<FONT color=#ff0000>
name</FONT><FONT color=#0000ff>="</FONT>LangType<FONT
color=#0000ff>"></P></FONT>
<P><FONT color=#0000ff><</FONT>xs:restriction<FONT color=#ff0000>
base</FONT><FONT color=#0000ff>="</FONT>xs:string<FONT
color=#0000ff>"></P></FONT>
<P><FONT color=#0000ff><</FONT>xs:enumeration<FONT color=#ff0000>
value</FONT><FONT color=#0000ff>="</FONT>English<FONT
color=#0000ff>"/></P></FONT>
<P><FONT color=#0000ff><</FONT>xs:enumeration<FONT color=#ff0000>
value</FONT><FONT color=#0000ff>="</FONT>French<FONT
color=#0000ff>"/></P></FONT>
<P><FONT color=#0000ff></</FONT>xs:restriction<FONT
color=#0000ff>></P></FONT>
<P><FONT color=#0000ff></</FONT>xs:simpleType<FONT
color=#0000ff>></P></FONT>
<P><FONT color=#0000ff><</FONT>xs:complexType<FONT color=#ff0000>
name</FONT><FONT color=#0000ff>="</FONT>SType<FONT
color=#0000ff>"></P></FONT>
<P><FONT color=#0000ff><</FONT>xs:complexContent<FONT
color=#0000ff>></P></FONT>
<P><FONT color=#0000ff><</FONT>xs:extension<FONT color=#ff0000>
base</FONT><FONT color=#0000ff>="</FONT>tns:SH<FONT
color=#0000ff>"></P></FONT>
<P><FONT color=#0000ff><</FONT>xs:sequence<FONT color=#0000ff>></P></FONT>
<P><FONT color=#0000ff><</FONT>xs:element<FONT color=#ff0000>
name</FONT><FONT color=#0000ff>="</FONT>Subject<FONT color=#0000ff>"</FONT><FONT
color=#ff0000> type</FONT><FONT color=#0000ff>="</FONT>tns:LangType<FONT
color=#0000ff>"</FONT><FONT color=#ff0000> maxOccurs</FONT><FONT
color=#0000ff>="</FONT>unbounded<FONT color=#0000ff>"/></P></FONT>
<P><FONT color=#0000ff></</FONT>xs:sequence<FONT
color=#0000ff>></P></FONT>
<P><FONT color=#0000ff></</FONT>xs:extension<FONT
color=#0000ff>></P></FONT>
<P><FONT color=#0000ff></</FONT>xs:complexContent<FONT
color=#0000ff>></P></FONT>
<P><FONT color=#0000ff></</FONT>xs:complexType<FONT
color=#0000ff>></P></FONT>
<P><FONT color=#0000ff><</FONT>xs:complexType<FONT color=#ff0000>
name</FONT><FONT color=#0000ff>="</FONT>SH<FONT color=#0000ff>"></P></FONT>
<P><FONT color=#0000ff><</FONT>xs:choice<FONT color=#ff0000>
maxOccurs</FONT><FONT color=#0000ff>="</FONT>2<FONT
color=#0000ff>"></P></FONT>
<P><FONT color=#0000ff><</FONT>xs:element<FONT color=#ff0000>
name</FONT><FONT color=#0000ff>="</FONT>Age<FONT color=#0000ff>"</FONT><FONT
color=#ff0000> type</FONT><FONT color=#0000ff>="</FONT>tns:AgeType<FONT
color=#0000ff>"/></P></FONT>
<P><FONT color=#0000ff><</FONT>xs:element<FONT color=#ff0000>
name</FONT><FONT color=#0000ff>="</FONT>Gender<FONT color=#0000ff>"</FONT><FONT
color=#ff0000> type</FONT><FONT color=#0000ff>="</FONT>tns:GenderType<FONT
color=#0000ff>"/></P></FONT>
<P><FONT color=#0000ff></</FONT>xs:choice<FONT color=#0000ff>></P></FONT>
<P><FONT color=#0000ff></</FONT>xs:complexType<FONT
color=#0000ff>></P></FONT>
<P><FONT color=#0000ff><</FONT>xs:element<FONT color=#ff0000>
name</FONT><FONT color=#0000ff>="</FONT>Data<FONT color=#0000ff>"></P></FONT>
<P><FONT color=#0000ff><</FONT>xs:complexType<FONT
color=#0000ff>></P></FONT>
<P><FONT color=#0000ff><</FONT>xs:choice<FONT color=#ff0000>
maxOccurs</FONT><FONT color=#0000ff>="</FONT>unbounded<FONT
color=#0000ff>"></P></FONT>
<P><FONT color=#0000ff><</FONT>xs:element<FONT color=#ff0000> ref</FONT><FONT
color=#0000ff>="</FONT>tns:_Base<FONT color=#0000ff>"/></P></FONT>
<P><FONT color=#0000ff></</FONT>xs:choice<FONT color=#0000ff>></P></FONT>
<P><FONT color=#0000ff></</FONT>xs:complexType<FONT
color=#0000ff>></P></FONT>
<P><FONT color=#0000ff></</FONT>xs:element<FONT color=#0000ff>></P></FONT>
<P><FONT color=#0000ff><</FONT>xs:element<FONT color=#ff0000>
name</FONT><FONT color=#0000ff>="</FONT>_Base<FONT color=#0000ff>"</FONT><FONT
color=#ff0000> abstract</FONT><FONT color=#0000ff>="</FONT>true<FONT
color=#0000ff>"/></P></FONT>
<P><FONT color=#0000ff><</FONT>xs:element<FONT color=#ff0000>
name</FONT><FONT color=#0000ff>="</FONT>Name<FONT color=#0000ff>"</FONT><FONT
color=#ff0000> type</FONT><FONT color=#0000ff>="</FONT>tns:SType<FONT
color=#0000ff>"</FONT><FONT color=#ff0000> substitutionGroup</FONT><FONT
color=#0000ff>="</FONT>tns:_Base<FONT
color=#0000ff>"/></P></FONT></SPAN></DIV>
<DIV> </DIV>
<DIV> </DIV><!-- Converted from text/rtf format -->
<P><I><FONT face="Edwardian Script ITC" color=#000000
size=5>Regards,</FONT><B></B></I><B></B><B></B><B></B> </P>
<P><I><FONT face="Edwardian Script ITC" color=#0000ff size=5>Fariba Jahanshahi
</FONT></I></P>
<P><FONT face="Times New Roman">Data Architect</FONT> <BR><FONT
face="Times New Roman">EDS – US Data Engineering Capability</FONT> </P>
<P><FONT face=Wingdings color=#ff0000>(</FONT><FONT face="Times New Roman">
phone : +01-972-604-9600</FONT> <BR><FONT face=Wingdings
color=#ff0000>(</FONT><FONT face="Times New Roman"> mobile phone/pager :</FONT>
<BR><FONT face=Wingdings color=#3366ff>+</FONT><FONT face="Times New Roman"> <A
href="mailto:fariba.jahanshahi@eds.com">mailto:fariba.jahanshahi@eds.com</A></FONT>
<BR><FONT face="Times New Roman"> mail-stop: A3-3A-40</FONT>
<BR><FONT face="Times New Roman"> work-loc: 5400 Legacy Drive,
Plano, TX 75024</FONT><U></U> </P><BR>
<BLOCKQUOTE dir=ltr style="MARGIN-RIGHT: 0px">
<DIV></DIV>
<DIV class=OutlookMessageHeader lang=en-us dir=ltr align=left><FONT
face=Tahoma size=2>-----Original Message-----<BR><B>From:</B> shashishekhar
[mailto:shashishekhar@tataelxsi.co.in] <BR><B>Sent:</B> Monday, November 21,
2005 7:18 AM<BR><B>To:</B> xml-dev@lists.xml.org<BR><B>Subject:</B> [xml-dev]
help me in writing schema file for the xml<BR><BR></FONT></DIV>
<DIV><FONT face=Tahoma size=2><BR></FONT> </DIV>
<DIV><SPAN class=054140513-21112005><FONT size=2>Hello All</FONT></SPAN></DIV>
<DIV><SPAN class=054140513-21112005><FONT
size=2> I need ur help writing xml schema
for scepific xml file described below:</FONT></SPAN></DIV>
<DIV><SPAN class=054140513-21112005><FONT size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=054140513-21112005><FONT size=2>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.</FONT></SPAN></DIV>
<DIV><SPAN class=054140513-21112005></SPAN> </DIV>
<DIV><SPAN class=054140513-21112005><FONT size=2>say my xml file
is: </FONT></SPAN></DIV>
<DIV><SPAN class=054140513-21112005><FONT size=2>
<Name></FONT></SPAN></DIV>
<DIV><SPAN class=054140513-21112005><FONT
size=2>
<Age>10</Age></FONT></SPAN></DIV>
<DIV><SPAN class=054140513-21112005><FONT
size=2>
<Sex>Male</Male></FONT></SPAN></DIV>
<DIV><SPAN
class=054140513-21112005> <Subject>English</Subject></SPAN></DIV>
<DIV><SPAN
class=054140513-21112005> <Subject>French</Subject></SPAN></DIV>
<DIV><SPAN class=054140513-21112005>
<Subject>German</Subject</SPAN></DIV>
<DIV><SPAN class=054140513-21112005>
</Name></SPAN></DIV>
<DIV><SPAN class=054140513-21112005></SPAN> </DIV>
<DIV><SPAN class=054140513-21112005><FONT size=2>
</FONT><FONT size=3>i.e <STRONG>'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 <U>child elements to occur in any
order.</U></STRONG> 'Age', 'Sex' and Subject can occur in any order. Plz
help me writing the schema for this xml file.</FONT></SPAN></DIV>
<DIV><SPAN class=054140513-21112005></SPAN> </DIV>
<DIV><SPAN class=054140513-21112005><FONT size=2>Lots n Lots of thanks in
advance</FONT></SPAN></DIV>
<DIV><SPAN class=054140513-21112005></SPAN> </DIV>
<DIV><FONT face=Arial color=#0000ff size=2>with regards</FONT></DIV>
<DIV><FONT face=Arial color=#0000ff size=2>Shashi Shekhar</FONT></DIV>
<DIV> </DIV></BLOCKQUOTE></BODY></HTML>
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic