cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
1784
Views
0
Helpful
3
Replies

How to get the node value,if XML is having XMLNS

msivarami3
Level 1
Level 1

Hi,

Am facing some issue in XPATH query activity in TEO.My XML is having namespace in it.Am not able to get the element value.If i specified the path.

What is the need of namespace box with prefix and uri in the XPATH query tab.I have try all the combinations but no luck.Any idea on this please.

Thanks,

SRAMI. 

Attachment

3 Replies 3

Shaun Roberts
Cisco Employee
Cisco Employee

While I do not have time to fully test this. Those xmlns are causing the issue I believe. So (and I've done this before) if you cannot figure out the proper namespace, I just cut that part off before I feed in the source XML.

So I would do a replace string activity and then replace the top line with space and then replace the xmlns parts with space.

That would leave

with data, which should not require any special name spaces. This is one way to do it. Since I'm not too well versed in XML, this is a workaround, although I'm sure someone else could help with the XML side more.

-shaun

--Shaun Roberts
Principal Engineer, CX
shaurobe@cisco.com

I know it's bad form to simply say me too but I'm also butting head's with this. I want to match something using the default name space using xPath but it simply says it can't find anything. I think I have to somehow include the default name space URI but there's no clue how to do this as it demands a prefix.

Hi, all!

You should probably see my answer to Ryan's question (https://supportforums.cisco.com/thread/2170081?tstart=0).

Basically, when you see this namespace declaration xmlns=http://blah.com in an XML tag (notice that there is no prefix), it simply states that all tags below have this namespace. XML tags have 2 parts to their name a "local" name (what you usually see in the tag, for example ) and an optional namespace (sometimes you see the prefix of the namespace, e.g. and sometimes the namespace's prefix is omitted, as in this case, but the namespace is still defined).

Note that the prefix actually does not matter, and only URI does. So, is the same as and is the same as as long as a, x and mynamespace are defined as prefixes for exactly the same namespace URI.

So, if you have XML tag defined as with namespace URI for a defined as http://blah.com, you can search for it with a XPath query //b:vcloud, as long as prefix b has URI http://blah.com.

I hope my explanations make sense.

This link provides some background on XML namespaces: http://www.w3schools.com/xml/xml_namespaces.asp.

Svetlana

Review Cisco Networking for a $25 gift card