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