[tpm] Good examples?

Alex Beamish talexb at gmail.com
Fri Nov 8 06:49:02 PST 2013


I haven't used it, but XML::SAX appears to be a wrapper or loader for the
XML parser of your choice. It looks like you could use XML::SAX::PurePerl
directly, for example, in order to parse XML. If you need to read your XML
from a file, stash it in a file, rather than trying to pipe it into your
code.

Regular expressions are fine for fairly small data items, but they're
usually not suitable for (mostly) structured data like HTML and XML.

Alex



On Fri, Nov 8, 2013 at 9:30 AM, <arocker at vex.net> wrote:

>
> Does anyone know of a good explanation/example of how to use XML::SAX
> anywhere online?
>
> I've looked at the CPAN documentation, and other usual sources, but they
> have some ambiguity about what are standard method names, features, &c.,
> and what are simply examples of user-written resources.
>
> The problem that started this train of thought is absurdly simple;
> extracting 3 fields per record from a STDIN stream of records containing 5
> or 6 embedded in XML tags.
>
>  A simple program, basically 3 regexes and a print, does the job, but
> attracted a storm of online criticism about parsing XML with regexes.
> I've been trying to write the equivalent using XML::SAX, but seem to be
> missing something. (For one thing, all the examples assume reading from a
> named file, not STDIN.)
>
> _______________________________________________
> toronto-pm mailing list
> toronto-pm at pm.org
> http://mail.pm.org/mailman/listinfo/toronto-pm
>



-- 
Alex Beamish
Toronto, Ontario
aka talexb
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.pm.org/pipermail/toronto-pm/attachments/20131108/08408810/attachment.html>


More information about the toronto-pm mailing list