Red Hat Bugzilla – Bug 837204
%pom_xpath_remove does not work with simple queries
Last modified: 2014-01-12 19:27:21 EST
pom files use a default namespace. XPath does not work well with default namespaces, and simple queries like
do not work at all. it is necessary to use functions which are complicated and unreadable
%pom_xpath_remove "*[local-name() = 'environment' and namespace-uri() = 'http://maven.apache.org/POM/4.0.0']/*[local-name() = 'os' and not(text() = 'linux')]
Implicit POM namespace can't be easily implemented because of XPath limitations.
POM namespace has to be specified explicitly for every node.
The expression from comment #1 could be written as:
%pom_xpath_remove "pom:environment/pom:os[not(text() = 'linux')]"
(or similar) which is much better, but yet not perfect. As far as I know
the pom: prefix can't be easily eliminated from XPath expressions.
To clarify this, the following comment was added upstream:
# NOTE: POM files use a specific namespace - http://maven.apache.org/POM/4.0.0.
# The easiest way to respect this namespace in XPath expressions is prefixing
# all node names with "pom:". For example, "pom:environment/pom:os" will work
# because it selects nodes from pom namespace, but "environment/os" won't find
# anything because it looks for nodes that don't belong to any XML namespace.
jpackage-utils-1.7.5-18.1.fc17 has been submitted as an update for Fedora 17.
jpackage-utils-1.7.5-18.1.fc17 has been pushed to the Fedora 17 stable repository. If problems still persist, please make note of it in this bug report.