- From: Matthew Jaquish <mjaquish@cisco.com>
- Date: Wed, 08 Jan 2003 14:41:38 -0800
- To: xmlschema-dev@w3.org
Hello all! If this message is a duplicate, I sincerely apologize. I searched through the archives and could not find an answer to my question, which is: Can I define an element to contain a string OR a CDATA section, and not contain an empty string? In a schema, is there any way to allow an element to contain CDATA? I couldn't find it in the specification. My problem: When I use an element definition and set it to a string datatype with a minimum length of 1, I get a validation error when it contains a CDATA section. I want to allow a string or a CDATA section as valid content for the same element, and I do not want to allow it to be blank. Here are examples of what I want to allow: <description>some text or numbers 1234</description> <description><![CDATA[anything in the CDATA section]]></description> Here is an example of what I do NOT want to allow: <description></description> I tried this, which works for a string, but tells me that a CDATA section is invalid: <xsd:element name="description"> <xsd:simpleType> <xsd:restriction base="xsd:string"> <xsd:minLength value="1"/> </xsd:restriction> </xsd:simpleType> </xsd:element> Is it possible to define this combination for an element in a schema? Thanks, - Matt
Received on Wednesday, 8 January 2003 18:00:07 UTC