Re: comment nodes

>It's not the '>' that is the problem - it's the '--'
>(http://www.w3.org/TR/1998/REC-xml-19980210#sec-comments) says 'For
>compatibility, the string "--" (double-hyphen) must not occur within
>comments.'

Good point. But consider
     <!-- &#45;&#45;-->
... I'm honestly not sure when character references get processed, so I'm
not sure whether that comes through as written, as --, or gets caught as a
syntax error. I would be surprised if it's the latter.

The DOM made a deliberate decision not to enforce every possible
well-formedness constraint on every operation. String content, in general,
is something we do not check at this time. If you're concerned, either
refrain from producing ill-formed documents or check/fix them before using
them... or access the DOM through higher-level libraries that provide those
checks and repairs.

As noted, DOM Level 3 is expected to provide more assistance in finding
well-formedness problems, but will do so only when requested.


>BTW, are entity references resolved in comments?

I don't think so. Compare the grammar for comments [15] with the grammar
for AttValue [10] or content [43]. Comments don't make explicit provision
for references, and hence are just raw character strings.

______________________________________
Joe Kesselman  / IBM Research

Received on Friday, 22 September 2000 16:33:16 UTC