Subject: | Crash on call to attributes() |
Perl v5.12.2 MSWin32-x86-multi-thread
MINGW32_NT-6.1 1.0.17(0.48/3/2) 2011/04-24 23:39 1686 Msys
Sometimes, LibXML will crash when attributes() is called on a node.
(In attached, set LIST_ATTRIBUTES to 0 and it runs fine. Set
LIST_ATTRIBUTES to 1 and it crashes.)
Subject: | test-xml-2.pl |
#!/usr/bin/perl
use strict;
my $LIST_ATTRIBUTES = 1;
sub dump_xml {
my ($root, $depth) = @_;
print $root, "\n";
printf ("%sName:%s hasAttr(%s) Attr(%s)\n",
" "x$depth, $root->nodeName, $root->hasAttributes,
(join (' ', $LIST_ATTRIBUTES ? $root->attributes() : ('skip'))));
foreach my $kid ($root->childNodes()) { dump_xml ($kid, $depth + 1); }
}
use XML::LibXML;
my $doc = new XML::LibXML->parse_string ('<?xml version="1.0"?><!DOCTYPE doc [ <!ENTITY nbsp " "> ]><doc></doc>');
dump_xml ($doc, 1);