spf-discuss
[Top] [All Lists]

Re: XML enables nested error handling

2004-05-29 02:07:48

On Friday 28 May 2004 19:55, Stuart D. Gathman wrote:
While I oppose XML because of the patent problem, here is a specific
example of how XML extensibility would be good.
[snip]
I can see already I got it wrong, so don't miss the point.  The point is
that any such scheme is going to require nesting syntax (supplied by
parenthesis above).  And as soon as you require nesting syntax, you might
as well use XML.

I agree with plenty of things about XML, and I use it for quite a lot of 
things big and small, but it would be daft to ignore the fact that XML has 
some characteristics that can be undesirable for applications such as SPF:
 - it's verbose
 - its handling of whitespace is ambiguous and a common source of errors
 - it's surprisingly hard to read/verify by humans in its plain form
 - it requires the entire stream to be read before you can even pronounce the 
stream to be valid (i.e. can't be parsed as a stream)
 - it has features designed for larger applications that aren't needed here, 
such as i18n support, character sequences, comments, declarations

All these mean that any attempt to use a "quick parser" to maximise speed and 
reduce footprint will be a bad move as someone is bound to use whatever 
feature of XML you forgot to code for - the rarer character codes (& < 
etc.), fancy featues of XML comments ("<!-- This is a comment -- oops, double 
hyphen, what now -->"), declarations (<? ?> constructs etc.), namespaces 
(<fred:tag tom:attr='xyz'> ...</fred:tag>), self closing tags... whatever - a 
hack parser is a recipe for disaster! So quite quickly everyone will end up 
using one of the "major" libraries like expat, sablotron etc and these 
things, as they're 'complete', do not have a lightweight footprint - you have 
to be careful how you install them (they're typically shared resources), they 
have non-trivial startup and initialisation times, and you have to code 
around the APIs that are designed for bigger and more general use.

In short, it runs the risk of killing the lightweight image of things like SPF 
- installation becomes an endurance trial, memory and CPU loads escalate, SPF 
records end up getting verbose as people decide to embed legal discliamers in 
XML comments in the DNS record (you know the lawyers will insist on inserting 
them if they can) etc. and suddenly SPF is "too big, too heavy, not worth 
it".

I don't have a great solution (anyone for http://www.yaml.org/ ??), it's a 
pity there aren't well defined subsets of XML for this sort of app - say XML 
compatible but with 'advanced' features removed (c.f. EC++ - a subset of C++ 
for embedded use), but be very wary of taking a more general solution for 
ease of use and then finding it kills the project ("The last 10 percent of 
performance generates one-third of the cost and two-thirds of the problems." 
-- Norman Augustine).

</rant>

I bet we'll end up there anyway tho.... ;^)

--
Tim