in reply to Re^2: XML::LibXML getElementsById problem
in thread XML::LibXML getElementsById problem

Why don't you use a regular XPath expression instead of getElementsById? my $elem = ($doc->findnodes('//*[@id="test"]'))[0]; works fine. It is probably slower than using getElementsById but it might not matter. Or you could select all elements with the attribute id and replace it by xml:id, and hope (I would think it works) that getElementsById then works. Or you could pre-process your HTML using tidy for example to get XHTML, and then use XML::LibXML on the XHTML (you might need to set the option to process the DTD in order for id to be recognized as an ID).

There might also be an XML::LibXML specific trick for this, but I don't know the module that well.