Main > Programming > Libraries >

XML::SAX::Base 1.02

XML::SAX::Base 1.02

Sponsored Links

XML::SAX::Base 1.02 Ranking & Summary

RankingClick at the star to rank
Ranking Level
User Review: 0 (0 times)
File size: 0.020 MB
Platform: Any Platform
License: Perl Artistic License
Price:
Downloads: 856
Date added: 2007-06-21

XML::SAX::Base 1.02 description

XML::SAX::Base is a base Perl class with SAX Drivers and Filters.

SYNOPSIS

package MyFilter;
use XML::SAX::Base;
@ISA = (XML::SAX::Base);

This module has a very simple task - to be a base class for PerlSAX drivers and filters. Its default behaviour is to pass the input directly to the output unchanged. It can be useful to use this module as a base class so you dont have to, for example, implement the characters() callback.

The main advantages that it provides are easy dispatching of events the right way (ie it takes care for you of checking that the handler has implemented that method, or has defined an AUTOLOAD), and the guarantee that filters will pass along events that they arent implementing to handlers downstream that might nevertheless be interested in them.

WRITING SAX DRIVERS AND FILTERS

Writing SAX Filters is tremendously easy: all you need to do is inherit from this module, and define the events you want to handle. A more detailed explanation can be found at http://www.xml.com/pub/a/2001/10/10/sax-filters.html.
Writing Drivers is equally simple. The one thing you need to pay attention to is NOT to call events yourself (this applies to Filters as well). For instance:
package MyFilter;
use base qw(XML::SAX::Base);

sub start_element {
my $self = shift;
my $data = shift;
# do something
$self->{Handler}->start_element($data); # BAD
}

The above example works well as precisely that: an example. But it has several faults: 1) it doesnt test to see whether the handler defines start_element. Perhaps it doesnt want to see that event, in which case you shouldnt throw it (otherwise itll die). 2) it doesnt check ContentHandler and then Handler (ie it doesnt look to see that the user hasnt requested events on a specific handler, and if not on the default one), 3) if it did check all that, not only would the code be cumbersome (see this modules source to get an idea) but it would also probably have to check for a DocumentHandler (in case this were SAX1) and for AUTOLOADs potentially defined in all these packages. As you can tell, that would be fairly painful. Instead of going through that, simply remember to use code similar to the following instead:

package MyFilter;
use base qw(XML::SAX::Base);

sub start_element {
my $self = shift;
my $data = shift;
# do something to filter
$self->SUPER::start_element($data); # GOOD (and easy) !
}

This way, once youve done your job you hand the ball back to XML::SAX::Base and it takes care of all those problems for you!

Note that the above example doesnt apply to filters only, drivers will benefit from the exact same feature.

XML::SAX::Base 1.02 Screenshot

Advertisements

XML::SAX::Base 1.02 Keywords

Bookmark XML::SAX::Base 1.02

Hyperlink code:
Link for forum:

XML::SAX::Base 1.02 Copyright

WareSeeker periodically updates pricing and software information of XML::SAX::Base 1.02 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::Base 1.02 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::Simple is a SAX version of XML::Simple. Free Download
C++ base is a base class suite contains several powerful c++ base classes for basic encapsulation. Free Download
XML::SAX2Perl is a Perl module to translate Perl SAX methods to Java/CORBA style methods. Free Download
XML::EasySQL is a two-way SQL/XML base class for Perl. Free Download
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::DocStats is a Perl module to produce a simple analysis of an XML document. Free Download