agorian

Commodore
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
2019-06-13
18:21
952 views
Help with xpath
Hi guys,
I need some help with xPath. I need the path (1a36b8dc5faa7a4d86b8830b4eacd6ab) text when component = "\TREE\Acme\Sistema\IDM\DriverSet01\IDM2AD"
This instance is inside a variable. I tried $variable/value[component[@name='volume']/text()='\TREE\Acme\Sistema\IDM\DriverSet01\IDM2AD']/component[@name='path'] and others different forms, but I can't either get the value node. Someone can help me?
I need some help with xPath. I need the path (1a36b8dc5faa7a4d86b8830b4eacd6ab) text when component = "\TREE\Acme\Sistema\IDM\DriverSet01\IDM2AD"
<instance class-name="User" qualified-src-dn="O=Acme\OU=Usuarios\OU=Funcionarios\CN=XXXXX" src-dn="\TREE\Acme\Usuarios\Funcionarios\XXXXX" src-entry-id="219290">
<attr attr-name="DirXML-Associations">
<value timestamp="1302221030#221" type="structured">
<component name="nameSpace">1</component>
<component name="volume">\TREE\Acme\Sistema\IDM\DriverSet01\SomeDriver</component>
<component name="path">01093037</component>
</value>
<value timestamp="1302260346#93" type="structured">
<component name="nameSpace">1</component>
<component name="volume">\TREE\Acme\Sistema\IDM\DriverSet01\Entitlement01</component>
<component name="path">{BEFB30D6-A4A1-435A-D492-D630FBBEA1A4}</component>
</value>
<value timestamp="1559849566#65" type="structured">
<component name="nameSpace">1</component>
<component name="volume">\TREE\Acme\Sistema\IDM\DriverSet01\AnotherDriver</component>
<component name="path">\TREE\Acme\Usuarios\Funcionarios\XXXXX</component>
</value>
<value timestamp="1559849566#60" type="structured">
<component name="nameSpace">1</component>
<component name="volume">\TREE\Acme\Sistema\IDM\DriverSet01\IDM2AD</component>
<component name="path">1a36b8dc5faa7a4d86b8830b4eacd6ab</component>
</value>
</attr>
</instance>
This instance is inside a variable. I tried $variable/value[component[@name='volume']/text()='\TREE\Acme\Sistema\IDM\DriverSet01\IDM2AD']/component[@name='path'] and others different forms, but I can't either get the value node. Someone can help me?
3 Replies
Anonymous_User

