pom_xpath_set - Man Page

set contents of XML node from XML file

Synopsis

%pom_xpath_set XPath new-contents [XML-file-location]

Description

This macro patches specified POM file replacing contents of all XML nodes described by the XPath expression with given new text content. This works on both elements and attributes.

XPath is an expression describing a set of XML nodes to be removed from the POM file. It must be a properly formated XPath 1.0 expression, as described in http://www.w3.org/TR/xpath/.

Maven POM files use specific XML namespace http://maven.apache.org/POM/4.0.0 as default. This namespace needs to be explicitly specified in XPath expressions by prefixing all node names with pom (i.e. pom:modelVersion).

Many other XML formats also use namespaces which you have to explicitly specify. This script will use the namespace prefix names from the xmlns declarations in the document’s root element. So if the document begins with <root xmlns:my="myurl.com"> you would select the root node with XPath expression /my:root. If the document specifies a default namespace (eg xmlns="myurl.com") use the prefix named default to acces elements in that namespace.

XML location can be either a full path to the XML, or a path to the directory containing pom.xml or ivy.xml. If XML location is not given then pom.xml or ivy.xml from current working directory is used. When both pom.xml and ivy.xml are present, pom.xml is processed. You can specify more file locations.

Author

Written by Mikolaj Izdebski.

Reporting Bugs

Bugs should be reported through Java Packages Tools issue tracker at Github: https://github.com/fedora-java/javapackages/issues.

See Also

pom_add_dep(7), pom_add_parent(7), pom_add_plugin(7), pom_disable_module(7), pom_remove_dep(7), pom_remove_parent(7), pom_remove_plugin(7), pom_set_parent(7), pom_xpath_inject(7), pom_xpath_remove(7), pom_xpath_replace(7).

Referenced By

pom_add_dep(7), pom_add_parent(7), pom_add_plugin(7), pom_change_dep(7), pom_disable_module(7), pom_remove_dep(7), pom_remove_parent(7), pom_remove_plugin(7), pom_set_parent(7), pom_xpath_disable(7), pom_xpath_inject(7), pom_xpath_remove(7), pom_xpath_replace(7).

02/16/2024 JAVAPACKAGES Java Packages Tools