Perl Module XML::Reader

Klaus (archive)

Usenet Archive
Joined
Jul 2, 2003
Messages
172
Reaction score
0
Hi everybody,

For those who use Perl to parse XML...

....I have released XML::Reader (ver 0.34)
http://search.cpan.org/~keichner/XML-Reader-0.34/lib/XML/Reader.pm

An XML document can be very large (could be many gigabytes), it is usually composed of XML-subtrees, each of which is possibly only a few kilobytes in size. With the Perl module XML::Reader, you can read XML- subtrees one by one, only the memory for one subtree is held at a time. Each subtree can then be processed further at your convenience (for example by using Perl's regular expressions, or, by using other XML-Modules in Perl, such as XML::Simple).

In principle, XML::Reader has no event driven callback functions, you have to loop over the XML-document yourself and the resulting XML- subtree is represented in text format.

Any question, suggestions, feedback are most welcome !

To explain the module, I have created a small demonstration program in Perl that extracts XML-subtrees memory efficiently.

You can find my demonstration program at
http://groups.google.com/group/comp.lang.perl.modules/msg/2de63781c60d525e
 

Klaus (archive)

Usenet Archive
Joined
Jul 2, 2003
Messages
172
Reaction score
0
Hi everybody,

For those who use Perl to parse XML...

...I have released XML::Reader (ver 0.34)
http://search.cpan.org/~keichner/XML-Reader-0.34/lib/XML/Reader.pm

I have now released a new version of XML::Reader (ver 0.35) with some bug fixes, warts removed, relicensing, etc...

http://search.cpan.org/~keichner/XML-Reader-0.35/lib/XML/Reader.pm

For XML::Reader ver 0.34) you could write:
my $rdr = XML::Reader->newhd(\$content, { filter => 5 },

With the new version 0.35 of XML::Reader, the same line would be spelled:

my $rdr = XML::Reader->new(\*DATA, {mode => 'branches'});
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
548,049
Messages
3,104,244
Members
248,133
Latest member
DujonT

Latest Threads

Top