Cisco Support Community
cancel
Showing results for 
Search instead for 
Did you mean: 
New Member

Xpath and Get XML Document Data

Good Morning,

I have just recently gotten involved in a project that requires communicating with some web services (axis2). We have existing scripts that handle this already, but they were built when we weren't on axis2 so now the XML output from the web service call is slightly different and i am no longer able to use the same xpath statement in the Get XML Document Data step.

I am receiving either null values or a prefix namespace error. I am new to xpath and have been reading as best i can from http://www.w3schools.com/xpath/ to try and understand how to write my statements to pull out the data i want correctly.

I have read that sometimes the editor has problems if the XML contains namespace declarations, etc.

Below is an example XML output where I'd like to be able to read the value in the ax211:success. My xpath gets prefix namespace errors as it doesn't recognize ax211.

Xpath: /descendant::ns:validateCertificationResponse/child::ns:return/child::ax211:success

XML.JPG

Perhaps my xpath statement is just incorrect and wouldn't retrieve what i expect it to....

Any advice is appreciated.

Thanks,

Kevin

1 ACCEPTED SOLUTION

Accepted Solutions

Xpath and Get XML Document Data

Hi,

//*[local-name()="success"]/text() or just

//*[local-name()="success"]

G.

3 REPLIES

Xpath and Get XML Document Data

Hi,

//*[local-name()="success"]/text() or just

//*[local-name()="success"]

G.

New Member

Xpath and Get XML Document Data

//*[local-name()="success"]

Worked perfectly, while including the text() function returned null. - I guess because it's a boolean value field, not sure if theres a boolean() function.

So just to break this down....

// - selects all nodes

* will look through all element nodes

local-name()  - selects the element node without the namespace prefix being required.

Thanks again.

Xpath and Get XML Document Data

Hi,

well, it appears that text() is automatically appended to the XPath query for some reason in UCCX, this is why you actually see the text node within the ax211:success element. This //*[local-name()="success"] select the whole node, not its first child (which is actually the first element, which also happens to be a text).

Anyway,

// - anywhere

* - any node

And within this "everything" you actually search with the condition within the angular brackets.

G.

187
Views
0
Helpful
3
Replies
CreatePlease to create content