[Lazarus] Generic XML question

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

[Lazarus] Generic XML question

Marc Weustink-2
Hi,
This is not a specific lazarus question, but since here might be xml
users, I'll ask it here.
At my work our software interfaces with a lot of different systems, some
of them communicate through a binary protocol and some of them use xml
to encode data. YEars ago we coded our own xml parser (creates an object
tree of elements found) / generator (generates xml form such tree)
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"

Marc


--
_______________________________________________
Lazarus mailing list
[hidden email]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Reply | Threaded
Open this post in threaded view
|

Re: [Lazarus] Generic XML question

michael.vancanneyt


On Wed, 9 Feb 2011, Marc Weustink wrote:

> Hi,
> This is not a specific lazarus question, but since here might be xml users,
> I'll ask it here.
> At my work our software interfaces with a lot of different systems, some of
> them communicate through a binary protocol and some of them use xml to encode
> data. YEars ago we coded our own xml parser (creates an object tree of
> elements found) / generator (generates xml form such tree)
> 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"

I would think these are implementation issues. I have a case where the testsuite
of a bank accepts an XML message, and the final implementation rejects the same
message. The XML is valid, and according to the namespace rules, the message
'content' should also be valid, but because the test/final implementation
process the XML differently, you get the weirdest results.

XML namespaces are a typical case of over-engineering, where the various XML
implementations differ wildly in their 'interpretation' of the specs.
In Delphi I use TXMLDocument, which in turn uses msxml - a pain by all
standards: the final output depends on the machine I am running my program on.

That's why I am happy that the FPC XML implementation does what it is told,
and does not try to be 'smart' - well, not too much, anyway ;) .

Michael.

--
_______________________________________________
Lazarus mailing list
[hidden email]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Reply | Threaded
Open this post in threaded view
|

Re: [Lazarus] Generic XML question

Marco van de Voort
In reply to this post by Marc Weustink-2
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.


--
_______________________________________________
Lazarus mailing list
[hidden email]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus