W3C home > Mailing lists > Public > xmlschema-dev@w3.org > June 2009

RE: [XML Schema 1.1] What does the "appliesToEmpty" attribute mean? What does it do?

From: Costello, Roger L. <costello@mitre.org>
Date: Mon, 1 Jun 2009 16:25:43 -0400
To: "xmlschema-dev@w3.org" <xmlschema-dev@w3.org>
Message-ID: <9E51F88D5247B648908850C35A3BBB5003FD2020FA@IMCMBX3.MITRE.ORG>

Thanks again Michael.

I'd like to confirm my understanding. 

Consider this element with empty content (but it has an attribute):

    <element name="image">
           <attribute name="href" type="anyURI" />

In an instance document we can have this:

    <image href="http://wwww.maps.org/boston.gif" />

Now, suppose the image element is declared in a schema that has defaultOpenContent with appliedToEmpty="true":

    <xs:defaultOpenContent mode="interleave" appliesToEmpty="true">
        <xs:any />

Then in the instance document I can put extension elements *within* the <image> element:

    <image href="http://wwww.maps.org/boston.gif">
        <ex:comment>My home town</ex:comment>

Conversely, if appliesToEmpty="false":

    <xs:defaultOpenContent mode="interleave" appliesToEmpty="false">
        <xs:any />

Then in the instance document I cannot put extension elements *within* the <image> element.

Is that correct?


-----Original Message-----
From: Michael Kay [mailto:mike@saxonica.com] 
Sent: Monday, June 01, 2009 12:27 PM
To: Costello, Roger L.; xmlschema-dev@w3.org
Subject: RE: [XML Schema 1.1] What does the "appliesToEmpty" attribute mean? What does it do?

When you have a defaultOpenContent in a schema document, this switch
determines whether the open content is allowed even on elements whose
content model is empty.

Section clause 5 makes this clear: if a complex type does not
define its own <openContent>, then it is taken from the
<defaultOpenContent>, provided that either the content model is non-empty,
or the content model is empty and defaultOpenContent/@appliesToEmpty is true


Michael Kay

> -----Original Message-----
> From: xmlschema-dev-request@w3.org 
> [mailto:xmlschema-dev-request@w3.org] On Behalf Of Costello, Roger L.
> Sent: 01 June 2009 17:04
> To: xmlschema-dev@w3.org
> Subject: [XML Schema 1.1] What does the "appliesToEmpty" 
> attribute mean? What does it do?
> Hi Folks,
> A search for "appliesToEmpty" in the structures' 
> specification yields 4 occurrences of this term, but no prose 
> describing its meaning.
> What does "appliesToEmpty" mean? What does it do?
> /Roger
Received on Monday, 1 June 2009 20:26:20 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 23:15:51 UTC