XML-Crawler
view release on metacpan or search on metacpan
t/XML-Crawler.t view on Meta::CPAN
<!-- Generated from data/scripts.php, ../../smarty/{scripts.tpl} -->
<div id="w3c_scripts"><script type="text/javascript" src="/2008/site/js/main">
//<![CDATA[
<!-- -->
//]]>
</script></div>
</body>
</html>
END_XML
my @expect = (
'#document',
{ 'html' => undef },
[
['html'],
[
'html',
{
'xmlns' => 'http://www.w3.org/1999/xhtml',
'lang' => 'en',
'xml:lang' => 'en'
},
[
[ '#comment', ' Generated from data/head-home.php, ../../smarty/{head.tpl} ' ],
[
'head',
[
[ 'title', 'World Wide Web Consortium (W3C)' ],
[
'meta',
{
'http-equiv' => 'Content-Type',
'content' => 'text/html; charset=utf-8'
}
],
[
'link',
{
'rel' => 'Help',
'href' => '/Help/'
}
],
[
'link',
{
'rel' => 'stylesheet',
'media' => 'handheld, all',
'href' => '/2008/site/css/minimum',
'type' => 'text/css'
}
],
[
'style',
{
'media' => 'print, screen and (min-width: 481px)',
'type' => 'text/css'
},
[ '
/*',
[
'#cdata-section',
'*/
@import url("/2008/site/css/advanced");
/*'
],
'*/
'
]
],
[
'link',
{
'rel' => 'stylesheet',
'media' => 'handheld, only screen and (max-device-width: 480px)',
'href' => '/2008/site/css/minimum',
'type' => 'text/css'
}
],
[
'meta',
{
'content' => 'width=device-width',
'name' => 'viewport'
}
],
[
'link',
{
'rel' => 'stylesheet',
'media' => 'print',
'href' => '/2008/site/css/print',
'type' => 'text/css'
}
],
[
'link',
{
'rel' => 'shortcut icon',
'href' => '/2008/site/images/favicon.ico',
'type' => 'image/x-icon'
}
],
[
'meta',
{
'content' => 'The World Wide Web Consortium (W3C) is an international community where Member organizations, a full-time staff, and the public work together to develop Web standards.',
'name' => 'description'
}
],
[
'link',
{
'rel' => 'alternate',
'href' => '/News/atom.xml',
'title' => 'W3C News',
'type' => 'application/atom+xml'
} ] ]
],
[
'body',
{
t/XML-Crawler.t view on Meta::CPAN
[
'sup',
"\x{ae}"
],
' (',
[
'a',
{ 'href' => 'http://www.csail.mit.edu/' },
[ [
'acronym',
{ 'title' => 'Massachusetts Institute of Technology' },
'MIT'
] ]
],
', ',
[
'a',
{ 'href' => 'http://www.ercim.eu/' },
[ [
'acronym',
{ 'title' => 'European Research Consortium for Informatics and Mathematics' },
'ERCIM'
] ]
],
',
',
[ 'a', { 'href' => 'http://www.keio.ac.jp/' }, 'Keio' ],
') ',
[
'a',
{
'href' =>
'/Consortium/Legal/2002/ipr-notice-20021231'
},
'Usage policies
apply'
],
'.'
] ] ] ] ]
],
[
'#comment',
' /end #footer '
],
[
'#comment',
' Generated from data/scripts.php, ../../smarty/{scripts.tpl} '
],
[
'div',
{ 'id' => 'w3c_scripts' },
[ [
'script',
{
'src' => '/2008/site/js/main',
'type' => 'text/javascript'
},
[ '
//',
[
'#cdata-section',
'
<!-- -->
//'
] ] ] ] ] ] ] ] ] ] );
xml_to_ra_ok( $xml, \@expect, 'ginourmous XML document' );
}
sub xml_to_ra_ok {
my ( $xml, $expect, $desc ) = @_;
local $Test::Builder::Level = $Test::Builder::Level + 1;
my $got = XML::Crawler::xml_to_ra($xml);
my $ok = is_deeply( $got, $expect, $desc );
=for exclude
if ( not $ok ) {
u s e Data::Dumper;
local $Data::Dumper::Terse = 1;
warn '$got => ', Dumper( $got );
warn '$expect => ', Dumper( $expect );
}
=cut
return $ok;
}
( run in 1.102 second using v1.01-cache-2.11-cpan-39bf76dae61 )