I've just checked the specifications of how it should be and it is, indeed, a bug. Although I don't know if it's a libxml2 bug or a bug in the Perl bindings to it (i.e. XML::LibXML).
Either way, you should report it to the authors. But I don't know if it's still maintained, since the last update happened in 2004.