473,406 Members | 2,356 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,406 software developers and data experts.

complex type schema

Hi,

I am a newbie to schema definitions so forgive me if this is a simple
question.

I am trying to create a schema for a complex type that allows
instances of either of the two forms:

<test1 state=true>
<name>test1/>
<type>typeA/>
</test1>

<test2 state=false>
<name>test2/>
<type>type@/>
</test2>

Here the 'type' element is a string without the '@' character if
'state' is true and a string with the '@' character when state is
false.

Oct 22 '07 #1
2 1800
mo*******@gmail.com wrote:
I am trying to create a schema for a complex type that allows
instances of either of the two forms:

<test1 state=true>
<name>test1/>
<type>typeA/>
</test1>

<test2 state=false>
<name>test2/>
<type>type@/>
</test2>
XML Schemas don't allow you to select between two different types of
content based on the value of a variable -- *EXCEPT* by making the two
types of content subtypes of a single type, and then using the xsi:type
attribute to switch between them. If you are willing to replace your
"state" with that directive, you can make this work. Otherwise, do this
cross-dependency check in your application code, or investigate whether
your environment supports any of the other schema languages.

--
Joe Kesselman / Beware the fury of a patient man. -- John Dryden
Oct 22 '07 #2
I'm just starting to get my head around XML Schemas. I found XML
Studio really good for learning the basics, and its free

http://www.liquid-technologies.com/P...XmlStudio.aspx

Regards Jason

On 22 Oct, 19:40, motorp...@gmail.com wrote:
Hi,

I am a newbie to schema definitions so forgive me if this is a simple
question.

I am trying to create a schema for a complex type that allows
instances of either of the two forms:

<test1 state=true>
<name>test1/>
<type>typeA/>
</test1>

<test2 state=false>
<name>test2/>
<type>type@/>
</test2>

Here the 'type' element is a string without the '@' character if
'state' is true and a string with the '@' character when state is
false.

Oct 23 '07 #3

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

Similar topics

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...
1
by: Ulf Heyder | last post by:
Hello, I have to deal with some xml schemas from a third party. This schema contains the following complex type. <?xml version="1.0"?> <xsd:schema ... elementFormDefault="qualified"> .......
0
by: AL | last post by:
Hello, working on an xsd schema, I'd like it to have a node of which I don't know the content at design time: I want the document instance to identify such node contents, where content should have...
8
by: Steve Jorgensen | last post by:
Mailing List management is a good example of a case where my conundrum arises. Say there is a m-m relationship between parties and groups - anyone can be a member of any combintation of groups. ...
1
by: leslie_tighe | last post by:
Hello, I have webservice created with Axis 1.2.1 and that I am trying to consuming in .NET (VB) using the Microsoft provided tools. While I am able to consume methods on the service that return...
7
by: Nalaka | last post by:
Hi, I created a sinple web service that returns a dataSet. Then I created a client program that uses this web service (that returns the Dataset). My question is, how did the client figure...
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: Eivind Gussiås Løkseth | last post by:
I've been reading Keith Pijanowski's article - Enrich Your XML Serialization With Schema Providers In The .NET Framework - on how to do custom serialization of objects. Link to the article:...
3
by: katis | last post by:
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 -...
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?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
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
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.