Error handling for SVG and MathML in HTML


There's been a lot of posting on the above topics. I must apologise
that I haven't been able to read them all in detail, so I may be
posting something that's already been put forward. If so, consider
this another post in support of it. If not, please consider this
option for error handling in the context of SVG/MathML embedded within

I'm curious about the tension between the 'draconian error handling'
of XML vs 'error recovery' in HTML. Many have already stated, the
draconian approach is excellent for authors mastering conformance, but
poor for hobby authors (yes we must support them) and general users. I
agree browsers should focus on error recovery. Developer toolbars
should allow users to opt-in to draconian handling. Authoring tools
should definitely be more draconian, but helpfully so (providing
direction to improve code quality, not just reporting errors). But I
digress ...

Here's what I expect to happen if I author a page containing bad SVG or MathML.

If I'm authoring XHTML, well, I expect draconian error handling in
browsers (is it moot whether I *want* that :)
If I'm authoring HTML, I expect error recovery. But *what kind* of
error recovery? (This is the bit I haven't seen anyone post on, but I
may have missed it).

I expect the HTML document to be recovered, and that's my top
priority. I expect the SVG/MathML to be rendered as an error, like a
broken image/broken object. If I referenced an image (jpeg, gif, etc.)
that was broken, the browser wouldn't attempt to render it. I'd like
to see SVG/MathML handled in the same way.

Let's say I create logo.svg to use on a website. I've made a mistake
in my logo.svg code, but I've gone ahead and used it anyway (I know,
this highly unrealistic scenario almost never happens in the real
world, but bear with me!) Let's say I included it in my HTML using the
img element... when I view my page in the browser -- oops! I see a
broken image. I will have to fix my SVG.

Let's say I embed that SVG in the HTML code, rather than use the img
tag. I want the exact same thing to happen: browser shows a broken
image, but the rest of the HTML document "works". Are the implementers
groaning over my naivety here? I know the situation is different from
a programming perspective ...

I realise this does nothing to lower the barrier to authoring SVG, but
I reckon that is not an issue for the HTML WG to solve (if it is an
issue at all). We don't make jpegs and pngs easier to author nor do
browsers implement more flexible error handling on those files (that I
know of). Unless the SVG/MathML groups endorse more flexibility in the
syntax, I don't believe we should second guess them. And I am talking
about the syntax/serialisation here, which is what we authors write
from time to time, not the DOM.

That's me, representing myself as an author again. If I mess up my SVG
or MathML, hold me accountable and render it as a broken image (or
"broken object"). But recover my HTML, I'm used to that crutch, and
agree it is the best approach for people trying to use the web.
Recover HTML, perhaps even at the expense of embedded SVG/MathML!

A mashed up mess of svg+html (with or without a detailed description)
won't help me, but this approach might.

I don't know if that makes life easier or more difficult for the
implementers ... (one hopes easier, but one does not know).


Received on Saturday, 15 March 2008 03:49:31 UTC