Content model ANY

Discussion in 'XML' started by Richard Light, Jun 9, 2005.

  1. 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, Jun 9, 2005
    #1
    1. Advertising

  2. Richard Light <> 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
    David Håsäther, Jun 9, 2005
    #2
    1. Advertising

  3. In message <Xns9670762013DFAdavidhasather@195.67.237.51>, David Håsäther
    <> writes
    >Richard Light <> 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, Jun 9, 2005
    #3
  4. In article <6aYWNAB2l$>,
    Richard Light <> 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 Tobin, Jun 9, 2005
    #4
  5. In message <d89bmt$ik9$>, Richard Tobin
    <> 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, Jun 9, 2005
    #5
  6. In article <d89bmt$ik9$>, 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
    Richard Tobin, Jun 10, 2005
    #6
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. hazz
    Replies:
    6
    Views:
    49,528
    SkyUCHC
    Jun 9, 2010
  2. Mani
    Replies:
    0
    Views:
    1,444
  3. Philippe Poulard
    Replies:
    0
    Views:
    416
    Philippe Poulard
    Sep 7, 2004
  4. Michael Strorm
    Replies:
    10
    Views:
    4,861
    Peter Flynn
    Aug 21, 2005
  5. Replies:
    1
    Views:
    483
    Andreas Wollschlaeger
    Oct 6, 2006
Loading...

Share This Page