Established Member..
Established Member..

Using XPATH to query XML that contains a namespace definition



we have got problems while using XPATH with a XML document that contains a name space.




<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<flowInputParam xmlns="http://com.mycompany.prj/HPOO_flow_input_param">


XPATH using /flowInputParam/action


does not return a result.


However, if the xmls... attribute is omitted, then the XPATH returns the expected result.


Any ideas why XPATH does not work if xmlns... attribut is defined?


Many Thanks in Advance






Tags (2)
1 Reply
Absent Member.. Absent Member..
Absent Member..

Hello anschut,


I am Operations Orchestration representative, regarding your request please take a look the next information:


When you use the xmlns=" http://com.mycompany.prj/HPOO_flow_input_param" on the root element of your XML puts the root and its descendants in the http://com.mycompany.prj/HPOO_flow_input_param. This effectively means that all of the element names in your XML document are preceded by http://com.mycompany.prj/HPOO_flow_input_param. Therefore the elements stated in your XPath are not in the http://com.mycompany.prj/HPOO_flow_input_param namespace. Then, your XPath will not matches nothing.




Using xmlns:conf="URL" instead of “xmlns”,  the XPath will matches the element.






I hope this information help you, but if not doesn't hesitate to let me know and I will continue with my researches.

Kind Regards,


Sussan Zamora


If you find this or any post useful to resolve the issue, please mark this thread as correct answer and other members can benefit with the information given
Sussan Zamora
SW Support Technical Consultant
San Jose, Costa Rica
Hewlett Packard Enterprise “
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.