W3C home > Mailing lists > Public > xmlschema-dev@w3.org > December 2005

Non-empty mixed content where all element content is optional

From: Mr Dragev <mrdragev@gmail.com>
Date: Fri, 2 Dec 2005 15:11:26 -0700
Message-ID: <6b66b4c60512021411o1d5b494em92a00515019d2498@mail.gmail.com>
To: xmlschema-dev@w3.org
I am trying develop a complex type that has mixed content, where all
the element content is optional, AND where the content cannot be empty
(content composed of white-space only is not allowed). In other words,
the type would allow (1) character content that is NOT simply
white-space only, or (2) element content, or (3) both character and
element content. Is this possible?

The following xsd snippet is an example definition that falls just
short of my requirements because an "empty" foo element is valid:

	<xsd:element name="foo">
		<xsd:complexType mixed="true">
				<xsd:element name="bar" minOccurs="0"/>

The following XML examples are valid according to the definition above
and according to my requirements:



	<foo> text </foo>





The following XML examples are INVALID according to my requirements
(BUT ARE VALID according the the definition above):





In essence, character content must match the pattern "\s*\S[\s\S]*" IF
the optional element bar does NOT appear in the content.
Received on Sunday, 4 December 2005 02:14:14 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 7 January 2015 14:56:09 UTC