OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.


Help: OASIS Mailing Lists Help | MarkMail Help

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index]
Re: [xml-dev] XML Redux

Stephen Green scripsit:

> For example the parser might need to have two modes,
> one lax and one strict, to allow on one hand the parsing of the XML as text
> ignoring any encoding 'errors' (like XML5, say) so that at least the parser
> can read in the XML for certain uses (like correction of such 'errors' by
> character escaping/replacing, etc) and on the other hand something which
> focuses on parsing 'valid' XML. 

I'm not attacking *you* here, Stephen, but I do want to attack the
widespread meme that HTML5-style formats and parsers are simpler or easier
to use.  HTML5 is in fact strictly defined: it permits only a single parse
for any given string of characters, and often its parse is *not* easy to
understand unless you have grasped the detailed mental model of HTML5.
Fortunately, there is a smaller and easier-to-understand subset, valid
HTML5, which allows many fewer possibilities, and it's easy to set up
even smaller subsets that are as expressive as full HTML5 but have a
yet simpler model of syntax.

Lax parsers are also more complicated than strict ones.  A strict parser
sees an error, it just gives up.  But a lax parser has to provide
an error recovery strategy that makes sense to the user, which is a
hard problem dating back to the beginning of "automatic programming"
(i.e. writing code in something other than binary notation).

MicroLark, for example, provides a lax parser of MicroXML, but its
recovery strategy is intentionally naive (mostly "revert to character
data") and I would never put it forward as a standard method of error
recovery.  Doing so feels too much like designing a kludge.  If a kludge
becomes commonly used, as HTML5 parsing has, it makes sense to try to
standardize its workings post hoc, but trying to decide in advance what
errors users will make and what their mental model will expect to find
strikes me as a hopeless undertaking.

So they play that [tune] on                     John Cowan
their fascist banjos, eh?                       cowan@ccil.org
        --Great-Souled Sam                      http://www.ccil.org/~cowan

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index]

News | XML in Industry | Calendar | XML Registry
Marketplace | Resources | MyXML.org | Sponsors | Privacy Statement

Copyright 1993-2007 XML.org. This site is hosted by OASIS