David Håsäther said:
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