> >OK: <note>Here is a note</note>
> >OK: <note><p>Here is a note</p></note>
> >Forbidden: <note>Here is a note <p>With an embedded paragraph</p></note>
> >Forbidden: <note>
> > <p>Here is a note</p>
> > </note>
David Chesnutt writes:
> Peter: I don't understand the difference between the second and fourth
> examples. Except for the formatting, they seem identical to me.
Ah...THAT's the "gotcha". The content model for NOTE says (basically)
EITHER #PCDATA OR (some mix of markup): not both (that's a simplification
but let it stand).
In #2, it's unambiguous: no character data, only <P> markup.
In #4, as far as SGML is concerned, a newline and/or spaces is classed
as character data, so the linebreak and indent mean the parser has
decided by the time it hits <p> that NOTE contains character data, NOT
element markup, thus satisfying the first option of the content model.
Then the parser hits a <P>. NOTE is declared as having an omissible
end-tag, so the parser decides that NOTE must have ended, because once
it has character data as its content, it may not have any markup. So a
</NOTE> is implied, and the <P> starts a new paragraph outside
NOTE. The paragraph ends, and then the parser hits </NOTE>...and
issues the error message to the effect that a NOTE element has been
terminated when none was open.
Is this clear or have I confused matters even more?