- From: Mr Dragev <mrdragev@gmail.com>
- Date: Fri, 2 Dec 2005 15:11:26 -0700
- 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:sequence> <xsd:element name="bar" minOccurs="0"/> </xsd:sequence> </xsd:complexType> </xsd:element> The following XML examples are valid according to the definition above and according to my requirements: <foo><bar/></foo> --- <foo> text </foo> --- <foo> text <bar/> text </foo> The following XML examples are INVALID according to my requirements (BUT ARE VALID according the the definition above): <foo></foo> --- <foo> </foo> 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