Main > Programming > Libraries >

XML::SAX::Intro 0.14

XML::SAX::Intro 0.14

Sponsored Links

XML::SAX::Intro 0.14 Ranking & Summary

RankingClick at the star to rank
Ranking Level
User Review: 0 (0 times)
File size: 0.057 MB
Platform: Any Platform
License: Perl Artistic License
Price:
Downloads: 1140
Date added: 2006-09-12
Publisher: Matt Sergeant

XML::SAX::Intro 0.14 description

XML::SAX::Intro is an Introduction to SAX Parsing with Perl.

XML::SAX is a new way to work with XML Parsers in Perl. In this article well discuss why you should be using SAX, why you should be using XML::SAX, and well see some of the finer implementation details. The text below assumes some familiarity with callback, or push based parsing, but if you are unfamiliar with these techniques then a good place to start is Kip Hamptons excellent series of articles on XML.com.

Replacing XML::Parser

The de-facto way of parsing XML under perl is to use Larry Wall and Clark Coopers XML::Parser. This module is a Perl and XS wrapper around the expat XML parser library by James Clark. It has been a hugely successful project, but suffers from a couple of rather major flaws. Firstly it is a proprietary API, designed before the SAX API was conceived, which means that it is not easily replaceable by other streaming parsers. Secondly its callbacks are subrefs. This doesnt sound like much of an issue, but unfortunately leads to code like:

sub handle_start {
my ($e, $el, %attrs) = @_;
if ($el eq foo) {
$e->{inside_foo}++; # BAD! $e is an XML::Parser::Expat object.
}
}

As you can see, were using the $e object to hold our state information, which is a bad idea because we dont own that object - we didnt create it. Its an internal object of XML::Parser, that happens to be a hashref. We could all too easily overwrite XML::Parser internal state variables by using this, or Clark could change it to an array ref (not that he would, because it would break so much code, but he could).

The only way currently with XML::Parser to safely maintain state is to use a closure:

my $state = MyState->new();
$parser->setHandlers(Start => sub { handle_start($state, @_) });

This closure traps the $state variable, which now gets passed as the first parameter to your callback. Unfortunately very few people use this technique, as it is not documented in the XML::Parser POD files.

Another reason you might not want to use XML::Parser is because you need some feature that it doesnt provide (such as validation), or you might need to use a library that doesnt use expat, due to it not being installed on your system, or due to having a restrictive ISP. Using SAX allows you to work around these restrictions.

XML::SAX::Intro 0.14 Screenshot

Advertisements

XML::SAX::Intro 0.14 Keywords

Bookmark XML::SAX::Intro 0.14

Hyperlink code:
Link for forum:

XML::SAX::Intro 0.14 Copyright

WareSeeker periodically updates pricing and software information of XML::SAX::Intro 0.14 full version from the publisher, so some information may be slightly out-of-date. You should confirm all information before relying on it. Software piracy is theft, Using crack, password, serial numbers, registration codes, key generators is illegal and prevent future development of XML::SAX::Intro 0.14 Edition. Download links are directly from our publisher sites, torrent files or links from rapidshare.com, yousendit.com or megaupload.com are not allowed

Allok Video Splitter 2.2.0 Review:

Name (Required)
Email(Required)
Captcha
Featured Software

Want to place your software product here?
Please contact us for consideration.

Contact WareSeeker.com
Related Software
XML::SAX is a simple API for XML. Free Download
Sax Filter is a modular set of filters that can be used to process XML documents via Javas SAX support. Free Download
XML::SAX::Machine is a Perl module that can manage a collection of SAX processors. Free Download
XML::SAX::ByRecord can record oriented processing of (data) documents. Free Download
XML::Descent is a Perl module for recursive descent XML parsing. Free Download
XML::SAX2Perl is a Perl module to translate Perl SAX methods to Java/CORBA style methods. Free Download
Bigtop::Docs::Tutorial is a simple case study of building a web app with bigtop. Free Download
XML::Simple is a easy API to maintain XML (esp config files). Free Download