XML::Ximple - XML in Perl
XiMpLe is a simple XML parser created to provide a tree based XML parser with a more desirable data structure than what was currently availible on CPAN.
use XML::Ximple (qw( parse_xml_file parse_xml get_root_tag ximple_to_string )); $ximple_tree = parse_xml_file ( $filename ); $ximple_tree = parse_xml ( $string ); $ximple_tag = get_root_tag ( $ximple_tree ); $string = ximple_to_string ( $ximple_tree );
<ximple_tree> ::= [ <ximple_tag> ... ] <ximple_tag> ::= { tag_name => <tag-name>, attrib => <attribs> content => <ximple_tree> tag_type => <tag-type> } <tag-name> ::= <xml-identifier> <attribs> ::= { <xml-identifier> => String, ... } <tag-type> ::= PI | XMLDecl | DOCTYPE | Comment | undef
Given a filename, parse the file as XML and return a Ximple tree.
Given a string, parse it as XML and return a Ximple tree.
Given a Ximple tree, return the root element as a Ximple leaf.
Given a Ximple tree, return XML as a string. This will format the output XML differently than the input.
use XML::Ximple (qw(parse_xml get_root_tag ximple_to_string)); my $xt = parse_xml(<>); print "This looks like a "; print get_root_tag($xt)->{tag_name}; print " type of document.\n"; print '-'x80; print ximple_to_string($xt);
<xml-ximple@goreliance.com>
<http://goreliance.com/devel/xml-ximple>
Reliance Technology Consultants, Inc. <http://goreliance.com> Mike MacHenry <dskippy@ccs.neu.edu> Mike Burns <netgeek@speakeasy.net>
To install XML::Ximple, copy and paste the appropriate command in to your terminal.
cpanm
cpanm XML::Ximple
CPAN shell
perl -MCPAN -e shell install XML::Ximple
For more information on module installation, please visit the detailed CPAN module installation guide.