I want get the value between the open/close tags.
In this example all the field are inside the tag "PARAM " where the name is different.
Following, one of the xml examples. in this particular case, my objective is read the "21" in name="project_id".
XML sctructure:
<test>
<MESSAGE type="Update" />
<PARAMETERS>
<PARAM name="project_id">21</PARAM>
<PARAM name="project_name">000000003|teste name project</PARAM>
<PARAM name="enabled">true</PARAM>
<PARAM name="start_time">2019,02,01,00,00,00</PARAM>
<PARAM name="end_time">2020,09,30,00,00,00</PARAM>
<PARAM name="created_in">admin</PARAM>
</PARAMETERS>
</test>
At this moment i have this xPath:
/*[local-name()='ULM' and namespace-uri()='']/*[local-name()='PARAMETERS' and namespace-uri()='']/*[local-name()='PARAM' and namespace-uri()=''][1]/@*[local-name()='name'and namespace-uri()='']
This xPath, only returns "project_id" but i need the value.
I already try using several xPaths, but only return the "project_id"(text).
Can someone give me a tip or indicate some article?
Thanks
xPath-Tester : https://www.freeformatter.com/xpath-tester.html#ad-output
Can someone give a tip?
From your sample, the following XPath expression work :
//*[name()="PARAM" and @*[name()="name"]="project_id"]/text()
Output : 21
Replace name() with local-name() if errors occur.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With