Absent Member.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
2019-06-13
19:07
On 6/13/2019 1:24 PM, agorian wrote:
>
> Hi guys,
>
> I need some help with xPath. I need the path
> (1a36b8dc5faa7a4d86b8830b4eacd6ab) text when component =
> "\TREE\Acme\Sistema\IDM\DriverSet01\IDM2AD"
>
>
> Code:
> --------------------
>
> <instance class-name="User" qualified-src-dn="O=Acme\OU=Usuarios\OU=Funcionarios\CN=XXXXX" src-dn="\TREE\Acme\Usuarios\Funcionarios\XXXXX" src-entry-id="219290">
> <attr attr-name="DirXML-Associations">
> <value timestamp="1302221030#221" type="structured">
> <component name="nameSpace">1</component>
> <component name="volume">\TREE\Acme\Sistema\IDM\DriverSet01\SomeDriver</component>
> <component name="path">01093037</component>
> </value>
> <value timestamp="1302260346#93" type="structured">
> <component name="nameSpace">1</component>
> <component name="volume">\TREE\Acme\Sistema\IDM\DriverSet01\Entitlement01</component>
> <component name="path">{BEFB30D6-A4A1-435A-D492-D630FBBEA1A4}</component>
> </value>
> <value timestamp="1559849566#65" type="structured">
> <component name="nameSpace">1</component>
> <component name="volume">\TREE\Acme\Sistema\IDM\DriverSet01\AnotherDriver</component>
> <component name="path">\TREE\Acme\Usuarios\Funcionarios\XXXXX</component>
> </value>
> <value timestamp="1559849566#60" type="structured">
> <component name="nameSpace">1</component>
> <component name="volume">\TREE\Acme\Sistema\IDM\DriverSet01\IDM2AD</component>
> <component name="path">1a36b8dc5faa7a4d86b8830b4eacd6ab</component>
> </value>
> </attr>
> </instance>
>
> --------------------
>
>
> This instance is inside a variable. I tried
> $variable/value[component[@name='volume']/text()='\TREE\Acme\Sistema\IDM\DriverSet01\IDM2AD']/component[@name='path']
> and others different forms, but I can't either get the value node.
It matters if you used Source/Dest Attr to get the value into the
variable, or did you use a Query token?
Read all about it here:
https://community.microfocus.com/t5/Identity-Manager-Tips/Using-XPATH-to-examine-Association-values/ta-p/1775403
>
> Hi guys,
>
> I need some help with xPath. I need the path
> (1a36b8dc5faa7a4d86b8830b4eacd6ab) text when component =
> "\TREE\Acme\Sistema\IDM\DriverSet01\IDM2AD"
>
>
> Code:
> --------------------
>
> <instance class-name="User" qualified-src-dn="O=Acme\OU=Usuarios\OU=Funcionarios\CN=XXXXX" src-dn="\TREE\Acme\Usuarios\Funcionarios\XXXXX" src-entry-id="219290">
> <attr attr-name="DirXML-Associations">
> <value timestamp="1302221030#221" type="structured">
> <component name="nameSpace">1</component>
> <component name="volume">\TREE\Acme\Sistema\IDM\DriverSet01\SomeDriver</component>
> <component name="path">01093037</component>
> </value>
> <value timestamp="1302260346#93" type="structured">
> <component name="nameSpace">1</component>
> <component name="volume">\TREE\Acme\Sistema\IDM\DriverSet01\Entitlement01</component>
> <component name="path">{BEFB30D6-A4A1-435A-D492-D630FBBEA1A4}</component>
> </value>
> <value timestamp="1559849566#65" type="structured">
> <component name="nameSpace">1</component>
> <component name="volume">\TREE\Acme\Sistema\IDM\DriverSet01\AnotherDriver</component>
> <component name="path">\TREE\Acme\Usuarios\Funcionarios\XXXXX</component>
> </value>
> <value timestamp="1559849566#60" type="structured">
> <component name="nameSpace">1</component>
> <component name="volume">\TREE\Acme\Sistema\IDM\DriverSet01\IDM2AD</component>
> <component name="path">1a36b8dc5faa7a4d86b8830b4eacd6ab</component>
> </value>
> </attr>
> </instance>
>
> --------------------
>
>
> This instance is inside a variable. I tried
> $variable/value[component[@name='volume']/text()='\TREE\Acme\Sistema\IDM\DriverSet01\IDM2AD']/component[@name='path']
> and others different forms, but I can't either get the value node.
It matters if you used Source/Dest Attr to get the value into the
variable, or did you use a Query token?
Read all about it here:
https://community.microfocus.com/t5/Identity-Manager-Tips/Using-XPATH-to-examine-Association-values/ta-p/1775403
agorian

Commodore
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
2019-06-14
16:53
Hi Geoffrey,
I'm using source attribute, but will follow the link you posted.
Thank you
I'm using source attribute, but will follow the link you posted.
Thank you


