Skip to content


Regular expressions win again

Rael: secrets of the XML gods:

In response to Tim Bray’s dirty little habit of parsing XML with regular expressions, Jon Udell writes: ‘If the XML gods are resorting to Perl and Python hackery to shred documents, are we just spinning our wheels? I don’t think so. But this is, perhaps, an unusual case. … I can, however, make excellent use of the text stream underlying XML abstractions. So, which way to regard a document becomes a kind of Necker cube puzzle. The bad news: it’s confusing. The good news: it’s useful.’

…. I just co-authored a book, 1/4 of which relied heavily on the availability of not only an XML parser, but a SOAP stack. Faced with the reality that more than a handful of readers wouldn’t have either at their disposal, I wrote a hack sure to turn the stomach of any XML purist while turning many a hacker frown upside-down… ‘NoXML, Another SOAP::Lite Alternative’ for the Google Web API. ‘… NoXML is a drop-in alternative to SOAP::Lite. As its name suggests, this home-brewed module doesn’t make use of an XML parser of any kind, relying instead on some dead-simple regular expressions and other bits of programmatic magic. ‘ Elegant? Depends on your definition. Pure? As the driven beach sand. Work? You betcha!

And I thought it was just me. ;)

Comments closed