You used
next if 0 == index( $_, '<breakfast_menu>' );
That would fail if it the serialization has any attributes or a prefix. Also, it completely ignores the namespace. The correct way to do the check outside of the XPath:
next if $_->nodeName eq "breakfast_menu" && !defined( $_->namespaceURI );
In reply to Re^2: XML::LibXML parentNode only root element
by ikegami
in thread XML::LibXML parentNode only root element
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |