Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > XML > XSD: How to nest elements and text

Reply
Thread Tools

XSD: How to nest elements and text

 
 
Michael
Guest
Posts: n/a
 
      09-03-2008
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</b> and 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?

 
Reply With Quote
 
 
 
 
Martin Honnen
Guest
Posts: n/a
 
      09-03-2008
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</b> and 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/
 
Reply With Quote
 
 
 
 
Martin Honnen
Guest
Posts: n/a
 
      09-04-2008
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</b> and 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/
 
Reply With Quote
 
Martin Honnen
Guest
Posts: n/a
 
      09-04-2008
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</b> and 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/
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: How include a large array? Edward A. Falk C Programming 1 04-04-2013 08:07 PM
Nest Web Projects =?Utf-8?B?UmFlZCBTYXdhbGhh?= ASP .Net 1 07-19-2005 02:45 PM
how to nest CheckBoxList in DataSet ( asp.net vb ) krzysiek ASP .Net 0 10-18-2004 01:33 PM
Nest controls in a MS Treeview Web Control Chad ASP .Net 1 12-18-2003 05:00 PM
generic xslt to nest a xml-document as text within an element Martin XML 2 12-07-2003 10:33 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57