changed implementation to use XML::LibXML