Match to XML
Version: 1.1
Category: Input
Extended Category: XML
Action Package: Standard Actions
Description
Find an object in an XML file and add new Session Attributes from the matched XML object. The match is made using XPath and can contain Session Attribute value(s).
Each element in the XML file that should be added as a Session Attribute must be defined using XPath.
Parameter |
Description |
Example |
XML File |
The XML file path. |
c:\xmlfiles\file.xml |
XPath for Match |
XPath to the object root element. |
/users/user[uid=”SESSION(userid)”] |
XML attribute mapping |
Comma separated list of XPath to XML element paired with name of Session Attribute. This XPath must be relative to the root element found in the match. |
/@name|fullname,/phone|phone |
Use Cases
XML-file:
<system> <user id='abc123'> <givenname>John</givenname> <lastname>Smith</lastname> <title>Administrator</title> <telephone> <value>012-345678</value> <value>012-987543</value> </telephone> </user> <user id='def456'> <givenname>Jane</givenname> <lastname>Smith</lastname> <title>Engineer</title> <telephone> <value>014-546379</value> <value>014-634050</value> </telephone> </user> </system>
Example 1: Match to a user object using child element
This action will match the name in the Session Attribute ‘givenname’ with any ‘user’ element in the XML file that contains a child node ‘givenname’ with a matching name. For the found ‘user’ elements, Session Attributes for the attributes ‘id’ and the elements ‘telephone’ and ‘title’ will be created.
Action configuration:
Parameter |
Value |
XML File |
c:\xmlfiles\file.xml |
XPath for Match |
/system/user[givenname=”SESSION(givenname)”] |
XML attribute mapping |
./@id|uid,./telephone/value|telephonenumber,./title|title |
Session Object attributes before the action has run:
givenname |
John |
Session Object attributes after the action has run in a Policy:
givenname |
John |
uid |
abc123 |
telephoneNumber |
012-345678 012-987543 |
title |
Administrator |
Example 2: Match to a user object using attribute value
This action will match the user id in the Session Attribute ‘uid’ with any ‘user’ element in the XML file that contains an attribute ‘id’ with a matching value. For the found ‘user’ elements, Session Attributes for the elements ‘telephone’, ‘givenname’ and ‘lastname’ will be created.
Action configuration:
Parameter |
Value |
XML File |
c:\xmlfiles\file.xml |
XPath for Match |
/system/user[@id=”SESSION(uid)”] |
XML attribute mapping |
./givenname|givenname,./lastname|lastname,./telephone/value|telephonenumber |
Session Object attributes before the action has run:
uid |
abc123 |
Session Object attributes after the action has run in a Policy:
uid |
abc123 |
givenname |
John |
lastname |
Smith |
telephoneNumber |
012-345678 012-987543 |
Example 3: Match multiple objects
This action will match the lastname in the Session Attribute ‘lastname’ with any ‘user’ element in the XML file that contains an attribute ‘lastname’ with a matching value. For the found ‘user’ elements, Session Attributes for the elements ‘givenname’ will be created.
Action configuration:
Parameter |
Value |
XML File |
c:\xmlfiles\file.xml |
XPath for Match |
/system/user[lastname=”SESSION(lastname)”] |
XML attribute mapping |
./givenname|givenname |
Session Object attributes before the action has run:
lastname |
Smith |
Session Object attributes after the action has run in a Policy:
DISCLAIMER
Information provided in this document is for your information only. PhenixID makes no explicit or implied claims to the validity of this information. Any trademarks referenced in this document are the property of their respective owners.The origin of this information may be internal or external to PhenixID. PhenixID makes all reasonable efforts to verify this information.
PhenixID - support.phenixid.se