Subject: | Issue parsing namespace declarations |
This i probably an error on my behalf - do you have a suggestion as to
why the snipplet below doesn't work?
use XML::DOM2;
my $xml = XML::DOM2->new(
data => '<top xmlns:xdc="http://www.xml.com/books">content</top>'
);
What I get is:
Does not have a self object for some reason
at /usr/local/share/perl/5.10.0/XML/DOM2/DOM/NameSpace.pm line 38
XML::DOM2::DOM::NameSpace::localName('XML::DOM2::Attribute::Namespace=HASH(0x1ac58f0)') called at /usr/local/share/perl/5.10.0/XML/DOM2/Attribute/Namespace.pm line 71
XML::DOM2::Attribute::Namespace::ns_prefix('XML::DOM2::Attribute::Namespace=HASH(0x1ac58f0)') called at /usr/local/share/perl/5.10.0/XML/DOM2/DOM/Element.pm line 627
XML::DOM2::DOM::Element::setAttributeNS('XML::DOM2::Element::Document=HASH(0x16a86a8)', 'XML::DOM2::Attribute::Namespace=HASH(0x1ac58f0)', 'xdc', 'http://www.xml.com/books') called at /usr/local/share/perl/5.10.0/XML/DOM2/DOM/Document.pm line 284
XML::DOM2::DOM::Document::createNamespace('XML::DOM2=HASH(0x1593760)',
'xdc', 'http://www.xml.com/books') called at
/usr/local/share/perl/5.10.0/XML/DOM2/Parser.pm line 110
XML::DOM2::Parser::start_element('XML::DOM2::Parser=HASH(0x16bf580)',
'HASH(0x1ac06a8)') called at /usr/share/perl5/XML/SAX/Base.pm line 293
XML::SAX::Base::start_element('XML::SAX::Expat=HASH(0x192e278)',
'HASH(0x1ac06a8)') called at /usr/share/perl5/XML/SAX/Expat.pm line 225
XML::SAX::Expat::_handle_start('XML::Parser::Expat=HASH(0x1963fa0)',
'xdc:top', 'xmlns:xdc', 'http://www.xml.com/books') called at
/usr/lib/perl5/XML/Parser/Expat.pm line 474
XML::Parser::Expat::parse('XML::Parser::Expat=HASH(0x1963fa0)',
'<xdc:top xmlns:xdc="http://www.xml.com/books">content</top>') called at
/usr/lib/perl5/XML/Parser.pm line 187
eval {...} called at /usr/lib/perl5/XML/Parser.pm line 186
XML::Parser::parse('XML::Parser=HASH(0x19571e0)', '<xdc:top
xmlns:xdc="http://www.xml.com/books">content</top>') called at
/usr/share/perl5/XML/SAX/Expat.pm line 60
XML::SAX::Expat::_parse_string('XML::SAX::Expat=HASH(0x192e278)',
'<xdc:top xmlns:xdc="http://www.xml.com/books">content</top>') called at
/usr/share/perl5/XML/SAX/Base.pm line 2602
XML::SAX::Base::parse('XML::SAX::Expat=HASH(0x192e278)',
'HASH(0x192e098)') called at /usr/share/perl5/XML/SAX/Base.pm line 2655
XML::SAX::Base::parse_string('XML::SAX::Expat=HASH(0x192e278)',
'<xdc:top xmlns:xdc="http://www.xml.com/books">content</top>') called at
/usr/local/share/perl/5.10.0/XML/DOM2.pm line 103
XML::DOM2::parseDocument('XML::DOM2', 'data', '<xdc:top
xmlns:xdc="http://www.xml.com/books">content</top>') called at
/usr/local/share/perl/5.10.0/XML/DOM2.pm line 80
XML::DOM2::new('XML::DOM2', 'data', '<xdc:top
xmlns:xdc="http://www.xml.com/books">content</top>') called at - line 2
Removing the namespace declaration makes the snipplet work:
use XML::DOM2;
my $xml = XML::DOM2->new(
data => '<top>content</top>'
);
The issue was found in version 0.06 run with perl v5.10.0 built for
x86_64-linux-gnu-thread-multi.