Subversion is Xmlish

time to read 6 min | 1015 words

You know that it is a bad day when you start parsing XML using regular expressions.

When I started working on SvnBridge, I expected to have a lot of issues with TFS. What I didn't expect was to get hit by a Subversion WTF of gigantic magnitude.

Take a look at the following XML:

<?xml version="1.0" encoding="utf-8" ?>
<D:propertyupdate xmlns:D="DAV:" 
    xmlns:V="http://subversion.tigris.org/xmlns/dav/" 
    xmlns:C="http://subversion.tigris.org/xmlns/custom/" 
    xmlns:S="http://subversion.tigris.org/xmlns/svn/">
    <D:set>
        <D:prop>
            <C:bugtraq:label>Work Item:</C:bugtraq:label>
            <C:bugtraq:url>http://www.codeplex.com/SvnBridge/WorkItem/View.aspx?WorkItemId=%BUGID%</C:bugtraq:url>
            <C:bugtraq:message> Work Item: %BUGID%</C:bugtraq:message>
            <C:bugtraq:number>true</C:bugtraq:number>
            <C:bugtraq:warnifnoissue>true</C:bugtraq:warnifnoissue>
        </D:prop>
    </D:set>
</D:propertyupdate> 

Check the properties, and look closely. Despite the so-called xml header, this is not valid XML, yet this is produce (and consumed) by Subversion. This raise some interesting questions about what parser they are using, but that is beside the point.

This is wrong, period.