Failure : Change process failed - Falied to set the value on target XML file. Review the log for more information
Symptom
ERROR -> Change :: HandelError -> Received exception: CyberArk.Extensions.FileMgmtUtils.FileObjectsException: Falied to set the value on target XML file. Review the log for more information
Failure : Change process failed - Falied to set the value on target XML file. Review the log for more information
Environment
Privileged Access Manager (PAM, self-hosted) Central Policy Manager (CPM)
Cause
The XML may be set with a "default" or "unregistered" namespace. As a result the namespace cannot be referenced by a name. It is null. This makes it so that xpath syntax cannot reference the elements that they normally would since the elements are in a namespace, but the namespace has no name.
For example: <catalog xlmns="cat101"> versus <catalog xmlns:cat="cat101"> or <book xlmns="bk101"> versus <book xmlns:bk="bk101">
Resolution
Use the name() function to get the element in the default namespace to then reference it.
To find the <price> element of "bk102" in the XML below, we could use the following XPath (XML Element):
//*[name()="book" and @xlmns="bk102"]/*[name()="price"]
<?xml version="1.0"?>
<catalog xlmns="cat101">
<book xlmns="bk101">
<author>Gambardella, Matthew</author>
<title>XML Developer's Guide</title>
<genre>Computer</genre>
<price>44.95</price>
<publish_date>2000-10-01</publish_date>
<description>An in-depth look at creating applications
with XML.</description>
</book>
<book xlmns="bk102">
<author>Ralls, Kim</author>
<title>Midnight Rain</title>
<genre>Fantasy</genre>
<price>5.95</price>
<publish_date>2000-12-16</publish_date>
<description>A former architect battles corporate zombies,
an evil sorceress, and her own childhood to become queen
of the world.</description>
</book>
<book xlmns="bk103">
<author>Corets, Eva</author>
<title>Maeve Ascendant</title>
<genre>Fantasy</genre>
<price>7.95</price>
<publish_date>2000-11-17</publish_date>
<description>After the collapse of a nanotechnology
society in England, the young survivors lay the
foundation for a new society.</description>
</book>
</catalog>
Additionally, the Select-XML Powershell cmdlet can be used to assist in determining the correct XPath for use with the XML Element value in the plugin. Users can alter the XPath and view the value returned.
For example:
Select-Xml -Path C:\temp\test.xml -XPath '//*[name()="book" and @xlmns="bk102"]/*[name()="price"]' | ForEach-Object { $_.Node.InnerXML }