Knowledge Partner
Knowledge Partner
300 views

Is it possible to dynamically specify a name space in Policy?

I have a policy that is parsing incoming SOAP.  We try to use local-name() whenever possible, but we seem stuck, pre-defining all possible namespaces in advance in the Policy.  The goal was a more generic solution. 

 

Is it possible in the middle of a running policy to add a name space definition, after it begins running? 

 

So I want to test for XPATH in the incoming doc.  It has a namespace defined on a node.  I either:

1) Specify the nameSpace in the XPATH test/select.

2) Use local-name()="NodeNameWithoutNS"

But I find if I don't define all the namespaces in the <policy> node before the policy runs, some parts (I forget which, I am revisting the issue again but not 100% up on this specific).

 

BUt I was thinking if i could make a Java call to define a namespace in the current memory/policy context it seems like I could find the namespaces and declare them all to save on this issue.

 

Labels (1)
Tags (1)
0 Likes
5 Replies
Knowledge Partner
Knowledge Partner

Re: Is it possible to dynamically specify a name space in Policy?

Hi Geoffrey,

What highest version of XPATH you able to use in your code?

I had a conversation with one of the vendors of the XML tool product.

He mentioned about Q syntax, available in XPATH 3.1

The Q{} syntax only works in XPath 3.1. Select it in the toolbar in the XPath view.
Instead of "prefix:element" you can also use "Q{namespace}:element". For example:

//Q{urn:com.workday/bsvc}Get_Workers_Response
or
//Q{urn:com.workday/bsvc}*

 

It doesn't work for me (too much overhead), but maybe it will work for you 

0 Likes
cpedersen Outstanding Contributor.
Outstanding Contributor.

Re: Is it possible to dynamically specify a name space in Policy?

It has been a very sour point for a very long time that IDM only support up to xPath 1.0 + plus stuff. The plus stuff are a few functions which they decided to include from xPath 2.0.

Having xPath 3.1 would be a massive way forward, as it would give us functionality like 'match', also they could include xQuery (awesome).

But sadly... no such luck, as MF has decided that we do not need this.

Cheers,
Casper

0 Likes
Knowledge Partner
Knowledge Partner

Re: Is it possible to dynamically specify a name space in Policy?

Hi Casper,

Do you know what "plus" stuff from XPath 2.0 are available?

Thanks

0 Likes
cpedersen Outstanding Contributor.
Outstanding Contributor.

Re: Is it possible to dynamically specify a name space in Policy?

Sadly I do not. 

0 Likes
Knowledge Partner
Knowledge Partner

Re: Is it possible to dynamically specify a name space in Policy?

Shon said that XPATH 2 breaks 1.0 backwards compatability.

Now, they demonstrated the Rhino Javascript approach where there is an ECV that controls which version runs. Seems like they could do a phased upgrade where newest and 1.0 are supported and you can control per driver which is in use and then swap till you fix all your xpath.

 

The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.