Re: [xml-dev] Do you enjoy neighborhoods where every house looks the same?

From
Lauren Wood <>
To
Date
2013-08-28T17:23:59Z
ID
<>
Thread
Re: [xml-dev] Do you enjoy neighborhoods where every house looks the same?
On 28-Aug-13 8:57 AM, Jeremy H. Griffith wrote:

> The idea is that if the parser can tell what is missing
> or incorrect, and correct it, it will do so, warn you,
> and proceed.  This is John Cowan's idea in the MicroXML
> spec.  So for example if you have:
>
>    <p>This is <b>bold.</p>
>
> the parser can reasonably guess you meant:
>
>    <p>This is <b>bold.</b></p>
>
> Or if the character after the equals in an attribute
> is not a quote, it can supply one.  There are quite a
> few places the parser can make a reasonable guess.
> Like, ",p>" might have been meant to be "<p>", with
> the Shift key not in sync for the first character (a
> personal favorite typo for me ;-).

The hard part with these fixes is knowing when to stop. The law of 
diminishing returns kicks in fairly quickly on error conditions, 
especially when the schema isn't constrained. For example, it's much 
easier to correctly correct the missing end tags when the schema is 
constrained (e.g., you at least know which elements are meant to be 
empty, and which not). In my experience if your parser makes the wrong 
choice and therefore 'corrects' the wrong thing, or corrects it in the 
wrong way, the resulting mess can be difficult to fix properly. Of 
course, depending on your downstream processing, that may or may not matter.

Lauren