Monday, March 25, 2013

XPATH definition without tag prefix

This problem is encountered when you search in the xml where you do not know the source behavior. I have come across in XSD search of Web Service WSDL. In particular tag prefix usage varies according to different web services. As an example;



First Definition:
<xsd:schema>

</xsd:schema>

Second Definiton:
<s:schema>

</s:schema>

To ignore the tag prefix in XPATH query; local-name() function must be used:
//*[local-name() = 'schema']/

instead of
//xsd:schema/

So your xpath query detached from tag prefix.

For further information about XPATH functions...

I use xpatherizernpp for XPATH check, a plug in for Notepad++

No comments:

Post a Comment