[Lazarus] Generic XML question

Marco van de Voort marcov at stack.nl
Wed Feb 9 11:38:48 CET 2011


In our previous episode, Marc Weustink said:
> Anyway each time I have to communicate with xml there are some "issues"
> One system for instance doesn't like spaces before the first element or 
> a linefeed after the closing element. Another system ignores the xml 
> message when it encounters an not yet known element (its hard to 
> implement forward/backward compatibility this way). Yesterday I was 
> working on a new system and that one complained about unparseble xml 
> when I put some whitespace (space, linefeed) between the first opening 
> tag end the second opening tag.

> Now I wonder, is xml supposed to be so strict or are this implementation 
> "issues"

Implementation issues. We also have a lot of fun with a vendor that compiles
his libxml(2?) one version with crlf support(Windows style), and sometimes
only with lf support.(Unix style). And he writes unescaped linefeeds in
values that apparantly he can read and write with libxml but are not allowed
in XML.

So strictly speaking what he writes is not validatable XML, but you simply
can't avoid to ignore it. The same problem as e.g. Microsofts funky IE6 html
interpretation in the past.

(I use a modified version of the Lazarus laz_* xml routines btw, sanitized a
bit to make it work with unicode delphi's.  Nowadays I would take FPC's XML
implementation for anything serious though)

I've also seen a lot of modification in behaviour with respect to default
value. If an app looks up a value in an XML file that isn't there, does it
return some typed default value (0, '' and so on), or a hard NIL pointer,
SQL null or the like.





More information about the Lazarus mailing list