WWW::Mechanize::XML - adds an XML DOM accessor to WWW::Mechanize.
This document describes WWW::Mechanize::XML version 0.02
use WWW::Mechanize::XML; use Test::More; my $mech = WWW::Mechanize::XML->new(); ok($mech->get('http://flickr.com/service/?method=getPhotos'), 'got photo list'); lives_ok { $dom = $mech->xml(); } 'got xml dom object'; $root = $dom->domumentElement(); my @photos = $root->findnodes('/rsp/photos/photo'); is(scalar @photos, 23, 'got 23 photos');
This is a subclass of WWW::Mechanize that provides an XML DOM accessor which parses the contents of the response and returns it as a XML::LibXML::Document. The motivation for developing this module was to facilitate testing of XML APIs and XHTML web pages.
Creates a new WWW::Mechanize::XML object with the specified options. This constructor method accepts all of the arguments accepted by WWW::Mechanize - see WWW::Mechanize for further details. Other optional arguments accepted by this method are xml_parser_options and xml_error_options:
WWW::Mechanize::XML
xml_parser_options
xml_error_options
This argument, if specified, must be a hashref of valid XML::LibXML::Parser options which will be used to instantiate the XML parser. If no parser options are specified defaults are used. Please see the documentation for XML::LibXML::Parser for option descriptions and default values. Valid parser options accepted are:
This argument, if specified, must be a hashref containing at least the trigger_xpath key. If there is a value for the given xpath expression it will cause the call to xml() to die with that value. If a trigger_value key is specified the call will only die if the value at trigger_xpath equals trigger_value. If a message_xpath key is specified the call to xml() will die with the value at that path.
trigger_xpath
xml()
trigger_value
message_xpath
Returns a XML::LibXML::Document object created from the response content by calling the XML::LibXML::Parser parse_string() method. Any parsing errors will propogate up. If xml_error_options were specified for this instance the response document is check for errors accordingly - this method will die if errors are found in the document as specified by the options.
WWW::Mechanize XML::LibXML File::Temp
Please report any bugs you find via the CPAN RT system.
Copyright Fotango 2006. All rights reserved.
This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
Barry White <bwhite@fotango.com>
To install WWW::Mechanize::XML, copy and paste the appropriate command in to your terminal.
cpanm
cpanm WWW::Mechanize::XML
CPAN shell
perl -MCPAN -e shell install WWW::Mechanize::XML
For more information on module installation, please visit the detailed CPAN module installation guide.