Knowledge Partner
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
2019-06-25
08:54
It matters if you used Source/Dest Attr to get the value into the variable, or did you use a Query token?
Read all about it here:
https://community.microfocus.com/t5/Identity-Manager-Tips/Using-XPATH-to-examine-Association-values/ta-p/1775403
I often find it helpful to trace nodeset variables in their serialized form while developing with something like this:
<do-set-local-variable name="trace" scope="policy">
<arg-string>
<token-xml-serialize>
<token-local-variable name="associations"/>
</token-xml-serialize>
</arg-string>
</do-set-local-variable>
This will result in the following trace:
Driver : Action: do-set-local-variable("associations",scope="policy",arg-node-set(token-src-attr("DirXML-Associations"))).
Driver : arg-node-set(token-src-attr("DirXML-Associations"))
Driver : token-src-attr("DirXML-Associations")
Driver : Query from policy
Driver :
<nds dtdversion="4.0" ndsversion="8.x">
<source>
<product version="4.7.1.0">DirXML</product>
<contact>NetIQ Corporation</contact>
</source>
<input>
<query class-name="User" dest-dn="o=dirXML Test\ou=Users\cn=User1" scope="entry">
<association>o=dirXML Test\ou=Users\cn=User1</association>
<read-attr attr-name="DirXML-Associations"/>
</query>
</input>
</nds>
Driver : Query from policy result
Driver :
<nds dtdversion="4.0" ndsversion="8.x">
<source>
<product version="4.7.1.0">DirXML</product>
<contact>NetIQ Corporation</contact>
</source>
<output>
<instance class-name="User" qualified-src-dn="O=Acme\OU=Usuarios\OU=Funcionarios\CN=XXXXX" src-dn="\TREE\Acme\Usuarios\Funcionarios\XXXXX" src-entry-id="219290">
<attr attr-name="DirXML-Associations">
<value timestamp="1302221030#221" type="structured">
<component name="nameSpace">1</component>
<component name="volume">\TREE\Acme\Sistema\IDM\DriverSet01\SomeDriver</component>
<component name="path">01093037</component>
</value>
<value timestamp="1302260346#93" type="structured">
<component name="nameSpace">1</component>
<component name="volume">\TREE\Acme\Sistema\IDM\DriverSet01\Entitlement01</component>
<component name="path">{BEFB30D6-A4A1-435A-D492-D630FBBEA1A4}</component>
</value>
<value timestamp="1559849566#65" type="structured">
<component name="nameSpace">1</component>
<component name="volume">\TREE\Acme\Sistema\IDM\DriverSet01\AnotherDriver</component>
<component name="path">\TREE\Acme\Usuarios\Funcionarios\XXXXX</component>
</value>
<value timestamp="1559849566#60" type="structured">
<component name="nameSpace">1</component>
<component name="volume">\TREE\Acme\Sistema\IDM\DriverSet01\IDM2AD</component>
<component name="path">1a36b8dc5faa7a4d86b8830b4eacd6ab</component>
</value>
</attr>
</instance>
</output>
</nds>
Driver : Token Value: {<value> @timestamp = "1302221030#221" @type = "structured",<value> @timestamp = "1302260346#93" @type = "structured",<value> @timestamp = "1559849566#65" @type = "structured",<value> @timestamp = "1559849566#60" @type = "structured"}.
Driver : Arg Value: {<value> @timestamp = "1302221030#221" @type = "structured",<value> @timestamp = "1302260346#93" @type = "structured",<value> @timestamp = "1559849566#65" @type = "structured",<value> @timestamp = "1559849566#60" @type = "structured"}.
Driver : Action: do-set-local-variable("trace",scope="policy",token-xml-serialize(token-local-variable("associations"))).
Driver : arg-string(token-xml-serialize(token-local-variable("associations")))
Driver : token-xml-serialize(token-local-variable("associations"))
Driver : token-xml-serialize(token-local-variable("associations"))
Driver : token-local-variable("associations")
Driver : Token Value: {<value> @timestamp = "1302221030#221" @type = "structured",<value> @timestamp = "1302260346#93" @type = "structured",<value> @timestamp = "1559849566#65" @type = "structured",<value> @timestamp = "1559849566#60" @type = "structured"}.
Driver : Arg Value: {<value> @timestamp = "1302221030#221" @type = "structured",<value> @timestamp = "1302260346#93" @type = "structured",<value> @timestamp = "1559849566#65" @type = "structured",<value> @timestamp = "1559849566#60" @type = "structured"}.
Driver : Token Value: "<value timestamp="1302221030#221" type="structured">
<component name="nameSpace">1</component>
<component name="volume">\TREE\Acme\Sistema\IDM\DriverSet01\SomeDriver</component>
<component name="path">01093037</component>
</value><value timestamp="1302260346#93" type="structured">
<component name="nameSpace">1</component>
<component name="volume">\TREE\Acme\Sistema\IDM\DriverSet01\Entitlement01</component>
<component name="path">{BEFB30D6-A4A1-435A-D492-D630FBBEA1A4}</component>
</value><value timestamp="1559849566#65" type="structured">
<component name="nameSpace">1</component>
<component name="volume">\TREE\Acme\Sistema\IDM\DriverSet01\AnotherDriver</component>
<component name="path">\TREE\Acme\Usuarios\Funcionarios\XXXXX</component>
</value><value timestamp="1559849566#60" type="structured">
<component name="nameSpace">1</component>
<component name="volume">\TREE\Acme\Sistema\IDM\DriverSet01\IDM2AD</component>
<component name="path">1a36b8dc5faa7a4d86b8830b4eacd6ab</component>
</value>".
...and reveal that your variable has a set of value nodes as it's contents, it's not an instance node as you would probably expect. Therefore you'd need to treat the variable as the value node:
Driver : Action: do-set-local-variable("path",scope="policy",token-xpath("$associations[component[@name='volume' and text()='\TREE\Acme\Sistema\IDM\DriverSet01\IDM2AD']]/component[@name='path']")).
Driver : arg-string(token-xpath("$associations[component[@name='volume' and text()='\TREE\Acme\Sistema\IDM\DriverSet01\IDM2AD']]/component[@name='path']"))
Driver : token-xpath("$associations[component[@name='volume' and text()='\TREE\Acme\Sistema\IDM\DriverSet01\IDM2AD']]/component[@name='path']")
Driver : Token Value: "1a36b8dc5faa7a4d86b8830b4eacd6ab".
Driver : Arg Value: "1a36b8dc5faa7a4d86b8830b4eacd6ab".
If you use token query, though, the variable contains one ore more instance nodes, in which case you'd have to use something like $var//value[component[...
______________________________________________
https://www.is4it.de/identity-access-management
https://www.is4it.de/identity-access-management