Re: Error handling for SVG and MathML in HTML

Ben Boyle wrote:
> It would be ideal that with text/html parsing rules apply to the
> nested html markup... parser building the dom and working like: found
> SVG element, parse element as XML

This is very difficult to do with a stock XML parser (because you have no way to 
tell it when to stop).  Writing a custom parser is a good way to have a broken 
parser.

If you additionally require to switch out of XML mode on hitting <foreignobject> 
containing HTML (which is not a foregone conclusion, but seems like a good 
idea), you _really_ can't use a stock XML parser.

I should note that there are other differences between an "XML parser" and an 
"HTML parser" that have nothing to do with closing tags, attributes, etc, and 
become issues much earlier in the parsing process.  For example, for XML an 
encoding error is supposed to be fatal, while HTML recovers, inserts the 
replacement char, and moves on.

> (That's right isn't it... even when non-conforming markup is parsed,
> the parsing rules are such that a conforming DOM is constructed?)

This part is correct.

-Boris

Received on Saturday, 15 March 2008 17:28:32 UTC