Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » XML Schema Definition (XSD) » Repititive elements in Schema: Help!
Repititive elements in Schema: Help! [message #15392] Fri, 28 March 2003 09:27 Go to next message
kaunteya bhattacharya is currently offline kaunteya bhattacharyaFriend
Messages: 24
Registered: July 2009
Junior Member
Hello,
I am curious as to learn how would I go about defining repititive elements
in the schema. I have defined a number of XSDComplexTypeDefinition
elements. But I cant seem to define their multiple occurences in the
schema. For e.g.

<xsd:complexType name="Bank_Operation_Code">
<xsd:element fixed="3!a15d" name="Constraint" type="xsd:string"/>
<xsd:element name="_26T" type="xsd:string"/>
</xsd:complexType>

This element occurs multiple times in my XML document. How do I define
that?
This is quite urgent to me. Any help would be much appreciated.

thanks

kaunteya
Re: Repititive elements in Schema: Help! [message #15428 is a reply to message #15392] Fri, 28 March 2003 10:27 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: merks.ca.ibm.com

--------------EE197CEE0215E8A9C42A12C8
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

Kaunteya,

Are you trying to write something like this?

<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<xsd:complexType name="Bank_Operation_Code">
<xsd:sequence>
<xsd:element maxOccurs="unbounded" fixed="3!a15d"
name="Constraint" type="xsd:string"/>
<xsd:element maxOccurs="unbounded" name="_26T"
type="xsd:string"/>
</xsd:sequence>
</xsd:complexType>
</xsd:schema>

kaunteya bhattacharya wrote:

> Hello,
> I am curious as to learn how would I go about defining repititive elements
> in the schema. I have defined a number of XSDComplexTypeDefinition
> elements. But I cant seem to define their multiple occurences in the
> schema. For e.g.
>
> <xsd:complexType name="Bank_Operation_Code">
> <xsd:element fixed="3!a15d" name="Constraint" type="xsd:string"/>
> <xsd:element name="_26T" type="xsd:string"/>
> </xsd:complexType>
>
> This element occurs multiple times in my XML document. How do I define
> that?
> This is quite urgent to me. Any help would be much appreciated.
>
> thanks
>
> kaunteya

--------------EE197CEE0215E8A9C42A12C8
Content-Type: text/html; charset=us-ascii
Content-Transfer-Encoding: 7bit

<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
<html>
Kaunteya,
<p>Are you trying to write something like this?
<blockquote>&lt;?xml version="1.0" encoding="UTF-8"?>
<br>&lt;xsd:schema xmlns:xsd="<A HREF="http://www.w3.org/2001/XMLSchema">http://www.w3.org/2001/XMLSchema</A>">
<br>&nbsp; &lt;xsd:complexType name="Bank_Operation_Code">
<br>&nbsp;&nbsp;&nbsp; &lt;xsd:sequence>
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;xsd:element <b>maxOccurs="unbounded"</b>
fixed="3!a15d" name="Constraint" type="xsd:string"/>
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;xsd:element <b>maxOccurs="unbounded"</b>
name="_26T" type="xsd:string"/>
<br>&nbsp;&nbsp;&nbsp; &lt;/xsd:sequence>
<br>&nbsp; &lt;/xsd:complexType>
<br>&lt;/xsd:schema></blockquote>
kaunteya bhattacharya wrote:
<blockquote TYPE=CITE>Hello,
<br>I am curious as to learn how would I go about defining repititive elements
<br>in the schema. I have defined a number of XSDComplexTypeDefinition
<br>elements. But I cant seem to define their multiple occurences in the
<br>schema. For e.g.
<p>&lt;xsd:complexType name="Bank_Operation_Code">
<br>&nbsp; &lt;xsd:element fixed="3!a15d" name="Constraint" type="xsd:string"/>
<br>&nbsp; &lt;xsd:element name="_26T" type="xsd:string"/>
<br>&lt;/xsd:complexType>
<p>This element occurs multiple times in my XML document. How do I define
<br>that?
<br>This is quite urgent to me. Any help would be much appreciated.
<p>thanks
<p>kaunteya</blockquote>
</html>

--------------EE197CEE0215E8A9C42A12C8--
Re: Repititive elements in Schema: Help! [message #15461 is a reply to message #15428] Fri, 28 March 2003 12:33 Go to previous messageGo to next message
kaunteya bhattacharya is currently offline kaunteya bhattacharyaFriend
Messages: 24
Registered: July 2009
Junior Member
Hello Ed,

Yes, I am sorry I missed out on the <sequence> element. But I realized
that I cant do the following things with the complexTypeDefinition.

1. I cant seem to add it in a group. Basically clump a number of complex
types in a ModelGroupDefinition. Because XSDParticle content does not take
in XSDComplexType objects.

2. I cant seem to define the cardinality of these complex types..
Essentially what if there are more than one occurence of complex types
within the XML instance document. I know you can do that with maxOccur and
minOccur on XSDParticleContent or elements but not with complexType. But
ElementDeclaration cannot seem to have children.

What is the best design.

thanks for your help
kauntea


Ed Merks wrote:


> --------------EE197CEE0215E8A9C42A12C8
> Content-Type: text/plain; charset=us-ascii
> Content-Transfer-Encoding: 7bit

> Kaunteya,

> Are you trying to write something like this?

> <?xml version="1.0" encoding="UTF-8"?>
> <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
> <xsd:complexType name="Bank_Operation_Code">
> <xsd:sequence>
> <xsd:element maxOccurs="unbounded" fixed="3!a15d"
> name="Constraint" type="xsd:string"/>
> <xsd:element maxOccurs="unbounded" name="_26T"
> type="xsd:string"/>
> </xsd:sequence>
> </xsd:complexType>
> </xsd:schema>

> kaunteya bhattacharya wrote:

> > Hello,
> > I am curious as to learn how would I go about defining repititive elements
> > in the schema. I have defined a number of XSDComplexTypeDefinition
> > elements. But I cant seem to define their multiple occurences in the
> > schema. For e.g.
> >
> > <xsd:complexType name="Bank_Operation_Code">
> > <xsd:element fixed="3!a15d" name="Constraint" type="xsd:string"/>
> > <xsd:element name="_26T" type="xsd:string"/>
> > </xsd:complexType>
> >
> > This element occurs multiple times in my XML document. How do I define
> > that?
> > This is quite urgent to me. Any help would be much appreciated.
> >
> > thanks
> >
> > kaunteya

> --------------EE197CEE0215E8A9C42A12C8
> Content-Type: text/html; charset=us-ascii
> Content-Transfer-Encoding: 7bit

> <!doctype html public "-//w3c//dtd html 4.0 transitional//en">
> <html>
> Kaunteya,
> <p>Are you trying to write something like this?
> <blockquote><?xml version="1.0" encoding="UTF-8"?>
> <br><xsd:schema xmlns:xsd="<A
HREF="http://www.w3.org/2001/XMLSchema">http://www.w3.org/2001/XMLSchema</A>">
> <br>  <xsd:complexType name="Bank_Operation_Code">
> <br>    <xsd:sequence>
> <br>      <xsd:element <b>maxOccurs="unbounded"</b>
> fixed="3!a15d" name="Constraint" type="xsd:string"/>
> <br>      <xsd:element <b>maxOccurs="unbounded"</b>
> name="_26T" type="xsd:string"/>
> <br>    </xsd:sequence>
> <br>  </xsd:complexType>
> <br></xsd:schema></blockquote>
> kaunteya bhattacharya wrote:
> <blockquote TYPE=CITE>Hello,
> <br>I am curious as to learn how would I go about defining repititive
elements
> <br>in the schema. I have defined a number of XSDComplexTypeDefinition
> <br>elements. But I cant seem to define their multiple occurences in the
> <br>schema. For e.g.
> <p><xsd:complexType name="Bank_Operation_Code">
> <br>  <xsd:element fixed="3!a15d" name="Constraint" type="xsd:string"/>
> <br>  <xsd:element name="_26T" type="xsd:string"/>
> <br></xsd:complexType>
> <p>This element occurs multiple times in my XML document. How do I define
> <br>that?
> <br>This is quite urgent to me. Any help would be much appreciated.
> <p>thanks
> <p>kaunteya</blockquote>
> </html>

> --------------EE197CEE0215E8A9C42A12C8--
Re: Repititive elements in Schema: Help! [message #15493 is a reply to message #15461] Fri, 28 March 2003 12:40 Go to previous messageGo to next message
kaunteya bhattacharya is currently offline kaunteya bhattacharyaFriend
Messages: 24
Registered: July 2009
Junior Member
kaunteya bhattacharya wrote:

I forgot to mention the schema has other elements and declarations apart
from the specified complex type. So its more like

<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">

........
<xsd:complexType name="Swift_Operation_Code">
<xsd:sequence>
<xsd:element maxOccurs="unbounded" fixed="3!b234"
name="Constraint" type="xsd:string"/>
<xsd:element maxOccurs="unbounded" name="_28T"
type="xsd:string"/>
</xsd:sequence>
</xsd:complexType>


<xsd:complexType name="Bank_Operation_Code">
<xsd:sequence>
<xsd:element maxOccurs="unbounded" fixed="3!a15d"
name="Constraint" type="xsd:string"/>
<xsd:element maxOccurs="unbounded" name="_26T"
type="xsd:string"/>
</xsd:sequence>
</xsd:complexType>

.........

</xsd:schema>

would like to to clump the two complex types in one group.
thanks
kaunteya


> Hello Ed,

> Yes, I am sorry I missed out on the <sequence> element. But I realized
> that I cant do the following things with the complexTypeDefinition.

> 1. I cant seem to add it in a group. Basically clump a number of complex
> types in a ModelGroupDefinition. Because XSDParticle content does not take
> in XSDComplexType objects.

> 2. I cant seem to define the cardinality of these complex types..
> Essentially what if there are more than one occurence of complex types
> within the XML instance document. I know you can do that with maxOccur and
> minOccur on XSDParticleContent or elements but not with complexType. But
> ElementDeclaration cannot seem to have children.

> What is the best design.

> thanks for your help
> kauntea


> Ed Merks wrote:


> > --------------EE197CEE0215E8A9C42A12C8
> > Content-Type: text/plain; charset=us-ascii
> > Content-Transfer-Encoding: 7bit

> > Kaunteya,

> > Are you trying to write something like this?

> > <?xml version="1.0" encoding="UTF-8"?>
> > <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
> > <xsd:complexType name="Bank_Operation_Code">
> > <xsd:sequence>
> > <xsd:element maxOccurs="unbounded" fixed="3!a15d"
> > name="Constraint" type="xsd:string"/>
> > <xsd:element maxOccurs="unbounded" name="_26T"
> > type="xsd:string"/>
> > </xsd:sequence>
> > </xsd:complexType>
> > </xsd:schema>

> > kaunteya bhattacharya wrote:

> > > Hello,
> > > I am curious as to learn how would I go about defining repititive
elements
> > > in the schema. I have defined a number of XSDComplexTypeDefinition
> > > elements. But I cant seem to define their multiple occurences in the
> > > schema. For e.g.
> > >
> > > <xsd:complexType name="Bank_Operation_Code">
> > > <xsd:element fixed="3!a15d" name="Constraint" type="xsd:string"/>
> > > <xsd:element name="_26T" type="xsd:string"/>
> > > </xsd:complexType>
> > >
> > > This element occurs multiple times in my XML document. How do I define
> > > that?
> > > This is quite urgent to me. Any help would be much appreciated.
> > >
> > > thanks
> > >
> > > kaunteya

> > --------------EE197CEE0215E8A9C42A12C8
> > Content-Type: text/html; charset=us-ascii
> > Content-Transfer-Encoding: 7bit

> > <!doctype html public "-//w3c//dtd html 4.0 transitional//en">
> > <html>
> > Kaunteya,
> > <p>Are you trying to write something like this?
> > <blockquote><?xml version="1.0" encoding="UTF-8"?>
> > <br><xsd:schema xmlns:xsd="<A
>
HREF="http://www.w3.org/2001/XMLSchema">http://www.w3.org/2001/XMLSchema</A>">
> > <br>  <xsd:complexType name="Bank_Operation_Code">
> > <br>    <xsd:sequence>
> > <br>      <xsd:element <b>maxOccurs="unbounded"</b>
> > fixed="3!a15d" name="Constraint" type="xsd:string"/>
> > <br>      <xsd:element <b>maxOccurs="unbounded"</b>
> > name="_26T" type="xsd:string"/>
> > <br>    </xsd:sequence>
> > <br>  </xsd:complexType>
> > <br></xsd:schema></blockquote>
> > kaunteya bhattacharya wrote:
> > <blockquote TYPE=CITE>Hello,
> > <br>I am curious as to learn how would I go about defining repititive
> elements
> > <br>in the schema. I have defined a number of XSDComplexTypeDefinition
> > <br>elements. But I cant seem to define their multiple occurences in the
> > <br>schema. For e.g.
> > <p><xsd:complexType name="Bank_Operation_Code">
> > <br>  <xsd:element fixed="3!a15d" name="Constraint" type="xsd:string"/>
> > <br>  <xsd:element name="_26T" type="xsd:string"/>
> > <br></xsd:complexType>
> > <p>This element occurs multiple times in my XML document. How do I define
> > <br>that?
> > <br>This is quite urgent to me. Any help would be much appreciated.
> > <p>thanks
> > <p>kaunteya</blockquote>
> > </html>

> > --------------EE197CEE0215E8A9C42A12C8--
Re: Repititive elements in Schema: Help! [message #15526 is a reply to message #15461] Fri, 28 March 2003 13:45 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: merks.ca.ibm.com

--------------0969DB8C731F55222437D473
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

Kaunteya,

No, you can't add a complex type definition to a group. A complex type definition
can only be contained by a schema or by an element. So if you want a complex type
definition to be "contained" by a model group you have to create an XSDParticle,
that contains (i.e., setContent()) an XSDElementDeclaration that either contains a
complex type (i.e., setAnonymousTypeDefinitition), or refers to a complex type
(i.e., setTypeDefinition); the particle can be added to any model group (i.e.,
getContents().add()) and the particle can have its maxOccurs set (e.g.,
setMaxOccurs(-1)).

For example:

<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<xsd:complexType name="x">
<xsd:sequence>
<xsd:element minOccurs="0" maxOccurs="unbounded" name="y">
<xsd:complexType> <!-- can't have a name="Bank_Operation_Code"
-->
<xsd:sequence>
<xsd:element minOccurs="0" maxOccurs="unbounded"
fixed="3!a15d" name="Constraint" type="xsd:string"/>
<xsd:element minOccurs="1" maxOccurs="1" name="_26T"
type="xsd:string"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element minOccurs="0" maxOccurs="unbounded" name="z"
type="x"/>
</xsd:sequence>
</xsd:complexType>
</xsd:schema>



kaunteya bhattacharya wrote:

> Hello Ed,
>
> Yes, I am sorry I missed out on the <sequence> element. But I realized
> that I cant do the following things with the complexTypeDefinition.
>
> 1. I cant seem to add it in a group. Basically clump a number of complex
> types in a ModelGroupDefinition. Because XSDParticle content does not take
> in XSDComplexType objects.
>
> 2. I cant seem to define the cardinality of these complex types..
> Essentially what if there are more than one occurence of complex types
> within the XML instance document. I know you can do that with maxOccur and
> minOccur on XSDParticleContent or elements but not with complexType. But
> ElementDeclaration cannot seem to have children.
>
> What is the best design.
>
> thanks for your help
> kauntea
>
>
> Ed Merks wrote:
>
> > --------------EE197CEE0215E8A9C42A12C8
> > Content-Type: text/plain; charset=us-ascii
> > Content-Transfer-Encoding: 7bit
>
> > Kaunteya,
>
> > Are you trying to write something like this?
>
> > <?xml version="1.0" encoding="UTF-8"?>
> > <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
> > <xsd:complexType name="Bank_Operation_Code">
> > <xsd:sequence>
> > <xsd:element maxOccurs="unbounded" fixed="3!a15d"
> > name="Constraint" type="xsd:string"/>
> > <xsd:element maxOccurs="unbounded" name="_26T"
> > type="xsd:string"/>
> > </xsd:sequence>
> > </xsd:complexType>
> > </xsd:schema>
>
> > kaunteya bhattacharya wrote:
>
> > > Hello,
> > > I am curious as to learn how would I go about defining repititive elements
> > > in the schema. I have defined a number of XSDComplexTypeDefinition
> > > elements. But I cant seem to define their multiple occurences in the
> > > schema. For e.g.
> > >
> > > <xsd:complexType name="Bank_Operation_Code">
> > > <xsd:element fixed="3!a15d" name="Constraint" type="xsd:string"/>
> > > <xsd:element name="_26T" type="xsd:string"/>
> > > </xsd:complexType>
> > >
> > > This element occurs multiple times in my XML document. How do I define
> > > that?
> > > This is quite urgent to me. Any help would be much appreciated.
> > >
> > > thanks
> > >
> > > kaunteya
>
> > --------------EE197CEE0215E8A9C42A12C8
> > Content-Type: text/html; charset=us-ascii
> > Content-Transfer-Encoding: 7bit
>
> > <!doctype html public "-//w3c//dtd html 4.0 transitional//en">
> > <html>
> > Kaunteya,
> > <p>Are you trying to write something like this?
> > <blockquote><?xml version="1.0" encoding="UTF-8"?>
> > <br><xsd:schema xmlns:xsd="<A
> HREF="http://www.w3.org/2001/XMLSchema">http://www.w3.org/2001/XMLSchema</A>">
> > <br> <xsd:complexType name="Bank_Operation_Code">
> > <br> <xsd:sequence>
> > <br> <xsd:element <b>maxOccurs="unbounded"</b>
> > fixed="3!a15d" name="Constraint" type="xsd:string"/>
> > <br> <xsd:element <b>maxOccurs="unbounded"</b>
> > name="_26T" type="xsd:string"/>
> > <br> </xsd:sequence>
> > <br> </xsd:complexType>
> > <br></xsd:schema></blockquote>
> > kaunteya bhattacharya wrote:
> > <blockquote TYPE=CITE>Hello,
> > <br>I am curious as to learn how would I go about defining repititive
> elements
> > <br>in the schema. I have defined a number of XSDComplexTypeDefinition
> > <br>elements. But I cant seem to define their multiple occurences in the
> > <br>schema. For e.g.
> > <p><xsd:complexType name="Bank_Operation_Code">
> > <br> <xsd:element fixed="3!a15d" name="Constraint" type="xsd:string"/>
> > <br> <xsd:element name="_26T" type="xsd:string"/>
> > <br></xsd:complexType>
> > <p>This element occurs multiple times in my XML document. How do I define
> > <br>that?
> > <br>This is quite urgent to me. Any help would be much appreciated.
> > <p>thanks
> > <p>kaunteya</blockquote>
> > </html>
>
> > --------------EE197CEE0215E8A9C42A12C8--

--------------0969DB8C731F55222437D473
Content-Type: text/html; charset=us-ascii
Content-Transfer-Encoding: 7bit

<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
<html>
Kaunteya,
<p>No, you can't add a complex type definition to a group.&nbsp; A complex
type definition can only be contained by a schema or by an element.&nbsp;
So if you want a complex type definition to be "contained" by a model group
you have to create an XSDParticle, that contains (i.e., setContent()) an
XSDElementDeclaration that either contains a complex type (i.e., setAnonymousTypeDefinitition),
or refers to a complex type (i.e., setTypeDefinition); the particle can
be added to any model group (i.e., getContents().add()) and the particle
can have its maxOccurs set (e.g., setMaxOccurs(-1)).
<p>For example:
<blockquote>&lt;?xml version="1.0" encoding="UTF-8"?>
<br>&lt;xsd:schema xmlns:xsd="<A HREF="http://www.w3.org/2001/XMLSchema">http://www.w3.org/2001/XMLSchema</A>">
<br>&nbsp; &lt;xsd:complexType name="x">
<br>&nbsp;&nbsp;&nbsp; &lt;xsd:sequence>
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;xsd:element minOccurs="0" maxOccurs="unbounded"
name="y">
<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; &lt;xsd:complexType> &lt;!--
can't have a name="Bank_Operation_Code" -->
<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &lt;xsd:sequence>
<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&lt;xsd:element minOccurs="0" maxOccurs="unbounded" fixed="3!a15d" name="Constraint"
type="xsd:string"/>
<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&lt;xsd:element minOccurs="1" maxOccurs="1" name="_26T" type="xsd:string"/>
<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &lt;/xsd:sequence>
<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; &lt;/xsd:complexType>
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;/xsd:element>
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;xsd:element minOccurs="0" maxOccurs="unbounded"
name="z" type="x"/>
<br>&nbsp;&nbsp;&nbsp; &lt;/xsd:sequence>
<br>&nbsp; &lt;/xsd:complexType>
<br>&lt;/xsd:schema></blockquote>

<br>&nbsp;
<p>kaunteya bhattacharya wrote:
<blockquote TYPE=CITE>Hello Ed,
<p>Yes, I am sorry I missed out on the &lt;sequence> element. But I realized
<br>that I cant do the following things with the complexTypeDefinition.
<p>1. I cant seem to add it in a group. Basically clump a number of complex
<br>types in a ModelGroupDefinition. Because XSDParticle content does not
take
<br>in XSDComplexType objects.
<p>2. I cant seem to define the cardinality of these complex types..
<br>Essentially what if there are more than one occurence of complex types
<br>within the XML instance document. I know you can do that with maxOccur
and
<br>minOccur on XSDParticleContent or elements but not with complexType.
But
<br>ElementDeclaration cannot seem to have children.
<p>What is the best design.
<p>thanks for your help
<br>kauntea
<br>&nbsp;
<p>Ed Merks wrote:
<p>> --------------EE197CEE0215E8A9C42A12C8
<br>> Content-Type: text/plain; charset=us-ascii
<br>> Content-Transfer-Encoding: 7bit
<p>> Kaunteya,
<p>> Are you trying to write something like this?
<p>>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;?xml version="1.0" encoding="UTF-8"?>
<br>>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;xsd:schema xmlns:xsd="<a href="http://www.w3.org/2001/XMLSchema">http://www.w3.org/2001/XMLSchema</a>">
<br>> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; &lt;xsd:complexType name="Bank_Operation_Code">
<br>> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &lt;xsd:sequence>
<br>> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&lt;xsd:element maxOccurs="unbounded" fixed="3!a15d"
<br>>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; name="Constraint" type="xsd:string"/>
<br>> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&lt;xsd:element maxOccurs="unbounded" name="_26T"
<br>>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; type="xsd:string"/>
<br>> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &lt;/xsd:sequence>
<br>> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; &lt;/xsd:complexType>
<br>>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;/xsd:schema>
<p>> kaunteya bhattacharya wrote:
<p>> > Hello,
<br>> > I am curious as to learn how would I go about defining repititive
elements
<br>> > in the schema. I have defined a number of XSDComplexTypeDefinition
<br>> > elements. But I cant seem to define their multiple occurences in
the
<br>> > schema. For e.g.
<br>> >
<br>> > &lt;xsd:complexType name="Bank_Operation_Code">
<br>> >&nbsp;&nbsp; &lt;xsd:element fixed="3!a15d" name="Constraint" type="xsd:string"/>
<br>> >&nbsp;&nbsp; &lt;xsd:element name="_26T" type="xsd:string"/>
<br>> > &lt;/xsd:complexType>
<br>> >
<br>> > This element occurs multiple times in my XML document. How do I
define
<br>> > that?
<br>> > This is quite urgent to me. Any help would be much appreciated.
<br>> >
<br>> > thanks
<br>> >
<br>> > kaunteya
<p>> --------------EE197CEE0215E8A9C42A12C8
<br>> Content-Type: text/html; charset=us-ascii
<br>> Content-Transfer-Encoding: 7bit
<p>> &lt;!doctype html public "-//w3c//dtd html 4.0 transitional//en">
<br>> &lt;html>
<br>> Kaunteya,
<br>> &lt;p>Are you trying to write something like this?
<br>> &lt;blockquote>&lt;?xml version="1.0" encoding="UTF-8"?>
<br>> &lt;br>&lt;xsd:schema xmlns:xsd="&lt;A
<br>HREF="<a href="http://www.w3.org/2001/XMLSchema">http://www.w3.org/2001/XMLSchema</a>"><a href="http://www.w3.org/2001/XMLSchema">http://www.w3.org/2001/XMLSchema</a>&lt;/A>">
<br>> &lt;br>&nbsp; &lt;xsd:complexType name="Bank_Operation_Code">
<br>> &lt;br>&nbsp;&nbsp;&nbsp; &lt;xsd:sequence>
<br>> &lt;br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;xsd:element &lt;b>maxOccurs="unbounded"&lt;/b>
<br>> fixed="3!a15d" name="Constraint" type="xsd:string"/>
<br>> &lt;br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;xsd:element &lt;b>maxOccurs="unbounded"&lt;/b>
<br>> name="_26T" type="xsd:string"/>
<br>> &lt;br>&nbsp;&nbsp;&nbsp; &lt;/xsd:sequence>
<br>> &lt;br>&nbsp; &lt;/xsd:complexType>
<br>> &lt;br>&lt;/xsd:schema>&lt;/blockquote>
<br>> kaunteya bhattacharya wrote:
<br>> &lt;blockquote TYPE=CITE>Hello,
<br>> &lt;br>I am curious as to learn how would I go about defining repititive
<br>elements
<br>> &lt;br>in the schema. I have defined a number of XSDComplexTypeDefinition
<br>> &lt;br>elements. But I cant seem to define their multiple occurences
in the
<br>> &lt;br>schema. For e.g.
<br>> &lt;p>&lt;xsd:complexType name="Bank_Operation_Code">
<br>> &lt;br>&nbsp; &lt;xsd:element fixed="3!a15d" name="Constraint" type="xsd:string"/>
<br>> &lt;br>&nbsp; &lt;xsd:element name="_26T" type="xsd:string"/>
<br>> &lt;br>&lt;/xsd:complexType>
<br>> &lt;p>This element occurs multiple times in my XML document. How
do I define
<br>> &lt;br>that?
<br>> &lt;br>This is quite urgent to me. Any help would be much appreciated.
<br>> &lt;p>thanks
<br>> &lt;p>kaunteya&lt;/blockquote>
<br>> &lt;/html>
<p>> --------------EE197CEE0215E8A9C42A12C8--</blockquote>
</html>

--------------0969DB8C731F55222437D473--
Re: Repititive elements in Schema: Help! [message #15558 is a reply to message #15526] Fri, 28 March 2003 15:37 Go to previous messageGo to next message
kaunteya bhattacharya is currently offline kaunteya bhattacharyaFriend
Messages: 24
Registered: July 2009
Junior Member
thanks,
appreciate your help

Ed Merks wrote:


> --------------0969DB8C731F55222437D473
> Content-Type: text/plain; charset=us-ascii
> Content-Transfer-Encoding: 7bit

> Kaunteya,

> No, you can\'t add a complex type definition to a group. A complex type
definition
> can only be contained by a schema or by an element. So if you want a
complex type
> definition to be \"contained\" by a model group you have to create an
XSDParticle,
> that contains (i.e., setContent()) an XSDElementDeclaration that either
contains a
> complex type (i.e., setAnonymousTypeDefinitition), or refers to a complex
type
> (i.e., setTypeDefinition); the particle can be added to any model group
(i.e.,
> getContents().add()) and the particle can have its maxOccurs set (e.g.,
> setMaxOccurs(-1)).

> For example:

> <?xml version=\"1.0\" encoding=\"UTF-8\"?>
> <xsd:schema xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\">
> <xsd:complexType name=\"x\">
> <xsd:sequence>
> <xsd:element minOccurs=\"0\" maxOccurs=\"unbounded\" name=\"y\">
> <xsd:complexType> <!-- can\'t have a
name=\"Bank_Operation_Code\"
> -->
> <xsd:sequence>
> <xsd:element minOccurs=\"0\" maxOccurs=\"unbounded\"
> fixed=\"3!a15d\" name=\"Constraint\" type=\"xsd:string\"/>
> <xsd:element minOccurs=\"1\" maxOccurs=\"1\" name=\"_26T\"
> type=\"xsd:string\"/>
> </xsd:sequence>
> </xsd:complexType>
> </xsd:element>
> <xsd:element minOccurs=\"0\" maxOccurs=\"unbounded\" name=\"z\"
> type=\"x\"/>
> </xsd:sequence>
> </xsd:complexType>
> </xsd:schema>



> kaunteya bhattacharya wrote:

> > Hello Ed,
> >
> > Yes, I am sorry I missed out on the <sequence> element. But I realized
> > that I cant do the following things with the complexTypeDefinition.
> >
> > 1. I cant seem to add it in a group. Basically clump a number of complex
> > types in a ModelGroupDefinition. Because XSDParticle content does not take
> > in XSDComplexType objects.
> >
> > 2. I cant seem to define the cardinality of these complex types..
> > Essentially what if there are more than one occurence of complex types
> > within the XML instance document. I know you can do that with maxOccur and
> > minOccur on XSDParticleContent or elements but not with complexType. But
> > ElementDeclaration cannot seem to have children.
> >
> > What is the best design.
> >
> > thanks for your help
> > kauntea
> >
> >
> > Ed Merks wrote:
> >
> > > --------------EE197CEE0215E8A9C42A12C8
> > > Content-Type: text/plain; charset=us-ascii
> > > Content-Transfer-Encoding: 7bit
> >
> > > Kaunteya,
> >
> > > Are you trying to write something like this?
> >
> > > <?xml version=\"1.0\" encoding=\"UTF-8\"?>
> > > <xsd:schema xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\">
> > > <xsd:complexType name=\"Bank_Operation_Code\">
> > > <xsd:sequence>
> > > <xsd:element maxOccurs=\"unbounded\" fixed=\"3!a15d\"
> > > name=\"Constraint\" type=\"xsd:string\"/>
> > > <xsd:element maxOccurs=\"unbounded\" name=\"_26T\"
> > > type=\"xsd:string\"/>
> > > </xsd:sequence>
> > > </xsd:complexType>
> > > </xsd:schema>
> >
> > > kaunteya bhattacharya wrote:
> >
> > > > Hello,
> > > > I am curious as to learn how would I go about defining repititive
elements
> > > > in the schema. I have defined a number of XSDComplexTypeDefinition
> > > > elements. But I cant seem to define their multiple occurences in the
> > > > schema. For e.g.
> > > >
> > > > <xsd:complexType name=\"Bank_Operation_Code\">
> > > > <xsd:element fixed=\"3!a15d\" name=\"Constraint\"
type=\"xsd:string\"/>
> > > > <xsd:element name=\"_26T\" type=\"xsd:string\"/>
> > > > </xsd:complexType>
> > > >
> > > > This element occurs multiple times in my XML document. How do I define
> > > > that?
> > > > This is quite urgent to me. Any help would be much appreciated.
> > > >
> > > > thanks
> > > >
> > > > kaunteya
> >
> > > --------------EE197CEE0215E8A9C42A12C8
> > > Content-Type: text/html; charset=us-ascii
> > > Content-Transfer-Encoding: 7bit
> >
> > > <!doctype html public \"-//w3c//dtd html 4.0 transitional//en\">
> > > <html>
> > > Kaunteya,
> > > <p>Are you trying to write something like this?
> > > <blockquote><?xml version=\"1.0\" encoding=\"UTF-8\"?>
> > > <br><xsd:schema xmlns:xsd=\"<A
> >
HREF=\"http://www.w3.org/2001/XMLSchema\">http://www.w3.org/2001/XMLSchema</A>\">
> > > <br> <xsd:complexType name=\"Bank_Operation_Code\">
> > > <br> <xsd:sequence>
> > > <br> <xsd:element <b>maxOccurs=\"unbounded\"</b>
> > > fixed=\"3!a15d\" name=\"Constraint\" type=\"xsd:string\"/>
> > > <br> <xsd:element <b>maxOccurs=\"unbounded\"</b>
> > > name=\"_26T\" type=\"xsd:string\"/>
> > > <br> </xsd:sequence>
> > > <br> </xsd:complexType>
> > > <br></xsd:schema></blockquote>
> > > kaunteya bhattacharya wrote:
> > > <blockquote TYPE=CITE>Hello,
> > > <br>I am curious as to learn how would I go about defining repititive
> > elements
> > > <br>in the schema. I have defined a number of XSDComplexTypeDefinition
> > > <br>elements. But I cant seem to define their multiple occurences in the
> > > <br>schema. For e.g.
> > > <p><xsd:complexType name=\"Bank_Operation_Code\">
> > > <br> <xsd:element fixed=\"3!a15d\" name=\"Constraint\"
type=\"xsd:string\"/>
> > > <br> <xsd:element name=\"_26T\" type=\"xsd:string\"/>
> > > <br></xsd:complexType>
> > > <p>This element occurs multiple times in my XML document. How do I define
> > > <br>that?
> > > <br>This is quite urgent to me. Any help would be much appreciated.
> > > <p>thanks
> > > <p>kaunteya</blockquote>
> > > </html>
> >
> > > --------------EE197CEE0215E8A9C42A12C8--

> --------------0969DB8C731F55222437D473
> Content-Type: text/html; charset=us-ascii
> Content-Transfer-Encoding: 7bit

> <!doctype html public \"-//w3c//dtd html 4.0 transitional//en\">
> <html>
> Kaunteya,
> <p>No, you can\'t add a complex type definition to a group.  A complex
> type definition can only be contained by a schema or by an element. 
> So if you want a complex type definition to be \"contained\" by a model group
> you have to create an XSDParticle, that contains (i.e., setContent()) an
> XSDElementDeclaration that either contains a complex type (i.e.,
setAnonymousTypeDefinitition),
> or refers to a complex type (i.e., setTypeDefinition); the particle can
> be added to any model group (i.e., getContents().add()) and the particle
> can have its maxOccurs set (e.g., setMaxOccurs(-1)).
> <p>For example:
> <blockquote><?xml version=\"1.0\" encoding=\"UTF-8\"?>
> <br><xsd:schema xmlns:xsd=\"<A
HREF=\"http://www.w3.org/2001/XMLSchema\">http://www.w3.org/2001/XMLSchema</A>\">
> <br>  <xsd:complexType name=\"x\">
> <br>    <xsd:sequence>
> <br>      <xsd:element minOccurs=\"0\" maxOccurs=\"unbounded\"
> name=\"y\">
> <br>        <xsd:complexType> <!--
> can\'t have a name=\"Bank_Operation_Code\" -->
> <br>          <xsd:sequence>
> <br>           
> <xsd:element minOccurs=\"0\" maxOccurs=\"unbounded\" fixed=\"3!a15d\"
name=\"Constraint\"
> type=\"xsd:string\"/>
> <br>           
> <xsd:element minOccurs=\"1\" maxOccurs=\"1\" name=\"_26T\"
type=\"xsd:string\"/>
> <br>          </xsd:sequence>
> <br>        </xsd:complexType>
> <br>      </xsd:element>
> <br>      <xsd:element minOccurs=\"0\" maxOccurs=\"unbounded\"
> name=\"z\" type=\"x\"/>
> <br>    </xsd:sequence>
> <br>  </xsd:complexType>
> <br></xsd:schema></blockquote>

> <br> 
> <p>kaunteya bhattacharya wrote:
> <blockquote TYPE=CITE>Hello Ed,
> <p>Yes, I am sorry I missed out on the <sequence> element. But I realized
> <br>that I cant do the following things with the complexTypeDefinition.
> <p>1. I cant seem to add it in a group. Basically clump a number of complex
> <br>types in a ModelGroupDefinition. Because XSDParticle content does not
> take
> <br>in XSDComplexType objects.
> <p>2. I cant seem to define the cardinality of these complex types..
> <br>Essentially what if there are more than one occurence of complex types
> <br>within the XML instance document. I know you can do that with maxOccur
> and
> <br>minOccur on XSDParticleContent or elements but not with complexType.
> But
> <br>ElementDeclaration cannot seem to have children.
> <p>What is the best design.
> <p>thanks for your help
> <br>kauntea
> <br> 
> <p>Ed Merks wrote:
> <p>> --------------EE197CEE0215E8A9C42A12C8
> <br>> Content-Type: text/plain; charset=us-ascii
> <br>> Content-Transfer-Encoding: 7bit
> <p>> Kaunteya,
> <p>> Are you trying to write something like this?
> <p>>      <?xml version=\"1.0\" encoding=\"UTF-8\"?>
> <br>>      <xsd:schema xmlns:xsd=\"<a
href=\"http://www.w3.org/2001/XMLSchema\">http://www.w3.org/2001/XMLSchema</a>\">
> <br>>        <xsd:complexType name=\"Bank_Operation_Code\">
> <br>>          <xsd:sequence>
> <br>>           
> <xsd:element maxOccurs=\"unbounded\" fixed=\"3!a15d\"
> <br>>      name=\"Constraint\" type=\"xsd:string\"/>
> <br>>           
> <xsd:element maxOccurs=\"unbounded\" name=\"_26T\"
> <br>>      type=\"xsd:string\"/>
> <br>>          </xsd:sequence>
> <br>>        </xsd:complexType>
> <br>>      </xsd:schema>
> <p>> kaunteya bhattacharya wrote:
> <p>> > Hello,
> <br>> > I am curious as to learn how would I go about defining repititive
> elements
> <br>> > in the schema. I have defined a number of XSDComplexTypeDefinition
> <br>> > elements. But I cant seem to define their multiple occurences in
> the
> <br>> > schema. For e.g.
> <br>> >
> <br>> > <xsd:complexType name=\"Bank_Operation_Code\">
> <br>> >   <xsd:element fixed=\"3!a15d\" name=\"Constraint\"
type=\"xsd:string\"/>
> <br>> >   <xsd:element name=\"_26T\" type=\"xsd:string\"/>
> <br>> > </xsd:complexType>
> <br>> >
> <br>> > This element occurs multiple times in my XML document. How do I
> define
> <br>> > that?
> <br>> > This is quite urgent to me. Any help would be much appreciated.
> <br>> >
> <br>> > thanks
> <br>> >
> <br>> > kaunteya
> <p>> --------------EE197CEE0215E8A9C42A12C8
> <br>> Content-Type: text/html; charset=us-ascii
> <br>> Content-Transfer-Encoding: 7bit
> <p>> <!doctype html public \"-//w3c//dtd html 4.0 transitional//en\">
> <br>> <html>
> <br>> Kaunteya,
> <br>> <p>Are you trying to write something like this?
> <br>> <blockquote><?xml version=\"1.0\" encoding=\"UTF-8\"?>
> <br>> <br><xsd:schema xmlns:xsd=\"<A
> <br>HREF=\"<a
href=\"http://www.w3.org/2001/XMLSchema\">http://www.w3.org/2001/XMLSchema</a>\"><a
href=\"http://www.w3.org/2001/XMLSchema\">http://www.w3.org/2001/XMLSchema</a></A>\">
> <br>> <br>  <xsd:complexType name=\"Bank_Operation_Code\">
> <br>> <br>    <xsd:sequence>
> <br>> <br>      <xsd:element <b>maxOccurs=\"unbounded\"</b>
> <br>> fixed=\"3!a15d\" name=\"Constraint\" type=\"xsd:string\"/>
> <br>> <br>      <xsd:element <b>maxOccurs=\"unbounded\"</b>
> <br>> name=\"_26T\" type=\"xsd:string\"/>
> <br>> <br>    </xsd:sequence>
> <br>> <br>  </xsd:complexType>
> <br>> <br></xsd:schema></blockquote>
> <br>> kaunteya bhattacharya wrote:
> <br>> <blockquote TYPE=CITE>Hello,
> <br>> <br>I am curious as to learn how would I go about defining repititive
> <br>elements
> <br>> <br>in the schema. I have defined a number of XSDComplexTypeDefinition
> <br>> <br>elements. But I cant seem to define their multiple occurences
> in the
> <br>> <br>schema. For e.g.
> <br>> <p><xsd:complexType name=\"Bank_Operation_Code\">
> <br>> <br>  <xsd:element fixed=\"3!a15d\" name=\"Constraint\"
type=\"xsd:string\"/>
> <br>> <br>  <xsd:element name=\"_26T\" type=\"xsd:string\"/>
> <br>> <br></xsd:complexType>
> <br>> <p>This element occurs multiple times in my XML document. How
> do I define
> <br>> <br>that?
> <br>> <br>This is quite urgent to me. Any help would be much appreciated.
> <br>> <p>thanks
> <br>> <p>kaunteya</blockquote>
> <br>> </html>
> <p>> --------------EE197CEE0215E8A9C42A12C8--</blockquote>
> </html>

> --------------0969DB8C731F55222437D473--
Re: Repititive elements in Schema: Help! [message #15592 is a reply to message #15558] Sun, 30 March 2003 21:05 Go to previous message
Dave Spriet is currently offline Dave SprietFriend
Messages: 14
Registered: July 2009
Junior Member
Hello,

Another great place to find out what objects can be added to what is to look
at the XML Schema Part 1: Structures Spec
http://www.w3.org/TR/xmlschema-1/

and the concrete containment diagram
http://dev.eclipse.org/viewcvs/indextech.cgi/~checkout~/xsd- home/docs/javado
c/org/eclipse/xsd/package-summary.html#details

Dave
email: spriet@ca.ibm.com

"kaunteya bhattacharya" <bhatta98@hotmail.com> wrote in message
news:b61q7f$s61$1@rogue.oti.com...
> thanks,
> appreciate your help
>
> Ed Merks wrote:
>
>
> > --------------0969DB8C731F55222437D473
> > Content-Type: text/plain; charset=us-ascii
> > Content-Transfer-Encoding: 7bit
>
> > Kaunteya,
>
> > No, you can\'t add a complex type definition to a group. A complex type
> definition
> > can only be contained by a schema or by an element. So if you want a
> complex type
> > definition to be \"contained\" by a model group you have to create an
> XSDParticle,
> > that contains (i.e., setContent()) an XSDElementDeclaration that either
> contains a
> > complex type (i.e., setAnonymousTypeDefinitition), or refers to a
complex
> type
> > (i.e., setTypeDefinition); the particle can be added to any model group
> (i.e.,
> > getContents().add()) and the particle can have its maxOccurs set (e.g.,
> > setMaxOccurs(-1)).
>
> > For example:
>
> > <?xml version=\"1.0\" encoding=\"UTF-8\"?>
> > <xsd:schema xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\">
> > <xsd:complexType name=\"x\">
> > <xsd:sequence>
> > <xsd:element minOccurs=\"0\" maxOccurs=\"unbounded\"
name=\"y\">
> > <xsd:complexType> <!-- can\'t have a
> name=\"Bank_Operation_Code\"
> > -->
> > <xsd:sequence>
> > <xsd:element minOccurs=\"0\" maxOccurs=\"unbounded\"
> > fixed=\"3!a15d\" name=\"Constraint\" type=\"xsd:string\"/>
> > <xsd:element minOccurs=\"1\" maxOccurs=\"1\"
name=\"_26T\"
> > type=\"xsd:string\"/>
> > </xsd:sequence>
> > </xsd:complexType>
> > </xsd:element>
> > <xsd:element minOccurs=\"0\" maxOccurs=\"unbounded\"
name=\"z\"
> > type=\"x\"/>
> > </xsd:sequence>
> > </xsd:complexType>
> > </xsd:schema>
>
>
>
> > kaunteya bhattacharya wrote:
>
> > > Hello Ed,
> > >
> > > Yes, I am sorry I missed out on the <sequence> element. But I realized
> > > that I cant do the following things with the complexTypeDefinition.
> > >
> > > 1. I cant seem to add it in a group. Basically clump a number of
complex
> > > types in a ModelGroupDefinition. Because XSDParticle content does not
take
> > > in XSDComplexType objects.
> > >
> > > 2. I cant seem to define the cardinality of these complex types..
> > > Essentially what if there are more than one occurence of complex types
> > > within the XML instance document. I know you can do that with maxOccur
and
> > > minOccur on XSDParticleContent or elements but not with complexType.
But
> > > ElementDeclaration cannot seem to have children.
> > >
> > > What is the best design.
> > >
> > > thanks for your help
> > > kauntea
> > >
> > >
> > > Ed Merks wrote:
> > >
> > > > --------------EE197CEE0215E8A9C42A12C8
> > > > Content-Type: text/plain; charset=us-ascii
> > > > Content-Transfer-Encoding: 7bit
> > >
> > > > Kaunteya,
> > >
> > > > Are you trying to write something like this?
> > >
> > > > <?xml version=\"1.0\" encoding=\"UTF-8\"?>
> > > > <xsd:schema xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\">
> > > > <xsd:complexType name=\"Bank_Operation_Code\">
> > > > <xsd:sequence>
> > > > <xsd:element maxOccurs=\"unbounded\" fixed=\"3!a15d\"
> > > > name=\"Constraint\" type=\"xsd:string\"/>
> > > > <xsd:element maxOccurs=\"unbounded\" name=\"_26T\"
> > > > type=\"xsd:string\"/>
> > > > </xsd:sequence>
> > > > </xsd:complexType>
> > > > </xsd:schema>
> > >
> > > > kaunteya bhattacharya wrote:
> > >
> > > > > Hello,
> > > > > I am curious as to learn how would I go about defining repititive
> elements
> > > > > in the schema. I have defined a number of XSDComplexTypeDefinition
> > > > > elements. But I cant seem to define their multiple occurences in
the
> > > > > schema. For e.g.
> > > > >
> > > > > <xsd:complexType name=\"Bank_Operation_Code\">
> > > > > <xsd:element fixed=\"3!a15d\" name=\"Constraint\"
> type=\"xsd:string\"/>
> > > > > <xsd:element name=\"_26T\" type=\"xsd:string\"/>
> > > > > </xsd:complexType>
> > > > >
> > > > > This element occurs multiple times in my XML document. How do I
define
> > > > > that?
> > > > > This is quite urgent to me. Any help would be much appreciated.
> > > > >
> > > > > thanks
> > > > >
> > > > > kaunteya
> > >
> > > > --------------EE197CEE0215E8A9C42A12C8
> > > > Content-Type: text/html; charset=us-ascii
> > > > Content-Transfer-Encoding: 7bit
> > >
> > > > <!doctype html public \"-//w3c//dtd html 4.0 transitional//en\">
> > > > <html>
> > > > Kaunteya,
> > > > <p>Are you trying to write something like this?
> > > > <blockquote><?xml version=\"1.0\" encoding=\"UTF-8\"?>
> > > > <br><xsd:schema xmlns:xsd=\"<A
> > >
>
HREF=\"http://www.w3.org/2001/XMLSchema\">http://www.w3.org/2001/XMLSchema</
A>\">
> > > > <br> <xsd:complexType name=\"Bank_Operation_Code\">
> > > > <br> <xsd:sequence>
> > > > <br> <xsd:element <b>maxOccurs=\"unbounded\"</b>
> > > > fixed=\"3!a15d\" name=\"Constraint\" type=\"xsd:string\"/>
> > > > <br> <xsd:element <b>maxOccurs=\"unbounded\"</b>
> > > > name=\"_26T\" type=\"xsd:string\"/>
> > > > <br> </xsd:sequence>
> > > > <br> </xsd:complexType>
> > > > <br></xsd:schema></blockquote>
> > > > kaunteya bhattacharya wrote:
> > > > <blockquote TYPE=CITE>Hello,
> > > > <br>I am curious as to learn how would I go about defining
repititive
> > > elements
> > > > <br>in the schema. I have defined a number of
XSDComplexTypeDefinition
> > > > <br>elements. But I cant seem to define their multiple occurences in
the
> > > > <br>schema. For e.g.
> > > > <p><xsd:complexType name=\"Bank_Operation_Code\">
> > > > <br> <xsd:element fixed=\"3!a15d\" name=\"Constraint\"
> type=\"xsd:string\"/>
> > > > <br> <xsd:element name=\"_26T\" type=\"xsd:string\"/>
> > > > <br></xsd:complexType>
> > > > <p>This element occurs multiple times in my XML document. How do I
define
> > > > <br>that?
> > > > <br>This is quite urgent to me. Any help would be much appreciated.
> > > > <p>thanks
> > > > <p>kaunteya</blockquote>
> > > > </html>
> > >
> > > > --------------EE197CEE0215E8A9C42A12C8--
>
> > --------------0969DB8C731F55222437D473
> > Content-Type: text/html; charset=us-ascii
> > Content-Transfer-Encoding: 7bit
>
> > <!doctype html public \"-//w3c//dtd html 4.0 transitional//en\">
> > <html>
> > Kaunteya,
> > <p>No, you can\'t add a complex type definition to a group. A complex
> > type definition can only be contained by a schema or by an element.
> > So if you want a complex type definition to be \"contained\" by a model
group
> > you have to create an XSDParticle, that contains (i.e., setContent()) an
> > XSDElementDeclaration that either contains a complex type (i.e.,
> setAnonymousTypeDefinitition),
> > or refers to a complex type (i.e., setTypeDefinition); the particle can
> > be added to any model group (i.e., getContents().add()) and the particle
> > can have its maxOccurs set (e.g., setMaxOccurs(-1)).
> > <p>For example:
> > <blockquote><?xml version=\"1.0\" encoding=\"UTF-8\"?>
> > <br><xsd:schema xmlns:xsd=\"<A
>
HREF=\"http://www.w3.org/2001/XMLSchema\">http://www.w3.org/2001/XMLSchema</
A>\">
> > <br> <xsd:complexType name=\"x\">
> > <br> <xsd:sequence>
> > <br> <xsd:element minOccurs=\"0\" maxOccurs=\"unbounded\"
> > name=\"y\">
> > <br> <xsd:complexType> <!--
> > can\'t have a name=\"Bank_Operation_Code\" -->
> > <br> <xsd:sequence>
> > <br>
> > <xsd:element minOccurs=\"0\" maxOccurs=\"unbounded\" fixed=\"3!a15d\"
> name=\"Constraint\"
> > type=\"xsd:string\"/>
> > <br>
> > <xsd:element minOccurs=\"1\" maxOccurs=\"1\" name=\"_26T\"
> type=\"xsd:string\"/>
> > <br> </xsd:sequence>
> > <br> </xsd:complexType>
> > <br> </xsd:element>
> > <br> <xsd:element minOccurs=\"0\" maxOccurs=\"unbounded\"
> > name=\"z\" type=\"x\"/>
> > <br> </xsd:sequence>
> > <br> </xsd:complexType>
> > <br></xsd:schema></blockquote>
>
> > <br>
> > <p>kaunteya bhattacharya wrote:
> > <blockquote TYPE=CITE>Hello Ed,
> > <p>Yes, I am sorry I missed out on the <sequence> element. But I
realized
> > <br>that I cant do the following things with the complexTypeDefinition.
> > <p>1. I cant seem to add it in a group. Basically clump a number of
complex
> > <br>types in a ModelGroupDefinition. Because XSDParticle content does
not
> > take
> > <br>in XSDComplexType objects.
> > <p>2. I cant seem to define the cardinality of these complex types..
> > <br>Essentially what if there are more than one occurence of complex
types
> > <br>within the XML instance document. I know you can do that with
maxOccur
> > and
> > <br>minOccur on XSDParticleContent or elements but not with complexType.
> > But
> > <br>ElementDeclaration cannot seem to have children.
> > <p>What is the best design.
> > <p>thanks for your help
> > <br>kauntea
> > <br>
> > <p>Ed Merks wrote:
> > <p>> --------------EE197CEE0215E8A9C42A12C8
> > <br>> Content-Type: text/plain; charset=us-ascii
> > <br>> Content-Transfer-Encoding: 7bit
> > <p>> Kaunteya,
> > <p>> Are you trying to write something like this?
> > <p>> <?xml version=\"1.0\" encoding=\"UTF-8\"?>
> > <br>> <xsd:schema xmlns:xsd=\"<a
>
href=\"http://www.w3.org/2001/XMLSchema\">http://www.w3.org/2001/XMLSchema</
a>\">
> > <br>> <xsd:complexType name=\"Bank_Operation_Code\">
> > <br>> <xsd:sequence>
> > <br>>
> > <xsd:element maxOccurs=\"unbounded\" fixed=\"3!a15d\"
> > <br>> name=\"Constraint\" type=\"xsd:string\"/>
> > <br>>
> > <xsd:element maxOccurs=\"unbounded\" name=\"_26T\"
> > <br>> type=\"xsd:string\"/>
> > <br>> </xsd:sequence>
> > <br>> </xsd:complexType>
> > <br>> </xsd:schema>
> > <p>> kaunteya bhattacharya wrote:
> > <p>> > Hello,
> > <br>> > I am curious as to learn how would I go about defining
repititive
> > elements
> > <br>> > in the schema. I have defined a number of
XSDComplexTypeDefinition
> > <br>> > elements. But I cant seem to define their multiple occurences in
> > the
> > <br>> > schema. For e.g.
> > <br>> >
> > <br>> > <xsd:complexType name=\"Bank_Operation_Code\">
> > <br>> > <xsd:element fixed=\"3!a15d\" name=\"Constraint\"
> type=\"xsd:string\"/>
> > <br>> > <xsd:element name=\"_26T\" type=\"xsd:string\"/>
> > <br>> > </xsd:complexType>
> > <br>> >
> > <br>> > This element occurs multiple times in my XML document. How do I
> > define
> > <br>> > that?
> > <br>> > This is quite urgent to me. Any help would be much appreciated.
> > <br>> >
> > <br>> > thanks
> > <br>> >
> > <br>> > kaunteya
> > <p>> --------------EE197CEE0215E8A9C42A12C8
> > <br>> Content-Type: text/html; charset=us-ascii
> > <br>> Content-Transfer-Encoding: 7bit
> > <p>> <!doctype html public \"-//w3c//dtd html 4.0 transitional//en\">
> > <br>> <html>
> > <br>> Kaunteya,
> > <br>> <p>Are you trying to write something like this?
> > <br>> <blockquote><?xml version=\"1.0\" encoding=\"UTF-8\"?>
> > <br>> <br><xsd:schema xmlns:xsd=\"<A
> > <br>HREF=\"<a
>
href=\"http://www.w3.org/2001/XMLSchema\">http://www.w3.org/2001/XMLSchema</
a>\"><a
>
href=\"http://www.w3.org/2001/XMLSchema\">http://www.w3.org/2001/XMLSchema</
a></A>\">
> > <br>> <br> <xsd:complexType name=\"Bank_Operation_Code\">
> > <br>> <br> <xsd:sequence>
> > <br>> <br> <xsd:element <b>maxOccurs=\"unbounded\"</b>
> > <br>> fixed=\"3!a15d\" name=\"Constraint\" type=\"xsd:string\"/>
> > <br>> <br> <xsd:element <b>maxOccurs=\"unbounded\"</b>
> > <br>> name=\"_26T\" type=\"xsd:string\"/>
> > <br>> <br> </xsd:sequence>
> > <br>> <br> </xsd:complexType>
> > <br>> <br></xsd:schema></blockquote>
> > <br>> kaunteya bhattacharya wrote:
> > <br>> <blockquote TYPE=CITE>Hello,
> > <br>> <br>I am curious as to learn how would I go about defining
repititive
> > <br>elements
> > <br>> <br>in the schema. I have defined a number of
XSDComplexTypeDefinition
> > <br>> <br>elements. But I cant seem to define their multiple occurences
> > in the
> > <br>> <br>schema. For e.g.
> > <br>> <p><xsd:complexType name=\"Bank_Operation_Code\">
> > <br>> <br> <xsd:element fixed=\"3!a15d\" name=\"Constraint\"
> type=\"xsd:string\"/>
> > <br>> <br> <xsd:element name=\"_26T\" type=\"xsd:string\"/>
> > <br>> <br></xsd:complexType>
> > <br>> <p>This element occurs multiple times in my XML document. How
> > do I define
> > <br>> <br>that?
> > <br>> <br>This is quite urgent to me. Any help would be much
appreciated.
> > <br>> <p>thanks
> > <br>> <p>kaunteya</blockquote>
> > <br>> </html>
> > <p>> --------------EE197CEE0215E8A9C42A12C8--</blockquote>
> > </html>
>
> > --------------0969DB8C731F55222437D473--
>
>
>
>
Re: Repititive elements in Schema: Help! [message #566692 is a reply to message #15392] Fri, 28 March 2003 10:27 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 33140
Registered: July 2009
Senior Member
--------------EE197CEE0215E8A9C42A12C8
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

Kaunteya,

Are you trying to write something like this?

<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<xsd:complexType name="Bank_Operation_Code">
<xsd:sequence>
<xsd:element maxOccurs="unbounded" fixed="3!a15d"
name="Constraint" type="xsd:string"/>
<xsd:element maxOccurs="unbounded" name="_26T"
type="xsd:string"/>
</xsd:sequence>
</xsd:complexType>
</xsd:schema>

kaunteya bhattacharya wrote:

> Hello,
> I am curious as to learn how would I go about defining repititive elements
> in the schema. I have defined a number of XSDComplexTypeDefinition
> elements. But I cant seem to define their multiple occurences in the
> schema. For e.g.
>
> <xsd:complexType name="Bank_Operation_Code">
> <xsd:element fixed="3!a15d" name="Constraint" type="xsd:string"/>
> <xsd:element name="_26T" type="xsd:string"/>
> </xsd:complexType>
>
> This element occurs multiple times in my XML document. How do I define
> that?
> This is quite urgent to me. Any help would be much appreciated.
>
> thanks
>
> kaunteya

--------------EE197CEE0215E8A9C42A12C8
Content-Type: text/html; charset=us-ascii
Content-Transfer-Encoding: 7bit

<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
<html>
Kaunteya,
<p>Are you trying to write something like this?
<blockquote>&lt;?xml version="1.0" encoding="UTF-8"?>
<br>&lt;xsd:schema xmlns:xsd="<A HREF="http://www.w3.org/2001/XMLSchema">http://www.w3.org/2001/XMLSchema</A>">
<br>&nbsp; &lt;xsd:complexType name="Bank_Operation_Code">
<br>&nbsp;&nbsp;&nbsp; &lt;xsd:sequence>
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;xsd:element <b>maxOccurs="unbounded"</b>
fixed="3!a15d" name="Constraint" type="xsd:string"/>
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;xsd:element <b>maxOccurs="unbounded"</b>
name="_26T" type="xsd:string"/>
<br>&nbsp;&nbsp;&nbsp; &lt;/xsd:sequence>
<br>&nbsp; &lt;/xsd:complexType>
<br>&lt;/xsd:schema></blockquote>
kaunteya bhattacharya wrote:
<blockquote TYPE=CITE>Hello,
<br>I am curious as to learn how would I go about defining repititive elements
<br>in the schema. I have defined a number of XSDComplexTypeDefinition
<br>elements. But I cant seem to define their multiple occurences in the
<br>schema. For e.g.
<p>&lt;xsd:complexType name="Bank_Operation_Code">
<br>&nbsp; &lt;xsd:element fixed="3!a15d" name="Constraint" type="xsd:string"/>
<br>&nbsp; &lt;xsd:element name="_26T" type="xsd:string"/>
<br>&lt;/xsd:complexType>
<p>This element occurs multiple times in my XML document. How do I define
<br>that?
<br>This is quite urgent to me. Any help would be much appreciated.
<p>thanks
<p>kaunteya</blockquote>
</html>

--------------EE197CEE0215E8A9C42A12C8--


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: Repititive elements in Schema: Help! [message #566729 is a reply to message #15428] Fri, 28 March 2003 12:33 Go to previous message
kaunteya bhattacharya is currently offline kaunteya bhattacharyaFriend
Messages: 24
Registered: July 2009
Junior Member
Hello Ed,

Yes, I am sorry I missed out on the <sequence> element. But I realized
that I cant do the following things with the complexTypeDefinition.

1. I cant seem to add it in a group. Basically clump a number of complex
types in a ModelGroupDefinition. Because XSDParticle content does not take
in XSDComplexType objects.

2. I cant seem to define the cardinality of these complex types..
Essentially what if there are more than one occurence of complex types
within the XML instance document. I know you can do that with maxOccur and
minOccur on XSDParticleContent or elements but not with complexType. But
ElementDeclaration cannot seem to have children.

What is the best design.

thanks for your help
kauntea


Ed Merks wrote:


> --------------EE197CEE0215E8A9C42A12C8
> Content-Type: text/plain; charset=us-ascii
> Content-Transfer-Encoding: 7bit

> Kaunteya,

> Are you trying to write something like this?

> <?xml version="1.0" encoding="UTF-8"?>
> <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
> <xsd:complexType name="Bank_Operation_Code">
> <xsd:sequence>
> <xsd:element maxOccurs="unbounded" fixed="3!a15d"
> name="Constraint" type="xsd:string"/>
> <xsd:element maxOccurs="unbounded" name="_26T"
> type="xsd:string"/>
> </xsd:sequence>
> </xsd:complexType>
> </xsd:schema>

> kaunteya bhattacharya wrote:

> > Hello,
> > I am curious as to learn how would I go about defining repititive elements
> > in the schema. I have defined a number of XSDComplexTypeDefinition
> > elements. But I cant seem to define their multiple occurences in the
> > schema. For e.g.
> >
> > <xsd:complexType name="Bank_Operation_Code">
> > <xsd:element fixed="3!a15d" name="Constraint" type="xsd:string"/>
> > <xsd:element name="_26T" type="xsd:string"/>
> > </xsd:complexType>
> >
> > This element occurs multiple times in my XML document. How do I define
> > that?
> > This is quite urgent to me. Any help would be much appreciated.
> >
> > thanks
> >
> > kaunteya

> --------------EE197CEE0215E8A9C42A12C8
> Content-Type: text/html; charset=us-ascii
> Content-Transfer-Encoding: 7bit

> <!doctype html public "-//w3c//dtd html 4.0 transitional//en">
> <html>
> Kaunteya,
> <p>Are you trying to write something like this?
> <blockquote><?xml version="1.0" encoding="UTF-8"?>
> <br><xsd:schema xmlns:xsd="<A
HREF="http://www.w3.org/2001/XMLSchema">http://www.w3.org/2001/XMLSchema</A>">
> <br>  <xsd:complexType name="Bank_Operation_Code">
> <br>    <xsd:sequence>
> <br>      <xsd:element <b>maxOccurs="unbounded"</b>
> fixed="3!a15d" name="Constraint" type="xsd:string"/>
> <br>      <xsd:element <b>maxOccurs="unbounded"</b>
> name="_26T" type="xsd:string"/>
> <br>    </xsd:sequence>
> <br>  </xsd:complexType>
> <br></xsd:schema></blockquote>
> kaunteya bhattacharya wrote:
> <blockquote TYPE=CITE>Hello,
> <br>I am curious as to learn how would I go about defining repititive
elements
> <br>in the schema. I have defined a number of XSDComplexTypeDefinition
> <br>elements. But I cant seem to define their multiple occurences in the
> <br>schema. For e.g.
> <p><xsd:complexType name="Bank_Operation_Code">
> <br>  <xsd:element fixed="3!a15d" name="Constraint" type="xsd:string"/>
> <br>  <xsd:element name="_26T" type="xsd:string"/>
> <br></xsd:complexType>
> <p>This element occurs multiple times in my XML document. How do I define
> <br>that?
> <br>This is quite urgent to me. Any help would be much appreciated.
> <p>thanks
> <p>kaunteya</blockquote>
> </html>

> --------------EE197CEE0215E8A9C42A12C8--
Re: Repititive elements in Schema: Help! [message #566739 is a reply to message #15461] Fri, 28 March 2003 12:40 Go to previous message
kaunteya bhattacharya is currently offline kaunteya bhattacharyaFriend
Messages: 24
Registered: July 2009
Junior Member
kaunteya bhattacharya wrote:

I forgot to mention the schema has other elements and declarations apart
from the specified complex type. So its more like

<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">

........
<xsd:complexType name="Swift_Operation_Code">
<xsd:sequence>
<xsd:element maxOccurs="unbounded" fixed="3!b234"
name="Constraint" type="xsd:string"/>
<xsd:element maxOccurs="unbounded" name="_28T"
type="xsd:string"/>
</xsd:sequence>
</xsd:complexType>


<xsd:complexType name="Bank_Operation_Code">
<xsd:sequence>
<xsd:element maxOccurs="unbounded" fixed="3!a15d"
name="Constraint" type="xsd:string"/>
<xsd:element maxOccurs="unbounded" name="_26T"
type="xsd:string"/>
</xsd:sequence>
</xsd:complexType>

.........

</xsd:schema>

would like to to clump the two complex types in one group.
thanks
kaunteya


> Hello Ed,

> Yes, I am sorry I missed out on the <sequence> element. But I realized
> that I cant do the following things with the complexTypeDefinition.

> 1. I cant seem to add it in a group. Basically clump a number of complex
> types in a ModelGroupDefinition. Because XSDParticle content does not take
> in XSDComplexType objects.

> 2. I cant seem to define the cardinality of these complex types..
> Essentially what if there are more than one occurence of complex types
> within the XML instance document. I know you can do that with maxOccur and
> minOccur on XSDParticleContent or elements but not with complexType. But
> ElementDeclaration cannot seem to have children.

> What is the best design.

> thanks for your help
> kauntea


> Ed Merks wrote:


> > --------------EE197CEE0215E8A9C42A12C8
> > Content-Type: text/plain; charset=us-ascii
> > Content-Transfer-Encoding: 7bit

> > Kaunteya,

> > Are you trying to write something like this?

> > <?xml version="1.0" encoding="UTF-8"?>
> > <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
> > <xsd:complexType name="Bank_Operation_Code">
> > <xsd:sequence>
> > <xsd:element maxOccurs="unbounded" fixed="3!a15d"
> > name="Constraint" type="xsd:string"/>
> > <xsd:element maxOccurs="unbounded" name="_26T"
> > type="xsd:string"/>
> > </xsd:sequence>
> > </xsd:complexType>
> > </xsd:schema>

> > kaunteya bhattacharya wrote:

> > > Hello,
> > > I am curious as to learn how would I go about defining repititive
elements
> > > in the schema. I have defined a number of XSDComplexTypeDefinition
> > > elements. But I cant seem to define their multiple occurences in the
> > > schema. For e.g.
> > >
> > > <xsd:complexType name="Bank_Operation_Code">
> > > <xsd:element fixed="3!a15d" name="Constraint" type="xsd:string"/>
> > > <xsd:element name="_26T" type="xsd:string"/>
> > > </xsd:complexType>
> > >
> > > This element occurs multiple times in my XML document. How do I define
> > > that?
> > > This is quite urgent to me. Any help would be much appreciated.
> > >
> > > thanks
> > >
> > > kaunteya

> > --------------EE197CEE0215E8A9C42A12C8
> > Content-Type: text/html; charset=us-ascii
> > Content-Transfer-Encoding: 7bit

> > <!doctype html public "-//w3c//dtd html 4.0 transitional//en">
> > <html>
> > Kaunteya,
> > <p>Are you trying to write something like this?
> > <blockquote><?xml version="1.0" encoding="UTF-8"?>
> > <br><xsd:schema xmlns:xsd="<A
>
HREF="http://www.w3.org/2001/XMLSchema">http://www.w3.org/2001/XMLSchema</A>">
> > <br>  <xsd:complexType name="Bank_Operation_Code">
> > <br>    <xsd:sequence>
> > <br>      <xsd:element <b>maxOccurs="unbounded"</b>
> > fixed="3!a15d" name="Constraint" type="xsd:string"/>
> > <br>      <xsd:element <b>maxOccurs="unbounded"</b>
> > name="_26T" type="xsd:string"/>
> > <br>    </xsd:sequence>
> > <br>  </xsd:complexType>
> > <br></xsd:schema></blockquote>
> > kaunteya bhattacharya wrote:
> > <blockquote TYPE=CITE>Hello,
> > <br>I am curious as to learn how would I go about defining repititive
> elements
> > <br>in the schema. I have defined a number of XSDComplexTypeDefinition
> > <br>elements. But I cant seem to define their multiple occurences in the
> > <br>schema. For e.g.
> > <p><xsd:complexType name="Bank_Operation_Code">
> > <br>  <xsd:element fixed="3!a15d" name="Constraint" type="xsd:string"/>
> > <br>  <xsd:element name="_26T" type="xsd:string"/>
> > <br></xsd:complexType>
> > <p>This element occurs multiple times in my XML document. How do I define
> > <br>that?
> > <br>This is quite urgent to me. Any help would be much appreciated.
> > <p>thanks
> > <p>kaunteya</blockquote>
> > </html>

> > --------------EE197CEE0215E8A9C42A12C8--
Re: Repititive elements in Schema: Help! [message #566775 is a reply to message #15461] Fri, 28 March 2003 13:45 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 33140
Registered: July 2009
Senior Member
--------------0969DB8C731F55222437D473
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

Kaunteya,

No, you can't add a complex type definition to a group. A complex type definition
can only be contained by a schema or by an element. So if you want a complex type
definition to be "contained" by a model group you have to create an XSDParticle,
that contains (i.e., setContent()) an XSDElementDeclaration that either contains a
complex type (i.e., setAnonymousTypeDefinitition), or refers to a complex type
(i.e., setTypeDefinition); the particle can be added to any model group (i.e.,
getContents().add()) and the particle can have its maxOccurs set (e.g.,
setMaxOccurs(-1)).

For example:

<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<xsd:complexType name="x">
<xsd:sequence>
<xsd:element minOccurs="0" maxOccurs="unbounded" name="y">
<xsd:complexType> <!-- can't have a name="Bank_Operation_Code"
-->
<xsd:sequence>
<xsd:element minOccurs="0" maxOccurs="unbounded"
fixed="3!a15d" name="Constraint" type="xsd:string"/>
<xsd:element minOccurs="1" maxOccurs="1" name="_26T"
type="xsd:string"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element minOccurs="0" maxOccurs="unbounded" name="z"
type="x"/>
</xsd:sequence>
</xsd:complexType>
</xsd:schema>



kaunteya bhattacharya wrote:

> Hello Ed,
>
> Yes, I am sorry I missed out on the <sequence> element. But I realized
> that I cant do the following things with the complexTypeDefinition.
>
> 1. I cant seem to add it in a group. Basically clump a number of complex
> types in a ModelGroupDefinition. Because XSDParticle content does not take
> in XSDComplexType objects.
>
> 2. I cant seem to define the cardinality of these complex types..
> Essentially what if there are more than one occurence of complex types
> within the XML instance document. I know you can do that with maxOccur and
> minOccur on XSDParticleContent or elements but not with complexType. But
> ElementDeclaration cannot seem to have children.
>
> What is the best design.
>
> thanks for your help
> kauntea
>
>
> Ed Merks wrote:
>
> > --------------EE197CEE0215E8A9C42A12C8
> > Content-Type: text/plain; charset=us-ascii
> > Content-Transfer-Encoding: 7bit
>
> > Kaunteya,
>
> > Are you trying to write something like this?
>
> > <?xml version="1.0" encoding="UTF-8"?>
> > <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
> > <xsd:complexType name="Bank_Operation_Code">
> > <xsd:sequence>
> > <xsd:element maxOccurs="unbounded" fixed="3!a15d"
> > name="Constraint" type="xsd:string"/>
> > <xsd:element maxOccurs="unbounded" name="_26T"
> > type="xsd:string"/>
> > </xsd:sequence>
> > </xsd:complexType>
> > </xsd:schema>
>
> > kaunteya bhattacharya wrote:
>
> > > Hello,
> > > I am curious as to learn how would I go about defining repititive elements
> > > in the schema. I have defined a number of XSDComplexTypeDefinition
> > > elements. But I cant seem to define their multiple occurences in the
> > > schema. For e.g.
> > >
> > > <xsd:complexType name="Bank_Operation_Code">
> > > <xsd:element fixed="3!a15d" name="Constraint" type="xsd:string"/>
> > > <xsd:element name="_26T" type="xsd:string"/>
> > > </xsd:complexType>
> > >
> > > This element occurs multiple times in my XML document. How do I define
> > > that?
> > > This is quite urgent to me. Any help would be much appreciated.
> > >
> > > thanks
> > >
> > > kaunteya
>
> > --------------EE197CEE0215E8A9C42A12C8
> > Content-Type: text/html; charset=us-ascii
> > Content-Transfer-Encoding: 7bit
>
> > <!doctype html public "-//w3c//dtd html 4.0 transitional//en">
> > <html>
> > Kaunteya,
> > <p>Are you trying to write something like this?
> > <blockquote><?xml version="1.0" encoding="UTF-8"?>
> > <br><xsd:schema xmlns:xsd="<A
> HREF="http://www.w3.org/2001/XMLSchema">http://www.w3.org/2001/XMLSchema</A>">
> > <br> <xsd:complexType name="Bank_Operation_Code">
> > <br> <xsd:sequence>
> > <br> <xsd:element <b>maxOccurs="unbounded"</b>
> > fixed="3!a15d" name="Constraint" type="xsd:string"/>
> > <br> <xsd:element <b>maxOccurs="unbounded"</b>
> > name="_26T" type="xsd:string"/>
> > <br> </xsd:sequence>
> > <br> </xsd:complexType>
> > <br></xsd:schema></blockquote>
> > kaunteya bhattacharya wrote:
> > <blockquote TYPE=CITE>Hello,
> > <br>I am curious as to learn how would I go about defining repititive
> elements
> > <br>in the schema. I have defined a number of XSDComplexTypeDefinition
> > <br>elements. But I cant seem to define their multiple occurences in the
> > <br>schema. For e.g.
> > <p><xsd:complexType name="Bank_Operation_Code">
> > <br> <xsd:element fixed="3!a15d" name="Constraint" type="xsd:string"/>
> > <br> <xsd:element name="_26T" type="xsd:string"/>
> > <br></xsd:complexType>
> > <p>This element occurs multiple times in my XML document. How do I define
> > <br>that?
> > <br>This is quite urgent to me. Any help would be much appreciated.
> > <p>thanks
> > <p>kaunteya</blockquote>
> > </html>
>
> > --------------EE197CEE0215E8A9C42A12C8--

--------------0969DB8C731F55222437D473
Content-Type: text/html; charset=us-ascii
Content-Transfer-Encoding: 7bit

<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
<html>
Kaunteya,
<p>No, you can't add a complex type definition to a group.&nbsp; A complex
type definition can only be contained by a schema or by an element.&nbsp;
So if you want a complex type definition to be "contained" by a model group
you have to create an XSDParticle, that contains (i.e., setContent()) an
XSDElementDeclaration that either contains a complex type (i.e., setAnonymousTypeDefinitition),
or refers to a complex type (i.e., setTypeDefinition); the particle can
be added to any model group (i.e., getContents().add()) and the particle
can have its maxOccurs set (e.g., setMaxOccurs(-1)).
<p>For example:
<blockquote>&lt;?xml version="1.0" encoding="UTF-8"?>
<br>&lt;xsd:schema xmlns:xsd="<A HREF="http://www.w3.org/2001/XMLSchema">http://www.w3.org/2001/XMLSchema</A>">
<br>&nbsp; &lt;xsd:complexType name="x">
<br>&nbsp;&nbsp;&nbsp; &lt;xsd:sequence>
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;xsd:element minOccurs="0" maxOccurs="unbounded"
name="y">
<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; &lt;xsd:complexType> &lt;!--
can't have a name="Bank_Operation_Code" -->
<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &lt;xsd:sequence>
<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&lt;xsd:element minOccurs="0" maxOccurs="unbounded" fixed="3!a15d" name="Constraint"
type="xsd:string"/>
<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&lt;xsd:element minOccurs="1" maxOccurs="1" name="_26T" type="xsd:string"/>
<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &lt;/xsd:sequence>
<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; &lt;/xsd:complexType>
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;/xsd:element>
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;xsd:element minOccurs="0" maxOccurs="unbounded"
name="z" type="x"/>
<br>&nbsp;&nbsp;&nbsp; &lt;/xsd:sequence>
<br>&nbsp; &lt;/xsd:complexType>
<br>&lt;/xsd:schema></blockquote>

<br>&nbsp;
<p>kaunteya bhattacharya wrote:
<blockquote TYPE=CITE>Hello Ed,
<p>Yes, I am sorry I missed out on the &lt;sequence> element. But I realized
<br>that I cant do the following things with the complexTypeDefinition.
<p>1. I cant seem to add it in a group. Basically clump a number of complex
<br>types in a ModelGroupDefinition. Because XSDParticle content does not
take
<br>in XSDComplexType objects.
<p>2. I cant seem to define the cardinality of these complex types..
<br>Essentially what if there are more than one occurence of complex types
<br>within the XML instance document. I know you can do that with maxOccur
and
<br>minOccur on XSDParticleContent or elements but not with complexType.
But
<br>ElementDeclaration cannot seem to have children.
<p>What is the best design.
<p>thanks for your help
<br>kauntea
<br>&nbsp;
<p>Ed Merks wrote:
<p>> --------------EE197CEE0215E8A9C42A12C8
<br>> Content-Type: text/plain; charset=us-ascii
<br>> Content-Transfer-Encoding: 7bit
<p>> Kaunteya,
<p>> Are you trying to write something like this?
<p>>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;?xml version="1.0" encoding="UTF-8"?>
<br>>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;xsd:schema xmlns:xsd="<a href="http://www.w3.org/2001/XMLSchema">http://www.w3.org/2001/XMLSchema</a>">
<br>> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; &lt;xsd:complexType name="Bank_Operation_Code">
<br>> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &lt;xsd:sequence>
<br>> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&lt;xsd:element maxOccurs="unbounded" fixed="3!a15d"
<br>>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; name="Constraint" type="xsd:string"/>
<br>> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&lt;xsd:element maxOccurs="unbounded" name="_26T"
<br>>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; type="xsd:string"/>
<br>> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &lt;/xsd:sequence>
<br>> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; &lt;/xsd:complexType>
<br>>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;/xsd:schema>
<p>> kaunteya bhattacharya wrote:
<p>> > Hello,
<br>> > I am curious as to learn how would I go about defining repititive
elements
<br>> > in the schema. I have defined a number of XSDComplexTypeDefinition
<br>> > elements. But I cant seem to define their multiple occurences in
the
<br>> > schema. For e.g.
<br>> >
<br>> > &lt;xsd:complexType name="Bank_Operation_Code">
<br>> >&nbsp;&nbsp; &lt;xsd:element fixed="3!a15d" name="Constraint" type="xsd:string"/>
<br>> >&nbsp;&nbsp; &lt;xsd:element name="_26T" type="xsd:string"/>
<br>> > &lt;/xsd:complexType>
<br>> >
<br>> > This element occurs multiple times in my XML document. How do I
define
<br>> > that?
<br>> > This is quite urgent to me. Any help would be much appreciated.
<br>> >
<br>> > thanks
<br>> >
<br>> > kaunteya
<p>> --------------EE197CEE0215E8A9C42A12C8
<br>> Content-Type: text/html; charset=us-ascii
<br>> Content-Transfer-Encoding: 7bit
<p>> &lt;!doctype html public "-//w3c//dtd html 4.0 transitional//en">
<br>> &lt;html>
<br>> Kaunteya,
<br>> &lt;p>Are you trying to write something like this?
<br>> &lt;blockquote>&lt;?xml version="1.0" encoding="UTF-8"?>
<br>> &lt;br>&lt;xsd:schema xmlns:xsd="&lt;A
<br>HREF="<a href="http://www.w3.org/2001/XMLSchema">http://www.w3.org/2001/XMLSchema</a>"><a href="http://www.w3.org/2001/XMLSchema">http://www.w3.org/2001/XMLSchema</a>&lt;/A>">
<br>> &lt;br>&nbsp; &lt;xsd:complexType name="Bank_Operation_Code">
<br>> &lt;br>&nbsp;&nbsp;&nbsp; &lt;xsd:sequence>
<br>> &lt;br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;xsd:element &lt;b>maxOccurs="unbounded"&lt;/b>
<br>> fixed="3!a15d" name="Constraint" type="xsd:string"/>
<br>> &lt;br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;xsd:element &lt;b>maxOccurs="unbounded"&lt;/b>
<br>> name="_26T" type="xsd:string"/>
<br>> &lt;br>&nbsp;&nbsp;&nbsp; &lt;/xsd:sequence>
<br>> &lt;br>&nbsp; &lt;/xsd:complexType>
<br>> &lt;br>&lt;/xsd:schema>&lt;/blockquote>
<br>> kaunteya bhattacharya wrote:
<br>> &lt;blockquote TYPE=CITE>Hello,
<br>> &lt;br>I am curious as to learn how would I go about defining repititive
<br>elements
<br>> &lt;br>in the schema. I have defined a number of XSDComplexTypeDefinition
<br>> &lt;br>elements. But I cant seem to define their multiple occurences
in the
<br>> &lt;br>schema. For e.g.
<br>> &lt;p>&lt;xsd:complexType name="Bank_Operation_Code">
<br>> &lt;br>&nbsp; &lt;xsd:element fixed="3!a15d" name="Constraint" type="xsd:string"/>
<br>> &lt;br>&nbsp; &lt;xsd:element name="_26T" type="xsd:string"/>
<br>> &lt;br>&lt;/xsd:complexType>
<br>> &lt;p>This element occurs multiple times in my XML document. How
do I define
<br>> &lt;br>that?
<br>> &lt;br>This is quite urgent to me. Any help would be much appreciated.
<br>> &lt;p>thanks
<br>> &lt;p>kaunteya&lt;/blockquote>
<br>> &lt;/html>
<p>> --------------EE197CEE0215E8A9C42A12C8--</blockquote>
</html>

--------------0969DB8C731F55222437D473--


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: Repititive elements in Schema: Help! [message #566796 is a reply to message #15526] Fri, 28 March 2003 15:37 Go to previous message
kaunteya bhattacharya is currently offline kaunteya bhattacharyaFriend
Messages: 24
Registered: July 2009
Junior Member
thanks,
appreciate your help

Ed Merks wrote:


> --------------0969DB8C731F55222437D473
> Content-Type: text/plain; charset=us-ascii
> Content-Transfer-Encoding: 7bit

> Kaunteya,

> No, you can\'t add a complex type definition to a group. A complex type
definition
> can only be contained by a schema or by an element. So if you want a
complex type
> definition to be \"contained\" by a model group you have to create an
XSDParticle,
> that contains (i.e., setContent()) an XSDElementDeclaration that either
contains a
> complex type (i.e., setAnonymousTypeDefinitition), or refers to a complex
type
> (i.e., setTypeDefinition); the particle can be added to any model group
(i.e.,
> getContents().add()) and the particle can have its maxOccurs set (e.g.,
> setMaxOccurs(-1)).

> For example:

> <?xml version=\"1.0\" encoding=\"UTF-8\"?>
> <xsd:schema xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\">
> <xsd:complexType name=\"x\">
> <xsd:sequence>
> <xsd:element minOccurs=\"0\" maxOccurs=\"unbounded\" name=\"y\">
> <xsd:complexType> <!-- can\'t have a
name=\"Bank_Operation_Code\"
> -->
> <xsd:sequence>
> <xsd:element minOccurs=\"0\" maxOccurs=\"unbounded\"
> fixed=\"3!a15d\" name=\"Constraint\" type=\"xsd:string\"/>
> <xsd:element minOccurs=\"1\" maxOccurs=\"1\" name=\"_26T\"
> type=\"xsd:string\"/>
> </xsd:sequence>
> </xsd:complexType>
> </xsd:element>
> <xsd:element minOccurs=\"0\" maxOccurs=\"unbounded\" name=\"z\"
> type=\"x\"/>
> </xsd:sequence>
> </xsd:complexType>
> </xsd:schema>



> kaunteya bhattacharya wrote:

> > Hello Ed,
> >
> > Yes, I am sorry I missed out on the <sequence> element. But I realized
> > that I cant do the following things with the complexTypeDefinition.
> >
> > 1. I cant seem to add it in a group. Basically clump a number of complex
> > types in a ModelGroupDefinition. Because XSDParticle content does not take
> > in XSDComplexType objects.
> >
> > 2. I cant seem to define the cardinality of these complex types..
> > Essentially what if there are more than one occurence of complex types
> > within the XML instance document. I know you can do that with maxOccur and
> > minOccur on XSDParticleContent or elements but not with complexType. But
> > ElementDeclaration cannot seem to have children.
> >
> > What is the best design.
> >
> > thanks for your help
> > kauntea
> >
> >
> > Ed Merks wrote:
> >
> > > --------------EE197CEE0215E8A9C42A12C8
> > > Content-Type: text/plain; charset=us-ascii
> > > Content-Transfer-Encoding: 7bit
> >
> > > Kaunteya,
> >
> > > Are you trying to write something like this?
> >
> > > <?xml version=\"1.0\" encoding=\"UTF-8\"?>
> > > <xsd:schema xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\">
> > > <xsd:complexType name=\"Bank_Operation_Code\">
> > > <xsd:sequence>
> > > <xsd:element maxOccurs=\"unbounded\" fixed=\"3!a15d\"
> > > name=\"Constraint\" type=\"xsd:string\"/>
> > > <xsd:element maxOccurs=\"unbounded\" name=\"_26T\"
> > > type=\"xsd:string\"/>
> > > </xsd:sequence>
> > > </xsd:complexType>
> > > </xsd:schema>
> >
> > > kaunteya bhattacharya wrote:
> >
> > > > Hello,
> > > > I am curious as to learn how would I go about defining repititive
elements
> > > > in the schema. I have defined a number of XSDComplexTypeDefinition
> > > > elements. But I cant seem to define their multiple occurences in the
> > > > schema. For e.g.
> > > >
> > > > <xsd:complexType name=\"Bank_Operation_Code\">
> > > > <xsd:element fixed=\"3!a15d\" name=\"Constraint\"
type=\"xsd:string\"/>
> > > > <xsd:element name=\"_26T\" type=\"xsd:string\"/>
> > > > </xsd:complexType>
> > > >
> > > > This element occurs multiple times in my XML document. How do I define
> > > > that?
> > > > This is quite urgent to me. Any help would be much appreciated.
> > > >
> > > > thanks
> > > >
> > > > kaunteya
> >
> > > --------------EE197CEE0215E8A9C42A12C8
> > > Content-Type: text/html; charset=us-ascii
> > > Content-Transfer-Encoding: 7bit
> >
> > > <!doctype html public \"-//w3c//dtd html 4.0 transitional//en\">
> > > <html>
> > > Kaunteya,
> > > <p>Are you trying to write something like this?
> > > <blockquote><?xml version=\"1.0\" encoding=\"UTF-8\"?>
> > > <br><xsd:schema xmlns:xsd=\"<A
> >
HREF=\"http://www.w3.org/2001/XMLSchema\">http://www.w3.org/2001/XMLSchema</A>\">
> > > <br> <xsd:complexType name=\"Bank_Operation_Code\">
> > > <br> <xsd:sequence>
> > > <br> <xsd:element <b>maxOccurs=\"unbounded\"</b>
> > > fixed=\"3!a15d\" name=\"Constraint\" type=\"xsd:string\"/>
> > > <br> <xsd:element <b>maxOccurs=\"unbounded\"</b>
> > > name=\"_26T\" type=\"xsd:string\"/>
> > > <br> </xsd:sequence>
> > > <br> </xsd:complexType>
> > > <br></xsd:schema></blockquote>
> > > kaunteya bhattacharya wrote:
> > > <blockquote TYPE=CITE>Hello,
> > > <br>I am curious as to learn how would I go about defining repititive
> > elements
> > > <br>in the schema. I have defined a number of XSDComplexTypeDefinition
> > > <br>elements. But I cant seem to define their multiple occurences in the
> > > <br>schema. For e.g.
> > > <p><xsd:complexType name=\"Bank_Operation_Code\">
> > > <br> <xsd:element fixed=\"3!a15d\" name=\"Constraint\"
type=\"xsd:string\"/>
> > > <br> <xsd:element name=\"_26T\" type=\"xsd:string\"/>
> > > <br></xsd:complexType>
> > > <p>This element occurs multiple times in my XML document. How do I define
> > > <br>that?
> > > <br>This is quite urgent to me. Any help would be much appreciated.
> > > <p>thanks
> > > <p>kaunteya</blockquote>
> > > </html>
> >
> > > --------------EE197CEE0215E8A9C42A12C8--

> --------------0969DB8C731F55222437D473
> Content-Type: text/html; charset=us-ascii
> Content-Transfer-Encoding: 7bit

> <!doctype html public \"-//w3c//dtd html 4.0 transitional//en\">
> <html>
> Kaunteya,
> <p>No, you can\'t add a complex type definition to a group.  A complex
> type definition can only be contained by a schema or by an element. 
> So if you want a complex type definition to be \"contained\" by a model group
> you have to create an XSDParticle, that contains (i.e., setContent()) an
> XSDElementDeclaration that either contains a complex type (i.e.,
setAnonymousTypeDefinitition),
> or refers to a complex type (i.e., setTypeDefinition); the particle can
> be added to any model group (i.e., getContents().add()) and the particle
> can have its maxOccurs set (e.g., setMaxOccurs(-1)).
> <p>For example:
> <blockquote><?xml version=\"1.0\" encoding=\"UTF-8\"?>
> <br><xsd:schema xmlns:xsd=\"<A
HREF=\"http://www.w3.org/2001/XMLSchema\">http://www.w3.org/2001/XMLSchema</A>\">
> <br>  <xsd:complexType name=\"x\">
> <br>    <xsd:sequence>
> <br>      <xsd:element minOccurs=\"0\" maxOccurs=\"unbounded\"
> name=\"y\">
> <br>        <xsd:complexType> <!--
> can\'t have a name=\"Bank_Operation_Code\" -->
> <br>          <xsd:sequence>
> <br>           
> <xsd:element minOccurs=\"0\" maxOccurs=\"unbounded\" fixed=\"3!a15d\"
name=\"Constraint\"
> type=\"xsd:string\"/>
> <br>           
> <xsd:element minOccurs=\"1\" maxOccurs=\"1\" name=\"_26T\"
type=\"xsd:string\"/>
> <br>          </xsd:sequence>
> <br>        </xsd:complexType>
> <br>      </xsd:element>
> <br>      <xsd:element minOccurs=\"0\" maxOccurs=\"unbounded\"
> name=\"z\" type=\"x\"/>
> <br>    </xsd:sequence>
> <br>  </xsd:complexType>
> <br></xsd:schema></blockquote>

> <br> 
> <p>kaunteya bhattacharya wrote:
> <blockquote TYPE=CITE>Hello Ed,
> <p>Yes, I am sorry I missed out on the <sequence> element. But I realized
> <br>that I cant do the following things with the complexTypeDefinition.
> <p>1. I cant seem to add it in a group. Basically clump a number of complex
> <br>types in a ModelGroupDefinition. Because XSDParticle content does not
> take
> <br>in XSDComplexType objects.
> <p>2. I cant seem to define the cardinality of these complex types..
> <br>Essentially what if there are more than one occurence of complex types
> <br>within the XML instance document. I know you can do that with maxOccur
> and
> <br>minOccur on XSDParticleContent or elements but not with complexType.
> But
> <br>ElementDeclaration cannot seem to have children.
> <p>What is the best design.
> <p>thanks for your help
> <br>kauntea
> <br> 
> <p>Ed Merks wrote:
> <p>> --------------EE197CEE0215E8A9C42A12C8
> <br>> Content-Type: text/plain; charset=us-ascii
> <br>> Content-Transfer-Encoding: 7bit
> <p>> Kaunteya,
> <p>> Are you trying to write something like this?
> <p>>      <?xml version=\"1.0\" encoding=\"UTF-8\"?>
> <br>>      <xsd:schema xmlns:xsd=\"<a
href=\"http://www.w3.org/2001/XMLSchema\">http://www.w3.org/2001/XMLSchema</a>\">
> <br>>        <xsd:complexType name=\"Bank_Operation_Code\">
> <br>>          <xsd:sequence>
> <br>>           
> <xsd:element maxOccurs=\"unbounded\" fixed=\"3!a15d\"
> <br>>      name=\"Constraint\" type=\"xsd:string\"/>
> <br>>           
> <xsd:element maxOccurs=\"unbounded\" name=\"_26T\"
> <br>>      type=\"xsd:string\"/>
> <br>>          </xsd:sequence>
> <br>>        </xsd:complexType>
> <br>>      </xsd:schema>
> <p>> kaunteya bhattacharya wrote:
> <p>> > Hello,
> <br>> > I am curious as to learn how would I go about defining repititive
> elements
> <br>> > in the schema. I have defined a number of XSDComplexTypeDefinition
> <br>> > elements. But I cant seem to define their multiple occurences in
> the
> <br>> > schema. For e.g.
> <br>> >
> <br>> > <xsd:complexType name=\"Bank_Operation_Code\">
> <br>> >   <xsd:element fixed=\"3!a15d\" name=\"Constraint\"
type=\"xsd:string\"/>
> <br>> >   <xsd:element name=\"_26T\" type=\"xsd:string\"/>
> <br>> > </xsd:complexType>
> <br>> >
> <br>> > This element occurs multiple times in my XML document. How do I
> define
> <br>> > that?
> <br>> > This is quite urgent to me. Any help would be much appreciated.
> <br>> >
> <br>> > thanks
> <br>> >
> <br>> > kaunteya
> <p>> --------------EE197CEE0215E8A9C42A12C8
> <br>> Content-Type: text/html; charset=us-ascii
> <br>> Content-Transfer-Encoding: 7bit
> <p>> <!doctype html public \"-//w3c//dtd html 4.0 transitional//en\">
> <br>> <html>
> <br>> Kaunteya,
> <br>> <p>Are you trying to write something like this?
> <br>> <blockquote><?xml version=\"1.0\" encoding=\"UTF-8\"?>
> <br>> <br><xsd:schema xmlns:xsd=\"<A
> <br>HREF=\"<a
href=\"http://www.w3.org/2001/XMLSchema\">http://www.w3.org/2001/XMLSchema</a>\"><a
href=\"http://www.w3.org/2001/XMLSchema\">http://www.w3.org/2001/XMLSchema</a></A>\">
> <br>> <br>  <xsd:complexType name=\"Bank_Operation_Code\">
> <br>> <br>    <xsd:sequence>
> <br>> <br>      <xsd:element <b>maxOccurs=\"unbounded\"</b>
> <br>> fixed=\"3!a15d\" name=\"Constraint\" type=\"xsd:string\"/>
> <br>> <br>      <xsd:element <b>maxOccurs=\"unbounded\"</b>
> <br>> name=\"_26T\" type=\"xsd:string\"/>
> <br>> <br>    </xsd:sequence>
> <br>> <br>  </xsd:complexType>
> <br>> <br></xsd:schema></blockquote>
> <br>> kaunteya bhattacharya wrote:
> <br>> <blockquote TYPE=CITE>Hello,
> <br>> <br>I am curious as to learn how would I go about defining repititive
> <br>elements
> <br>> <br>in the schema. I have defined a number of XSDComplexTypeDefinition
> <br>> <br>elements. But I cant seem to define their multiple occurences
> in the
> <br>> <br>schema. For e.g.
> <br>> <p><xsd:complexType name=\"Bank_Operation_Code\">
> <br>> <br>  <xsd:element fixed=\"3!a15d\" name=\"Constraint\"
type=\"xsd:string\"/>
> <br>> <br>  <xsd:element name=\"_26T\" type=\"xsd:string\"/>
> <br>> <br></xsd:complexType>
> <br>> <p>This element occurs multiple times in my XML document. How
> do I define
> <br>> <br>that?
> <br>> <br>This is quite urgent to me. Any help would be much appreciated.
> <br>> <p>thanks
> <br>> <p>kaunteya</blockquote>
> <br>> </html>
> <p>> --------------EE197CEE0215E8A9C42A12C8--</blockquote>
> </html>

> --------------0969DB8C731F55222437D473--
Re: Repititive elements in Schema: Help! [message #566821 is a reply to message #15558] Sun, 30 March 2003 21:05 Go to previous message
Dave Spriet is currently offline Dave SprietFriend
Messages: 14
Registered: July 2009
Junior Member
Hello,

Another great place to find out what objects can be added to what is to look
at the XML Schema Part 1: Structures Spec
http://www.w3.org/TR/xmlschema-1/

and the concrete containment diagram
http://dev.eclipse.org/viewcvs/indextech.cgi/~checkout~/xsd- home/docs/javado
c/org/eclipse/xsd/package-summary.html#details

Dave
email: spriet@ca.ibm.com

"kaunteya bhattacharya" <bhatta98@hotmail.com> wrote in message
news:b61q7f$s61$1@rogue.oti.com...
> thanks,
> appreciate your help
>
> Ed Merks wrote:
>
>
> > --------------0969DB8C731F55222437D473
> > Content-Type: text/plain; charset=us-ascii
> > Content-Transfer-Encoding: 7bit
>
> > Kaunteya,
>
> > No, you can\'t add a complex type definition to a group. A complex type
> definition
> > can only be contained by a schema or by an element. So if you want a
> complex type
> > definition to be \"contained\" by a model group you have to create an
> XSDParticle,
> > that contains (i.e., setContent()) an XSDElementDeclaration that either
> contains a
> > complex type (i.e., setAnonymousTypeDefinitition), or refers to a
complex
> type
> > (i.e., setTypeDefinition); the particle can be added to any model group
> (i.e.,
> > getContents().add()) and the particle can have its maxOccurs set (e.g.,
> > setMaxOccurs(-1)).
>
> > For example:
>
> > <?xml version=\"1.0\" encoding=\"UTF-8\"?>
> > <xsd:schema xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\">
> > <xsd:complexType name=\"x\">
> > <xsd:sequence>
> > <xsd:element minOccurs=\"0\" maxOccurs=\"unbounded\"
name=\"y\">
> > <xsd:complexType> <!-- can\'t have a
> name=\"Bank_Operation_Code\"
> > -->
> > <xsd:sequence>
> > <xsd:element minOccurs=\"0\" maxOccurs=\"unbounded\"
> > fixed=\"3!a15d\" name=\"Constraint\" type=\"xsd:string\"/>
> > <xsd:element minOccurs=\"1\" maxOccurs=\"1\"
name=\"_26T\"
> > type=\"xsd:string\"/>
> > </xsd:sequence>
> > </xsd:complexType>
> > </xsd:element>
> > <xsd:element minOccurs=\"0\" maxOccurs=\"unbounded\"
name=\"z\"
> > type=\"x\"/>
> > </xsd:sequence>
> > </xsd:complexType>
> > </xsd:schema>
>
>
>
> > kaunteya bhattacharya wrote:
>
> > > Hello Ed,
> > >
> > > Yes, I am sorry I missed out on the <sequence> element. But I realized
> > > that I cant do the following things with the complexTypeDefinition.
> > >
> > > 1. I cant seem to add it in a group. Basically clump a number of
complex
> > > types in a ModelGroupDefinition. Because XSDParticle content does not
take
> > > in XSDComplexType objects.
> > >
> > > 2. I cant seem to define the cardinality of these complex types..
> > > Essentially what if there are more than one occurence of complex types
> > > within the XML instance document. I know you can do that with maxOccur
and
> > > minOccur on XSDParticleContent or elements but not with complexType.
But
> > > ElementDeclaration cannot seem to have children.
> > >
> > > What is the best design.
> > >
> > > thanks for your help
> > > kauntea
> > >
> > >
> > > Ed Merks wrote:
> > >
> > > > --------------EE197CEE0215E8A9C42A12C8
> > > > Content-Type: text/plain; charset=us-ascii
> > > > Content-Transfer-Encoding: 7bit
> > >
> > > > Kaunteya,
> > >
> > > > Are you trying to write something like this?
> > >
> > > > <?xml version=\"1.0\" encoding=\"UTF-8\"?>
> > > > <xsd:schema xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\">
> > > > <xsd:complexType name=\"Bank_Operation_Code\">
> > > > <xsd:sequence>
> > > > <xsd:element maxOccurs=\"unbounded\" fixed=\"3!a15d\"
> > > > name=\"Constraint\" type=\"xsd:string\"/>
> > > > <xsd:element maxOccurs=\"unbounded\" name=\"_26T\"
> > > > type=\"xsd:string\"/>
> > > > </xsd:sequence>
> > > > </xsd:complexType>
> > > > </xsd:schema>
> > >
> > > > kaunteya bhattacharya wrote:
> > >
> > > > > Hello,
> > > > > I am curious as to learn how would I go about defining repititive
> elements
> > > > > in the schema. I have defined a number of XSDComplexTypeDefinition
> > > > > elements. But I cant seem to define their multiple occurences in
the
> > > > > schema. For e.g.
> > > > >
> > > > > <xsd:complexType name=\"Bank_Operation_Code\">
> > > > > <xsd:element fixed=\"3!a15d\" name=\"Constraint\"
> type=\"xsd:string\"/>
> > > > > <xsd:element name=\"_26T\" type=\"xsd:string\"/>
> > > > > </xsd:complexType>
> > > > >
> > > > > This element occurs multiple times in my XML document. How do I
define
> > > > > that?
> > > > > This is quite urgent to me. Any help would be much appreciated.
> > > > >
> > > > > thanks
> > > > >
> > > > > kaunteya
> > >
> > > > --------------EE197CEE0215E8A9C42A12C8
> > > > Content-Type: text/html; charset=us-ascii
> > > > Content-Transfer-Encoding: 7bit
> > >
> > > > <!doctype html public \"-//w3c//dtd html 4.0 transitional//en\">
> > > > <html>
> > > > Kaunteya,
> > > > <p>Are you trying to write something like this?
> > > > <blockquote><?xml version=\"1.0\" encoding=\"UTF-8\"?>
> > > > <br><xsd:schema xmlns:xsd=\"<A
> > >
>
HREF=\"http://www.w3.org/2001/XMLSchema\">http://www.w3.org/2001/XMLSchema</
A>\">
> > > > <br> <xsd:complexType name=\"Bank_Operation_Code\">
> > > > <br> <xsd:sequence>
> > > > <br> <xsd:element <b>maxOccurs=\"unbounded\"</b>
> > > > fixed=\"3!a15d\" name=\"Constraint\" type=\"xsd:string\"/>
> > > > <br> <xsd:element <b>maxOccurs=\"unbounded\"</b>
> > > > name=\"_26T\" type=\"xsd:string\"/>
> > > > <br> </xsd:sequence>
> > > > <br> </xsd:complexType>
> > > > <br></xsd:schema></blockquote>
> > > > kaunteya bhattacharya wrote:
> > > > <blockquote TYPE=CITE>Hello,
> > > > <br>I am curious as to learn how would I go about defining
repititive
> > > elements
> > > > <br>in the schema. I have defined a number of
XSDComplexTypeDefinition
> > > > <br>elements. But I cant seem to define their multiple occurences in
the
> > > > <br>schema. For e.g.
> > > > <p><xsd:complexType name=\"Bank_Operation_Code\">
> > > > <br> <xsd:element fixed=\"3!a15d\" name=\"Constraint\"
> type=\"xsd:string\"/>
> > > > <br> <xsd:element name=\"_26T\" type=\"xsd:string\"/>
> > > > <br></xsd:complexType>
> > > > <p>This element occurs multiple times in my XML document. How do I
define
> > > > <br>that?
> > > > <br>This is quite urgent to me. Any help would be much appreciated.
> > > > <p>thanks
> > > > <p>kaunteya</blockquote>
> > > > </html>
> > >
> > > > --------------EE197CEE0215E8A9C42A12C8--
>
> > --------------0969DB8C731F55222437D473
> > Content-Type: text/html; charset=us-ascii
> > Content-Transfer-Encoding: 7bit
>
> > <!doctype html public \"-//w3c//dtd html 4.0 transitional//en\">
> > <html>
> > Kaunteya,
> > <p>No, you can\'t add a complex type definition to a group. A complex
> > type definition can only be contained by a schema or by an element.
> > So if you want a complex type definition to be \"contained\" by a model
group
> > you have to create an XSDParticle, that contains (i.e., setContent()) an
> > XSDElementDeclaration that either contains a complex type (i.e.,
> setAnonymousTypeDefinitition),
> > or refers to a complex type (i.e., setTypeDefinition); the particle can
> > be added to any model group (i.e., getContents().add()) and the particle
> > can have its maxOccurs set (e.g., setMaxOccurs(-1)).
> > <p>For example:
> > <blockquote><?xml version=\"1.0\" encoding=\"UTF-8\"?>
> > <br><xsd:schema xmlns:xsd=\"<A
>
HREF=\"http://www.w3.org/2001/XMLSchema\">http://www.w3.org/2001/XMLSchema</
A>\">
> > <br> <xsd:complexType name=\"x\">
> > <br> <xsd:sequence>
> > <br> <xsd:element minOccurs=\"0\" maxOccurs=\"unbounded\"
> > name=\"y\">
> > <br> <xsd:complexType> <!--
> > can\'t have a name=\"Bank_Operation_Code\" -->
> > <br> <xsd:sequence>
> > <br>
> > <xsd:element minOccurs=\"0\" maxOccurs=\"unbounded\" fixed=\"3!a15d\"
> name=\"Constraint\"
> > type=\"xsd:string\"/>
> > <br>
> > <xsd:element minOccurs=\"1\" maxOccurs=\"1\" name=\"_26T\"
> type=\"xsd:string\"/>
> > <br> </xsd:sequence>
> > <br> </xsd:complexType>
> > <br> </xsd:element>
> > <br> <xsd:element minOccurs=\"0\" maxOccurs=\"unbounded\"
> > name=\"z\" type=\"x\"/>
> > <br> </xsd:sequence>
> > <br> </xsd:complexType>
> > <br></xsd:schema></blockquote>
>
> > <br>
> > <p>kaunteya bhattacharya wrote:
> > <blockquote TYPE=CITE>Hello Ed,
> > <p>Yes, I am sorry I missed out on the <sequence> element. But I
realized
> > <br>that I cant do the following things with the complexTypeDefinition.
> > <p>1. I cant seem to add it in a group. Basically clump a number of
complex
> > <br>types in a ModelGroupDefinition. Because XSDParticle content does
not
> > take
> > <br>in XSDComplexType objects.
> > <p>2. I cant seem to define the cardinality of these complex types..
> > <br>Essentially what if there are more than one occurence of complex
types
> > <br>within the XML instance document. I know you can do that with
maxOccur
> > and
> > <br>minOccur on XSDParticleContent or elements but not with complexType.
> > But
> > <br>ElementDeclaration cannot seem to have children.
> > <p>What is the best design.
> > <p>thanks for your help
> > <br>kauntea
> > <br>
> > <p>Ed Merks wrote:
> > <p>> --------------EE197CEE0215E8A9C42A12C8
> > <br>> Content-Type: text/plain; charset=us-ascii
> > <br>> Content-Transfer-Encoding: 7bit
> > <p>> Kaunteya,
> > <p>> Are you trying to write something like this?
> > <p>> <?xml version=\"1.0\" encoding=\"UTF-8\"?>
> > <br>> <xsd:schema xmlns:xsd=\"<a
>
href=\"http://www.w3.org/2001/XMLSchema\">http://www.w3.org/2001/XMLSchema</
a>\">
> > <br>> <xsd:complexType name=\"Bank_Operation_Code\">
> > <br>> <xsd:sequence>
> > <br>>
> > <xsd:element maxOccurs=\"unbounded\" fixed=\"3!a15d\"
> > <br>> name=\"Constraint\" type=\"xsd:string\"/>
> > <br>>
> > <xsd:element maxOccurs=\"unbounded\" name=\"_26T\"
> > <br>> type=\"xsd:string\"/>
> > <br>> </xsd:sequence>
> > <br>> </xsd:complexType>
> > <br>> </xsd:schema>
> > <p>> kaunteya bhattacharya wrote:
> > <p>> > Hello,
> > <br>> > I am curious as to learn how would I go about defining
repititive
> > elements
> > <br>> > in the schema. I have defined a number of
XSDComplexTypeDefinition
> > <br>> > elements. But I cant seem to define their multiple occurences in
> > the
> > <br>> > schema. For e.g.
> > <br>> >
> > <br>> > <xsd:complexType name=\"Bank_Operation_Code\">
> > <br>> > <xsd:element fixed=\"3!a15d\" name=\"Constraint\"
> type=\"xsd:string\"/>
> > <br>> > <xsd:element name=\"_26T\" type=\"xsd:string\"/>
> > <br>> > </xsd:complexType>
> > <br>> >
> > <br>> > This element occurs multiple times in my XML document. How do I
> > define
> > <br>> > that?
> > <br>> > This is quite urgent to me. Any help would be much appreciated.
> > <br>> >
> > <br>> > thanks
> > <br>> >
> > <br>> > kaunteya
> > <p>> --------------EE197CEE0215E8A9C42A12C8
> > <br>> Content-Type: text/html; charset=us-ascii
> > <br>> Content-Transfer-Encoding: 7bit
> > <p>> <!doctype html public \"-//w3c//dtd html 4.0 transitional//en\">
> > <br>> <html>
> > <br>> Kaunteya,
> > <br>> <p>Are you trying to write something like this?
> > <br>> <blockquote><?xml version=\"1.0\" encoding=\"UTF-8\"?>
> > <br>> <br><xsd:schema xmlns:xsd=\"<A
> > <br>HREF=\"<a
>
href=\"http://www.w3.org/2001/XMLSchema\">http://www.w3.org/2001/XMLSchema</
a>\"><a
>
href=\"http://www.w3.org/2001/XMLSchema\">http://www.w3.org/2001/XMLSchema</
a></A>\">
> > <br>> <br> <xsd:complexType name=\"Bank_Operation_Code\">
> > <br>> <br> <xsd:sequence>
> > <br>> <br> <xsd:element <b>maxOccurs=\"unbounded\"</b>
> > <br>> fixed=\"3!a15d\" name=\"Constraint\" type=\"xsd:string\"/>
> > <br>> <br> <xsd:element <b>maxOccurs=\"unbounded\"</b>
> > <br>> name=\"_26T\" type=\"xsd:string\"/>
> > <br>> <br> </xsd:sequence>
> > <br>> <br> </xsd:complexType>
> > <br>> <br></xsd:schema></blockquote>
> > <br>> kaunteya bhattacharya wrote:
> > <br>> <blockquote TYPE=CITE>Hello,
> > <br>> <br>I am curious as to learn how would I go about defining
repititive
> > <br>elements
> > <br>> <br>in the schema. I have defined a number of
XSDComplexTypeDefinition
> > <br>> <br>elements. But I cant seem to define their multiple occurences
> > in the
> > <br>> <br>schema. For e.g.
> > <br>> <p><xsd:complexType name=\"Bank_Operation_Code\">
> > <br>> <br> <xsd:element fixed=\"3!a15d\" name=\"Constraint\"
> type=\"xsd:string\"/>
> > <br>> <br> <xsd:element name=\"_26T\" type=\"xsd:string\"/>
> > <br>> <br></xsd:complexType>
> > <br>> <p>This element occurs multiple times in my XML document. How
> > do I define
> > <br>> <br>that?
> > <br>> <br>This is quite urgent to me. Any help would be much
appreciated.
> > <br>> <p>thanks
> > <br>> <p>kaunteya</blockquote>
> > <br>> </html>
> > <p>> --------------EE197CEE0215E8A9C42A12C8--</blockquote>
> > </html>
>
> > --------------0969DB8C731F55222437D473--
>
>
>
>
Previous Topic:Repititive elements in Schema: Help!
Next Topic:Why XSDElementDeclaration doesnt have Min/Max Occur?
Goto Forum:
  


Current Time: Wed Apr 24 20:01:30 GMT 2024

Powered by FUDForum. Page generated in 0.03637 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top