473,396 Members | 1,924 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Extending complex type - minOccurs

Hi all :)

Is it posible in xsd to change only minOccurs value of element in
complex type by extending this type?

The problem I'm trying to solve is this: I have two complex types -
"TextField" and "FileChooser".
Here is definition of "TextField"

<xsd:complexType name="TextField">
<xsd:sequence>
<xsd:element name="paramName" type="xsd:string"/>
<!-- some other element's definitions here -->
<xsd:element name="file" minOccurs="0" type="file" />
</xsd:sequence>
</xsd:complexType>

"FileChooser"'s type is "TextFile", but I want to ensure that in
"FileChooser" element "file" will occur 1 time. How can it be done? Is
it possible?

Thx for yor time,
Katis

Apr 19 '07 #1
3 3651
On 19 Apr, 12:25, katis <katarzyna.by...@gmail.comwrote:
Hi all :)

Is it posible in xsd to change only minOccurs value of element in
complex type by extending this type?

The problem I'm trying to solve is this: I have two complex types -
"TextField" and "FileChooser".
Here is definition of "TextField"

<xsd:complexType name="TextField">
<xsd:sequence>
<xsd:element name="paramName" type="xsd:string"/>
<!-- some other element's definitions here -->
<xsd:element name="file" minOccurs="0" type="file" />
</xsd:sequence>
</xsd:complexType>

"FileChooser"'s type is "TextFile", but I want to ensure that in
"FileChooser" element "file" will occur 1 time. How can it be done? Is
it possible?

Thx for yor time,
Katis
Hi Katis,
I think it is not possible. Once you define an element of a particular
complex type it will take the complex types defintion. So you have to
change minOccurs to 1 within "TextFile" type.
Thanks,
Chandra

Apr 19 '07 #2
Thanks for your response, Chandru - I get your point. But it seems I
didn't make myselfe clear. I was thinking of defining another complex
type - let's say "FileChooserType" that would extend "TextField", and
defining "FileChooser" as a element of a "FileChooserType" type.

So my question - one more time - is: is it possible to change value of
minOccurs of some element when extending the complex type? In other
words - I have complex type "TextField" and "FileChooserType"
extending "TextField" type. In "TextField" I have <xsd:element
name="file" minOccurs="0" type="file" /defined. I want to be able to
use "file" element also in "FileChooserType", but with minOccurs
changed from 0 to 1. Can it be done using extending mechanism or
should I define another type - let's say "SuperTextType" without
"file" element in it, and make "TextField" and "FileChooserType"
extending "SuperTextType", each of them defining "file" element with
different minOccurs count?

Katis

Chandru napisal(a):
On 19 Apr, 12:25, katis <katarzyna.by...@gmail.comwrote:
Hi all :)

Is it posible in xsd to change only minOccurs value of element in
complex type by extending this type?

The problem I'm trying to solve is this: I have two complex types -
"TextField" and "FileChooser".
Here is definition of "TextField"

<xsd:complexType name="TextField">
<xsd:sequence>
<xsd:element name="paramName" type="xsd:string"/>
<!-- some other element's definitions here -->
<xsd:element name="file" minOccurs="0" type="file" />
</xsd:sequence>
</xsd:complexType>

"FileChooser"'s type is "TextFile", but I want to ensure that in
"FileChooser" element "file" will occur 1 time. How can it be done? Is
it possible?

Thx for yor time,
Katis

Hi Katis,
I think it is not possible. Once you define an element of a particular
complex type it will take the complex types defintion. So you have to
change minOccurs to 1 within "TextFile" type.
Thanks,
Chandra
Apr 19 '07 #3
On 19 Apr, 13:17, katis <katarzyna.by...@gmail.comwrote:
Thanks for your response, Chandru - I get your point. But it seems I
didn't make myselfe clear. I was thinking of defining another complex
type - let's say "FileChooserType" that would extend "TextField", and
defining "FileChooser" as a element of a "FileChooserType" type.

So my question - one more time - is: is it possible to change value of
minOccurs of some element when extending the complex type? In other
words - I have complex type "TextField" and "FileChooserType"
extending "TextField" type. In "TextField" I have <xsd:element
name="file" minOccurs="0" type="file" /defined. I want to be able to
use "file" element also in "FileChooserType", but with minOccurs
changed from 0 to 1. Can it be done using extending mechanism or
should I define another type - let's say "SuperTextType" without
"file" element in it, and make "TextField" and "FileChooserType"
extending "SuperTextType", each of them defining "file" element with
different minOccurs count?

