Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   XML (http://www.velocityreviews.com/forums/f32-xml.html)
-   -   Content model ANY (http://www.velocityreviews.com/forums/t169444-content-model-any.html)

Richard Light 06-09-2005 08:10 AM

Content model ANY
 

A literal-minded reading of the XML 1.0 Spec suggests that elements with
content model ANY should not have comments or PIs as their immediate
children. Is there a particular reason for this?

Richard Light
--
Richard Light
SGML/XML and Museum Information Consultancy
richard@light.demon.co.uk


David Håsäther 06-09-2005 09:36 AM

Re: Content model ANY
 
Richard Light <richard@light.demon.co.uk> wrote:

> A literal-minded reading of the XML 1.0 Spec suggests that
> elements with content model ANY should not have comments or PIs as
> their immediate children.


What in the spec made you draw that conclusion? Comments and PIs can
appear directly in an element with a content model of ANY.

--
David Håsäther

Richard Light 06-09-2005 09:51 AM

Re: Content model ANY
 
In message <Xns9670762013DFAdavidhasather@195.67.237.51>, David Håsäther
<hasather@msn.com> writes
>Richard Light <richard@light.demon.co.uk> wrote:
>
>> A literal-minded reading of the XML 1.0 Spec suggests that
>> elements with content model ANY should not have comments or PIs as
>> their immediate children.

>
>What in the spec made you draw that conclusion? Comments and PIs can
>appear directly in an element with a content model of ANY.


So I previously assumed myself. However, the absence of any mention of
them in the relevant validity constraint led me to ask the question.

This is the section I was reading:
-------------------------------------------------------------------------
--------------------------
Validity constraint: Element Valid

An element is valid if there is a declaration matching elementdecl where
the Name matches the element type, and one of the following holds:

1. The declaration matches EMPTY and the element has no content
(not even entity references, comments, PIs or white space).
2. The declaration matches children and the sequence of child
elements belongs to the language generated by the regular expression in
the content model, with optional white space, comments and PIs (i.e.
markup matching production [27] Misc) between the start-tag and the
first child element, between child elements, or between the last child
element and the end-tag. Note that a CDATA section containing only white
space or a reference to an entity whose replacement text is character
references expanding to white space do not match the nonterminal S, and
hence cannot appear in these positions; however, a reference to an
internal entity with a literal value consisting of character references
expanding to white space does match S, since its replacement text is the
white space resulting from expansion of the character references.
3. The declaration matches Mixed and the content (after
replacing any entity references with their replacement text) consists of
character data, comments, PIs and child elements whose types match names
in the content model.
4. The declaration matches ANY, and the content (after replacing
any entity references with their replacement text) consists of character
data and child elements whose types have been declared.
-------------------------------------------------------------------------
--------------------------

You will notice that the absence of comments and PIs is explicitly
mentioned in case 1 (EMPTY), and their presence is explicitly mentioned
in 2 and 3. So I am assuming that the absence of any mention of them in
case 4 (ANY) means they are not allowed.

Richard Light
--
Richard Light
SGML/XML and Museum Information Consultancy
richard@light.demon.co.uk


Richard Tobin 06-09-2005 12:12 PM

Re: Content model ANY
 
In article <6aYWNAB2l$pCFAck@light.demon.co.uk>,
Richard Light <richard@light.demon.co.uk> wrote:

>A literal-minded reading of the XML 1.0 Spec suggests that elements with
>content model ANY should not have comments or PIs as their immediate
>children. Is there a particular reason for this?


Yes. It's a mistake.

It was corrected in an erratum:

http://www.w3.org/XML/xml-V10-3e-errata#E05

The fact that it was corrected so late suggests that almost everyone
was so sure of what it really meant that they didn't bother to read
the text closely!

-- Richard

Richard Light 06-09-2005 12:25 PM

Re: Content model ANY
 
In message <d89bmt$ik9$2@pc-news.cogsci.ed.ac.uk>, Richard Tobin
<richard@cogsci.ed.ac.uk> writes

>>A literal-minded reading of the XML 1.0 Spec suggests that elements with
>>content model ANY should not have comments or PIs as their immediate
>>children. Is there a particular reason for this?

>
>Yes. It's a mistake.
>
>It was corrected in an erratum:
>
> http://www.w3.org/XML/xml-V10-3e-errata#E05
>
>The fact that it was corrected so late suggests that almost everyone
>was so sure of what it really meant that they didn't bother to read
>the text closely!


Thanks. When you're tasked with making an XML validator which conforms
to the spec, these little details suddenly start to matter ...

Richard

--
Richard Light
SGML/XML and Museum Information Consultancy
richard@light.demon.co.uk


Richard Tobin 06-10-2005 10:21 PM

Re: Content model ANY
 
In article <d89bmt$ik9$2@pc-news.cogsci.ed.ac.uk>, I wrote:

>It was corrected in an erratum:


And, it turns out, it was introduced in an earlier erratum. The
original XML spec didn't have that wording.

-- Richard


All times are GMT. The time now is 11:06 AM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.