Download Shareware and Freeware Software for Windows, Linux, Macintosh, PDA

line Home  |  About Us  |  Link To Us  |  FAQ  |  Contact

Serving Software Downloads in 976 Categories, Downloaded 32.406.351 Times

XML::SAX::Intro 0.14

  Date Added: March 16, 2010  |  Visits: 680

XML::SAX::Intro

Report Broken Link
Printer Friendly Version


Product Homepage
Download (81 downloads)



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..

Requirements: No special requirements
Platforms: Linux
Keyword: Introduction Libraries Parsing Perl Programming Sax Sax Parsing Start State Using Xml Xmlsaxintro
Users rating: 0/10

License: Freeware Size: 58.37 KB
USER REVIEWS
More Reviews or Write Review


XML::SAX::INTRO RELATED
Database Tools  -  Introduction to Object-Oriented Programming in MATLAB(R) Webinar 1.0
This contains the demo files and the presentation PDF file used in the "Introduction to Object-Oriented Programming in MATLAB(R)" Webinar, which was delivered in April 2009. These are meant to augment the Webinar, not replace it. Check out the...
30.72 KB  
Network & Internet  -  mod_perl 2.0.3
mod_perl project brings together the full power of the Perl programming language and the Apache HTTP server. You can use Perl to manage Apache, respond to requests for web pages and much more. mod_perl gives you a persistent Perl interpreter...
3.5 MB  
Libraries  -  XML::Parser::PerlSAX 0.08
XML::Parser::PerlSAX is a Perl SAX parser using XML::Parser. SYNOPSIS use XML::Parser::PerlSAX; $parser = XML::Parser::PerlSAX->new( [OPTIONS] ); $result = $parser->parse( [OPTIONS] ); $result = $parser->parse($string);...
64.51 KB  
Libraries  -  XML::SAX::Base 1.02
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...
20.48 KB  
Libraries  -  XML::SAX 0.14
XML::SAX is a simple API for XML. SYNOPSIS use XML::SAX; # get a list of known parsers my $parsers = XML::SAX->parsers(); # add/update a parser XML::SAX->add_parser(q(XML::SAX::PurePerl)); # remove parser...
58.37 KB  
Libraries  -  Language::Basic::Variable 1.44
Language::Basic::Variable is a Perl module to handle parsing and implementing BASIC variables. SYNOPSIS See Language::Basic for the overview of how the Language::Basic module works. This pod page is more technical. There are two sorts of...
52.22 KB  
Libraries  -  XML::TiePYX 0.05
XML::TiePYX is a Perl module to read or write XML data in PYX format via tied filehandle SYNOPSIS use XML::TiePYX; tie *XML,XML::TiePYX,file.xml open IN,file.xml or die $!; tie *XML,XML::TiePYX,*IN,Condense=>0; my $text=< tag...
7.17 KB  
Libraries  -  WAP::SAXDriver::wbxml 2.04
WAP::SAXDriver::wbxml is a Perl module with SAX parser for WBXML file. SYNOPSIS use WAP::SAXDriver::wbxml; $parser = WAP::SAXDriver::wbxml->new( [OPTIONS] ); $result = $parser->parse( [OPTIONS] ); WAP::SAXDriver::wbxml is a SAX2 driver,...
23.55 KB  
Libraries  -  XML::Filter::Sort 1.01
XML::Filter::Sort is a SAX filter for sorting elements in XML. SYNOPSIS use XML::Filter::Sort; use XML::SAX::Machines qw( :all ); my $sorter = XML::Filter::Sort->new( Record => person, Keys => [ [ lastname, alpha, asc ], [ firstname,...
25.6 KB  
Libraries  -  XML::IODEF 0.06
XML::IODEF is a Perl module for building/parsing IODEF messages. QUICK START Below is an example of an Incident IODEF message. < !DOCTYPE IODEF-Message PUBLIC "-//IETF//DTD RFC XXXX IODEF v1.0//EN"...
25.6 KB  
NEW DOWNLOADS IN PROGRAMMING, LIBRARIES
Programming  -  Cedalion for Linux 0.2.6
Cedalion is a programming language that allows its users to add new abstractions and define (and use) internal DSLs. Its innovation is in the fact that it uses projectional editing to allow the new abstractions to have no syntactic limitations.
471.04 KB  
Programming  -  Math::GMPf 0.29
Math::GMPf - perl interface to the GMP library's floating point (mpf) functions.
30.72 KB  
Programming  -  Net::Wire10 1.08
Net::Wire10 is a Pure Perl connector that talks to Sphinx, MySQL and Drizzle servers. Net::Wire10 implements the low-level network protocol, alias the MySQL wire protocol version 10, necessary for talking to one of the aforementioned...
30.72 KB  
Programming  -  logilab-common 0.56.2
a bunch of modules providing low level functionnalities shared among some python projects devel Please note that some of the modules have some extra dependencies. For instance, logilab.common.db will require a db-api 2.0 compliant...
174.08 KB  
Programming  -  OpenSSL for linux 1.0.0a
The OpenSSL Project is a collaborative effort to develop a robust, commercial-grade, full-featured, and Open Source toolkit implementing the Secure Sockets Layer (SSL v2/v3) and Transport Layer Security (TLS v1) protocols as well as a...
3.83 MB  
Libraries  -  wolfSSL 3.15.3
The wolfSSL embedded SSL/TLS library is a lightweight SSL library written in ANSI standard C and targeted for embedded and RTOS environments - primarily because of its small size, speed, and feature set. It is commonly used in standard operating...
3.88 MB  
Libraries  -  EuGTK 4.8.9
Makes it easy to develop good- looking, fast, cross-platform programs that run on Linux, OS X, and Windows. Euphoria is a very fast interpreted/compiled language with straight-forward syntax. EuGTK allows programming in a clean, object-oriented...
10.68 MB  
Libraries  -  Linux User Group Library Manager 1.0
The LUG Library Manager is a project to help Linux User Groups start their own library. A LUG library is helpful to the community at large because it increases access to information, and gives everyone the opportunity to become more knowledgeable.
5.35 KB  
Libraries  -  Module::MakefilePL::Parse 0.12
Module::MakefilePL::Parse is a Perl module to parse required modules from Makefile.PL. SYNOPSIS use Module::MakefilePL::Parse; open $fh, Makefile.PL; $parser = Module::MakefilePL::Parse->new( join("", ) ); $info = $parser->required;...
8.19 KB  
Libraries  -  sqlpp 0.06
sqlpp Perl package is a SQL preprocessor. sqlpp is a conventional cpp-alike preprocessor taught to understand SQL ( PgSQL, in particular) syntax specificities. In addition to the standard #define/#ifdef/#else/#endif cohort, provides also...
10.24 KB