Stories
Slash Boxes
Comments
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

use Perl Log In

Log In

[ Create a new account ]

Matts (1087)

Matts
  (email not shown publicly)

I work for MessageLabs [messagelabs.com] in Toronto, ON, Canada. I write spam filters, MTA software, high performance network software, string matching algorithms, and other cool stuff mostly in Perl and C.

Journal of Matts (1087)

Tuesday November 13, 2001
09:53 AM

XML::SAX

[ #1246 ]

XML::SAX first release is heading to CPAN now.

This is basically DBI for XML.

If you remember the days before DBI, we all used to use either OraPerl or Sybperl, which were hacked versions of the perl binary with Oracle or Sybase support compiled in (as functions).

Well that's about where Perl's XML support was until now - that is before today.

Now, instead of using a specific XML parser (e.g. XML::Parser, XML::LibXML, XML::SAX::PurePerl or something else), you can just use XML::SAX as a factory for parsers. Of course the parsers need to comply with the Perl SAX2 spec (so XML::Parser is out, but there will be SAX2 parsers based on XML::Parser coming out soon now), so that you're using the same interface regardless of the parser. But that's a good thing.

In XML::SAX you get the base XML::SAX, which is a registry of installed parsers on your machine. Then you get XML::SAX::Base, which is Kip Hampton's uber-cool Driver/Parser/Filter base class, which helps make sure you do the right thing wrt those types of "things" (see his XML.com column for more details). Also there's XML::SAX::Exception, which all Perl SAX2 parsers should use as an exception class. Then the all important XML::SAX::ParserFactory, which gives you something similar to DBI's "->connect" method, but better :-) Finally, the whole thing ships with XML::SAX::PurePerl, so that you always have a fallback parser.

I look forward to feedback from this. It's been a fun process.

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
 Full
 Abbreviated
 Hidden
More | Login | Reply
Loading... please wait.
  • Very cool Matt, thanks for your hard work. I hope to write some code hooking this thing up to Oracle's xml-types via OCI, so that I can read xml straight out of my database into our web publishing system. Now I have something to shoot for!
    --
    Waiting on the Road to Eventually, I lost my Place On Line