The question(s): Can a XPath 1.0 expression return only the names of xml nodes (either qualified or not) and not the entire node? Is XPath 2.0 capable of same?
The detail:
I am profiling a series of well-formed xml documents for xml element node usage (ie. obtain aggregate counts of xml nodes across several xml documents). I have a perl script that retrieves a desired node-set of each document, then iterates over each node to obtain counts of the node names using the XML::XPath::Node::Element->getName. I have an alternate implementation that profiles xml node attributes and text values, but use an XPath statement to retrieve the "atomic values" (as opposed to using XML::XPath::Node::Element->getAttribute() or similar in perl).
[Note that I realize the "atomic values" are actually sets of attribute/ text nodes.]
I experience a 50-fold improvement in performance when allowing the XPath expression to return the desired "atomic values" as opposed to looping over results in perl, so I would like to retrieve xml node names in a manner similar to attribute (ie 'attribute::' or '@')and text (ie 'text()') nodes. I've looked over the XPath and XML specs, but have not been able to identify a solution.
edit: To be more specific, I'm looking for something like 'local-name(//*)'
, but something that returns a set of names for all matching nodes (as opposed to only the first node found).