Subject: | XML::DOM::Lite::Parser version 0.15 |
Date: | Mon, 02 Feb 2009 18:29:38 +0100 |
To: | bug-XML-DOM-Lite [...] rt.cpan.org |
From: | Sascha Singert <sascha.singert [...] swm-software.de> |
Hi,
i found a typo in XML::DOM::Lite::Parser line 169. Just try following code:
========================
my $xml = qq{
<config>
<menu>
<item id="hallo"></item>
<item id="welt" title="guck guck" />
<item id="blub">
<item id="hallo2"></item>
</menu>
</config>
};
my $doc = Parser->parse($xml);
my $node = $doc->getElementById('welt');
print $node->getAttribute('title');
========================
With the current version of XML::DOM::Lite $node is not defined
The bugfix/solution is very simple
* line 169 now
elsif ($elmnt =~ /($ElemTagCE)>$/o) {
* should be
elsif ($elmnt =~ /($ElemTagCE)$/o) {
The pattern within $ElemTagCE holds the ending > already, so it's not
needed in this line
greets
sascha
PS: very good and _simple_ module, gratulation