System Tools and Scripting Plugins → FileUtils Plugin → Update XML File with XPath Step
This step updates XML files using XPath to locate items to edit.
Required properties:
Property Name | Description |
---|---|
Include Files |
Specify a new-line-separated list of of file/directory patterns to include. Pattern Matching Rules: * matches zero or more characters ? matches one character ** matches zero or more directories Examples: *.java - matches .java, x.java, and FooBar.java ?.java - matches x.java, A.java **/*.txt - matches all txt files recursively **/CVS/* - matches all files in CVS directories anywhere in the directory tree org/apache/jakarta/** - matches all files in the org/apache/jakarta directory tree org/apache/**/CVS/* - matches all files in CVS directories anywhere in the in the directory tree under org/apache/ **/test/** - matches all files that have a test element in their path, including test as a filename |
Optional properties:
Property Name | Description |
---|---|
Directory Offset | A subdirectory of the current working directory where the step is to execute |
Exclude Files | Specify a new-line-separated list of file/directory patterns to exclude. Pattern matching rules are the same as those listed in Include Files. |
Replace with Text |
Specify a new-line-separated list of XPath expression->replacement pairs. Example: /root/foo/@bar->my_bar looks for the all foo elements under the root element and replaces their bar attribute value with my_bar. This does nothing if the attribute bar does not exist. |
Remove | A new-line-separated list of XPath
expressions for elements to remove.
Example: /root/foo removes all elements foo under the root element. |
Insert XML |
Specify a new-line-separated list of XPath expression->content pairs. Example: /root/foo-><bar/> looks for the all foo elements under the root element and inserts an empty child element bar. |
Set Attributes |
Specify a new-line-separated list of XPath expression->replacement pairs. Example: /root/foo/@bar->my_bar looks for all foo elements under the root element and replaces their bar attribute value with my_bar. The XPath expression must end with the /@name of the attribute to insert or update and contain a -> separator to denote the value. |
Fail if No Match Found | Select here for the step to fail if any of the XPath expressions do not return a match. |
Copyright © 2013–2019 Micro Focus or one of its affiliates. All rights reserved.