473,396 Members | 2,038 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.

Defining a type or element for this element/complex data type ...

Hi

<ClubNight Name = "Go club" Date = "2006-09-09">
Discussed a few simple proverbs.
<Attendee Name = "RJ"/>
<Attendee Name = "TT"/>
<Attendee Name = "RB"/>
</ClubNight>

I'm trying to work out if I can actually define this as a complex type
in my schema.

I can do it no problems without the text 'Discussed a few simple
proverbs." but no matter how I fiddle with extending a simple type and
so on, I just can't get it working.

Is it actually possible? Thanks for any advice.

Emma

Sep 9 '06 #1
2 1501
<em**************@fastmail.fmwrote in message
news:11**********************@i3g2000cwc.googlegro ups.com...
Hi

<ClubNight Name = "Go club" Date = "2006-09-09">
Discussed a few simple proverbs.
<Attendee Name = "RJ"/>
<Attendee Name = "TT"/>
<Attendee Name = "RB"/>
</ClubNight>

I'm trying to work out if I can actually define this as a complex type
in my schema.

I can do it no problems without the text 'Discussed a few simple
proverbs." but no matter how I fiddle with extending a simple type and
so on, I just can't get it working.

Is it actually possible? Thanks for any advice.
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
elementFormDefault="qualified">
<xs:element name="ClubNight">
<xs:complexType mixed="true">
<xs:sequence>
<xs:element minOccurs="0" maxOccurs="unbounded" ref="Attendee"/>
</xs:sequence>
<xs:attribute name="Date" use="required" type="xs:NMTOKEN"/>
<xs:attribute name="Name" use="required"/>
</xs:complexType>
</xs:element>
<xs:element name="Attendee">
<xs:complexType>
<xs:attribute name="Name" use="required" type="xs:NCName"/>
</xs:complexType>
</xs:element>
</xs:schema>

Emma, to give credit where it's due, this was generated by Stylus Studio
(http://www.stylusstudio.com/).

John

BTW, if you have a choice, I'd put the text in an element, like:

<NotesDiscussed a few simple proverbs.</Notes>

This would allow for greater flexibility later on. You could, for instance,
structure the notes, or include XHTML in them.
Sep 9 '06 #2
John Saunders wrote:
<em**************@fastmail.fmwrote in message
news:11**********************@i3g2000cwc.googlegro ups.com...
Hi

<ClubNight Name = "Go club" Date = "2006-09-09">
Discussed a few simple proverbs.
<Attendee Name = "RJ"/>
<Attendee Name = "TT"/>
<Attendee Name = "RB"/>
</ClubNight>

I'm trying to work out if I can actually define this as a complex type
in my schema.

I can do it no problems without the text 'Discussed a few simple
proverbs." but no matter how I fiddle with extending a simple type and
so on, I just can't get it working.

Is it actually possible? Thanks for any advice.

<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
elementFormDefault="qualified">
<xs:element name="ClubNight">
<xs:complexType mixed="true">
<xs:sequence>
<xs:element minOccurs="0" maxOccurs="unbounded" ref="Attendee"/>
</xs:sequence>
<xs:attribute name="Date" use="required" type="xs:NMTOKEN"/>
<xs:attribute name="Name" use="required"/>
</xs:complexType>
</xs:element>
<xs:element name="Attendee">
<xs:complexType>
<xs:attribute name="Name" use="required" type="xs:NCName"/>
</xs:complexType>
</xs:element>
</xs:schema>

Emma, to give credit where it's due, this was generated by Stylus Studio
(http://www.stylusstudio.com/).

John

BTW, if you have a choice, I'd put the text in an element, like:

<NotesDiscussed a few simple proverbs.</Notes>

This would allow for greater flexibility later on. You could, for instance,
structure the notes, or include XHTML in them.
Hi

Thanks for the reply. The thing with <xs:complexType mixed="true"is
that it also validates when 'text' is sandwiched between the direct
descendent elements too! Ah well - I doubt if there's a way to
constrain that. I agree with your comment about having a proper <Notes>
element. I was thinking it is really more of an attribute of
<ClubNightbut then that approach seems to have the same drawbacks as
having it as text. As you say, the <Noteselement can then be extended
without breaking the definition of ClubNight.

Thanks!

Emma

Sep 10 '06 #3

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

Similar topics

2
by: Dom | last post by:
Hi to all, I have to develop a PHP client calling a web service hosted by Tomcat-Axis platform... The signature exposed by the web service is (java-description): public boolean insert(Account...
4
by: Jari Kujansuu | last post by:
I can successfully parse XML document using SAX or DOM and I can also validate XML document against schema. Problem is that my program should deal with user-defined schemas which means that when...
4
by: scorpion | last post by:
I have a simple type like this: <xs:simpleType name="SizeType"> <xs:restriction base="xs:token"> <xs:enumeration value="small"/> <xs:enumeration value="medium"/> <xs:enumeration...
2
by: andy.wagg | last post by:
I have a .NET web service that defines a complex type in the wsdl. One element of this wsdl does not define a type, but expects different simple data types to be handled polymorphically. ...
3
by: dgaucher | last post by:
Hi, I want to consume a Web Service that returns a choice, but my C++ client always receives the same returned type. On the other hand, when I am using a Java client, it is working fine (of...
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...
6
by: RickH | last post by:
Hello, I would like to create a user XSD data type that inherits from the w3 standard data type called ID to make sure a certain repeated element always contains distinct values. The problem is...
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: delirio | last post by:
Hi, I have an XML Schema containing inherited complex types, and xs:elements using @type of the top complex type, meaning, any child complex type can be an instance of that element by declaring...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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
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
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.