W3C home > Mailing lists > Public > xmlschema-dev@w3.org > November 2007

RE: Mixed content and empty content

From: <dmaze@us.ibm.com>
Date: Thu, 1 Nov 2007 10:39:12 -0400
To: xmlschema-dev@w3.org
Message-ID: <OF50B686F8.26D85F3C-ON85257386.004F92A2-85257386.005052DB@lotus.com>
Michael Kay <mike@saxonica.com> wrote on 11/01/2007 08:52:14 AM:

> > What I'm not sure about is, given:
> > 
> >     <xsd:element name="foo">
> >         <xsd:complexType/>
> >     </xsd:element>
> > 
> > Is:
> >     <foo>
> >     </foo>
> > 
> > a valid instance, i.e. is whitespace forbidden in an empty element?
> 
> Empty is a special case of element-only content, and whitespace is 
always
> allowed in element-only content. I think.

XML Schema 1.0, section 3.4.4, clause 2.1 states that if the {content 
type} of a complex type is empty(which is the case for an empty 
<xs:complexType/> declaration with mixed="false") then the element being 
validated may have no character or element information item [children] at 
all, which sounds like it explicitly excludes whitespace.  So <foo/> and 
<foo></foo> would both be valid, but not <foo> </foo>.

David Maze
Engineer, IBM WebSphere DataPower SOA Appliances
One Rogers Street, Cambridge, MA 02142
Phone: 617-693-1306  Fax: 617-693-5541
Received on Thursday, 1 November 2007 14:37:53 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 11 January 2011 00:15:01 GMT