XML::Lite - A lightweight XML parser for simple files
use XML::Lite; my $xml = new XML::Lite( xml => 'a_file.xml' );
XML::Lite is a lightweight XML parser, with basic element traversing methods. It is entirely self-contained, pure Perl (i.e. not based on expat). It provides useful methods for reading most XML files, including traversing and finding elements, reading attributes and such. It is designed to take advantage of Perl-isms (Attribute lists are returned as hashes, rather than, say, lists of objects). It provides only methods for reading a file, currently.
The following methods are available:
Creates a new XML::Lite object. The XML::Lite object acts as the document object for the $source that is sent to it to parse. This means that you create a new object for each document (or document sub-section). As the objects are lightweight this should not be a performance consideration.
The object constructor can take several named parameters. Parameter names may begin with a '-' (as in the example above) but are not required to. The following parameters are recognized.
xml The source XML to parse. This can be a filename, a scalar that contains the document (or document fragment), or an IO handle.
As a convenince, if only on parameter is given, it is assumed to be the source. So you can use this, if you wish:
my $xml = new XML::Lite( 'file.xml' );
Returns a reference to an XML::Lite::Element object that represents the root element of the document.
Returns undef on errors.
undef
Returns a list of all elements that match $name. @list is a list of XML::Lite::Element objects If called in a scalar context, this will return the first element found that matches (it's more efficient to call in a scalar context than assign the results to a list of one scalar).
$name
@list
If no matching elements are found then returns undef in scalar context or an empty list in array context.
(None known)
0.11
Jeremy Wadsack for Wadsack-Allen Digital Group (dgsupport@wadsack-allen.com)
Copyright 2001 Wadsack-Allen. All rights reserved. This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
To install XML::Lite, copy and paste the appropriate command in to your terminal.
cpanm
cpanm XML::Lite
CPAN shell
perl -MCPAN -e shell install XML::Lite
For more information on module installation, please visit the detailed CPAN module installation guide.