Katis

Chandru napisal(a):
On 19 Apr, 12:25, katis <katarzyna.by...@gmail.comwrote:
Hi all :)
Is it posible in xsd to change only minOccurs value of element in
complex type by extending this type?
The problem I'm trying to solve is this: I have two complex types -
"TextField" and "FileChooser".
Here is definition of "TextField"
<xsd:complexType name="TextField">
<xsd:sequence>
<xsd:element name="paramName" type="xsd:string"/>
<!-- some other element's definitions here -->
<xsd:element name="file" minOccurs="0" type="file" />
</xsd:sequence>
</xsd:complexType>
"FileChooser"'s type is "TextFile", but I want to ensure that in
"FileChooser" element "file" will occur 1 time. How can it be done? Is
it possible?
Thx for yor time,
Katis
Hi Katis,
I think it is not possible. Once you define an element of a particular
complex type it will take the complex types defintion. So you have to
change minOccurs to 1 within "TextFile" type.
Thanks,
Chandra- Hide quoted text -

- Show quoted text -

I think what you could do is use schema's <restrictionoption, e.g.
define FileChooser as:

<xsd:complexType name="FileChooser">
<xsd:complexContent>
<xsd:restriction base="TextField">
<xsd:sequence>
<xsd:element name="paramName" type="xsd:string"/>
<!-- some other element's definitions here -->
<xsd:element name="file" minOccurs="1" type="file" />
</xsd:sequence>
</xsd:restriction>
</xsd:complexContent>
</xsd:complexType>

The down side of that is that you largely have to redefine
FileChooser. You can get around this to some degree by using a group
for the common stuff.

<xsd:complexType name="TextField">
<xsd:sequence>
<xsd:group ref="commonStuff"/>
<xsd:element name="file" minOccurs="0" type="file" />
</xsd:sequence>
</xsd:complexType>

<xsd:complexType name="FileChooser">
<xsd:complexContent>
<xsd:restriction base="TextField">
<xsd:sequence>
<xsd:group ref="commonStuff"/>
<xsd:element name="file" minOccurs="1" type="file" />
</xsd:sequence>
</xsd:restriction>
</xsd:complexContent>
</xsd:complexType>

Consequently, your suggestions to use a super type is probably more
appealing.

HTH,

Pete.
--
=============================================
Pete Cordell
Tech-Know-Ware Ltd
for XML Schema to C++ data binding visit
http://www.tech-know-ware.com/lmx/
http://www.codalogic.com/lmx/
=============================================

Apr 20 '07 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: David | last post by:
Hi everyone, I wonder how is it possible to make PHP SOAP extension convert the returned complex type to an instance of one of my classes. Here I give you a short example: complexTest.wsdl:...
0
by: mjcsfo | last post by:
I can't seem to find a reference nor any helpful threads on this topic. I've gotten the following error in two circumstances: 1. A complex type has nested within it another complex type, in the...
5
by: HQM | last post by:
If I create an element X of a primitive type with minOccurs=0 and nillable=true and run it through the WSDL generator I get a class with a property "X" of the primitive type plus a boolean...
4
by: Ganesh Muthuvelu | last post by:
Hi STAN, Stan: Thanks for your response to my previous post on reading a XSD file using your article in "https://blogs.msdn.com/stan_kitsis/archive/2005/08/06/448572.aspx". it works quite well...
1
by: louis_la_brocante | last post by:
Dear all, I am having trouble generating a client proxy for a webservice whose methods return a "complex" type. The type is complex in that it is a class whose members are a mix of primitive...
2
by: bjhartin | last post by:
Hello all, I am having a problem with extending complex types. I have a simple base schema (FooBar.xsd) which defines XML documents of the following form: <Foo FooAttribute1="aaa"> <Bar...
0
by: Thomas.Koerfer | last post by:
Hey guys, I googled for nearly 3 hours - but no result... We run a web-service and want to reach that service from Access. In the following part you see the wsdl content and the automatically...
0
by: shaily | last post by:
hi I have a java web service called "Registration service" and C# client which is a consumer of that service java web service running under Tomcat has following interface API exposed ...
0
by: C.W.Holeman II | last post by:
I am using Firefox for details see: http://emle.sourceforge.net/emle020100/ng20070620_context.html http://emle.sourceforge.net/emle020100/ng20070621_emle_lab_011.xsd and...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.