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

XSD: How to nest elements and text

I'd like to define a paragraph element p in XSD which contains text
(xs:string) and formatting elements i and b (italic and bold). A valid p
element could look like this:

<p>This is <b>bold</band this <i>italic</i>.</p>

I'd use something like this:

<xs:complexType name="p">
<xs:sequence minOccurs="0" maxOccurs="unbounded">
<xs:choice>
<xs:element name="i" type="xs:string" />
<xs:element name="b" type="xs:string" />
</xs:choice>
</xs:sequence>
</xs:complexType>

But what do I use for the third option, "raw text", to cover "This is "
and similar sections in the example above?

Sep 3 '08 #1
2 2264
Michael wrote:
I'd like to define a paragraph element p in XSD which contains text
(xs:string) and formatting elements i and b (italic and bold). A valid p
element could look like this:

<p>This is <b>bold</band this <i>italic</i>.</p>

I'd use something like this:

<xs:complexType name="p">
<xs:sequence minOccurs="0" maxOccurs="unbounded">
<xs:choice>
<xs:element name="i" type="xs:string" />
<xs:element name="b" type="xs:string" />
</xs:choice>
</xs:sequence>
</xs:complexType>

But what do I use for the third option, "raw text", to cover "This is "
and similar sections in the example above?
See the mixed contents example in
http://www.w3.org/TR/xmlschema-0/#mixedContent
--

Martin Honnen
http://JavaScript.FAQTs.com/
Sep 3 '08 #2
Michael wrote:
I'd like to define a paragraph element p in XSD which contains text
(xs:string) and formatting elements i and b (italic and bold). A valid p
element could look like this:

<p>This is <b>bold</band this <i>italic</i>.</p>

I'd use something like this:

<xs:complexType name="p">
<xs:sequence minOccurs="0" maxOccurs="unbounded">
<xs:choice>
<xs:element name="i" type="xs:string" />
<xs:element name="b" type="xs:string" />
</xs:choice>
</xs:sequence>
</xs:complexType>

But what do I use for the third option, "raw text", to cover "This is "
and similar sections in the example above?
See the mixed contents example in
http://www.w3.org/TR/xmlschema-0/#mixedContent
--

Martin Honnen
http://JavaScript.FAQTs.com/
Sep 4 '08 #3

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

Similar topics

0
by: Ray Tayek | last post by:
hi, trying to convert some csv files into xsml and pulling a few hairs out :(. using the files below. a java program will parse the csv and take care of strange names and notes that line breaks in...
1
by: brendang | last post by:
Hi, I am getting the following errors on the schema (on the 'Fund_to' and 'Account_to' elements) in Visual Studio.NET when I try to validate the schema itself. I would greatly apreciate any help...
0
by: Matthew Baskey | last post by:
Hello, I am loading a DataSet from an xml file and binding it to a hierarchical datagrid. I am trying to write some keys between the elements in my xml file into the xsd file. When I write the...
1
by: Brendon | last post by:
I have 2 Xsd's The one contains basic type definitions <?xml version="1.0" encoding="utf-8"?> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified"...
0
by: Woody | last post by:
I need to group some attribute for use in different types, but if I nest an attributegroup inside another one I miss the nested attribute in class generated with xsd.exe. For example if I use the...
2
by: farseer | last post by:
Hi, First, sorry for this long post, but i'd like to explain my problem in detail... i have generated some classes from my schema. Classes are generated for the root (overall document),...
2
by: G Dean Blake | last post by:
If I add an existing .aspx file in another project to a new project, everything works fine except that it doesn't bring along the .xsd datasets. So then if I add existing .xsd file to my new...
3
by: Seago | last post by:
I'm not sure if I can explain my issue well enough, but here goes: I want to define an .XSD such that it allows for an ( A | B )* configuration where A and B are different elements. I would like...
9
by: =?Utf-8?B?ai5hLiBoYXJyaW1hbg==?= | last post by:
Hi, I have a schema that has an optional element, fieldTag4000Field. If the element is omitted from the XML request, when it is deserialized, it will be null when I check it - which is fine. ...
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
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
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
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,...
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.