Home » Archived » XML Schema Definition (XSD) » Repititive elements in Schema: Help!
|
Re: Repititive elements in Schema: Help! [message #15428 is a reply to message #15392] |
Fri, 28 March 2003 10:27 |
Eclipse User |
|
|
|
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><?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 |
Eclipse User |
|
|
|
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. 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 #15558 is a reply to message #15526] |
Fri, 28 March 2003 15:37 |
kaunteya bhattacharya 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 |
Dave Spriet 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 |
Ed Merks 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><?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--
Ed Merks
Professional Support: https://www.macromodeling.com/
|
|
| | |
Re: Repititive elements in Schema: Help! [message #566775 is a reply to message #15461] |
Fri, 28 March 2003 13:45 |
Ed Merks 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. 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--
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 |
kaunteya bhattacharya 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 |
Dave Spriet 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--
>
>
>
>
|
|
|
Goto Forum:
Current Time: Wed Apr 24 20:01:30 GMT 2024
Powered by FUDForum. Page generated in 0.03637 seconds
|