I am using XML::LibXML to parse an XML doc. I would like to use XPaths to get values of different nodes and attributes. findnodes(...) API seems to work for nodes (ex: root/head/node1 ) but it gives an error "invalid expression" for XPaths with attrbiutes (ex: root/head/node1/@att1 where att1 is an attribute of node node1).
I'd like to use a "common" API that would "find" AND "get the value of" XPaths irrespective of whether the XPath is pointing to a node or an attribute. Could someone give me an API that'd work generically both for nodes AND attributes without having to handle them separately in my code?