Re: HELP: Need At-Least-One model, and CDATA element type

Brian Atkins <brian_atkins@firehunter.com> writes:

> Sorry if this is already answered, but I spent several hours and
> couldn't find an answer in the archives or documents.

> Question 1: I want to create a model such that I can have either one
> or both of a set of elements, but not none.  The following model
> describes my desired result:
> 
>     <xs:choice>
>       <xs:sequence>
>         <xs:element name="StartTime" type="xs:dateTime"/>
>         <xs:element name="StopTime" type="xs:dateTime" minOccurs="0"/>
>       </xs:sequence>
>       <xs:sequence>
>         <xs:element name="StartTime" type="xs:dateTime" minOccurs="0"/>
>         <xs:element name="StopTime" type="xs:dateTime"/>
>       </xs:sequence>
>     </xs:choice>

Use the Schema equivalent of ((a, b?) | (b, a?)).

> Question 2: How do I get a CDATA like type for an element?  What I
> want is to encapsulate a document as payload in an element in an
> outer document, and have it be completely opaque.  If the payload
> document happens to be HTML, XML, or anything else, I don't care and
> don't want parsers or processors to touch it.  It's just a blob of
> element content. For the life of me, I can't figure this out.  Any
> help, pointers?

Not clear what you really want here -- do you mean SGML's CDATA?

To treat markup as data, use a CDATA marked section, i.e.

<![CDATA[...]]>

To tell the schema processor to ignore markup, use the <any/> particle 
in your content model.

ht
-- 
  Henry S. Thompson, HCRC Language Technology Group, University of Edinburgh
          W3C Fellow 1999--2001, part-time member of W3C Team
     2 Buccleuch Place, Edinburgh EH8 9LW, SCOTLAND -- (44) 131 650-4440
	    Fax: (44) 131 650-4587, e-mail: ht@cogsci.ed.ac.uk
		     URL: http://www.ltg.ed.ac.uk/~ht/

Received on Friday, 7 September 2001 05:16:48 UTC