Why XML Libraries Rock

msautotest is MapServer’s way of unit testing and sanity checking various features and bug fixes.

When testing the addition of AuthorityURL and Identifier support in WMS Capabilities XML, I found an issue with the output being invalid XML, which was tested and fixed. Another fix was then added to ensure valid XML (isn’t open source great)?

MapServer outputs XML by way of a modified printf as well as using libxml2 for newer code. Here was a case of a feature being added to older code. I’ve always pushed for libxml2 as it negates the possibilities of trying to print out XML via printf, which IMHO is error prone and can lead to poorly formed and invalid XML, and tons of printf’s for closing elements. Something like libxml2 trims down your code so you don’t have to do that (just declare the element, and libxml2 will close it for you). Same goes for etree for python folks.

At the same time, using something like libxml2 can yield heavy processing, especially for huge XML response (did someone say WFS GetFeature responses?).

What do you use for outputting XML in your development environment?

1 Comment so far »

  1. Mateusz Loskot said,

    Wrote on February 5, 2010 @ 08:42:31

    Mozilla Firefox 3.5.7 Windows Vista

    Tom,

    XSMELL – some people say, it’s the most ‘brilliantest’ C++ XML creation library ever created :-)

    Posted from United Kingdom United Kingdom
    Mozilla Firefox 3.5.7 Windows Vista

Comment RSS · TrackBack URI

Leave a Comment

Name: (Required)

E-mail: (Required)

Website:

Comment:

Modified: 3 February 2010 18:57:08 EST