Created 09-26-2017 09:52 AM
I have nifi processor EvaluateXpath and i want to get tags value from xml response , for it i use expression like this //count/text()
but my count attribute is still empty , what should i change? my xml reponse is something like this, AND I WANT TO GET THIS 72 AND WRITE IT IN MY COUNT ATTRIBUTE .
<SendMessagexmlns=""><EnvelopeVersion>2.0</EnvelopeVersion><Header><MessageDetails><Class></Class><Qualifier>response</Qualifier><Function></Function><CorrelationID></CorrelationID><ResponseEndPoint/></MessageDetails><SenderDetails><IDAuthentication/><EmailAddress/></SenderDetails></Header><MessageDetails/><Body><Messagexmlns=""><getEventDataResponsexmlns=""xmlns:ns2=""xmlns:ns3=""xmlns:ns4=""><count>72</count></Message>
Created 09-26-2017 01:11 PM
Is this the right XML you have copied here? It is not a valid XML.
Created 09-26-2017 01:26 PM
yes but it isn't my whole response i mean i have copied only the part in which is count tag
Created on 09-26-2017 06:58 PM - edited 08-17-2019 10:35 PM
Hi @sally sally, if you are extracting only one value to attribute then its easy to use
ExtractText processor:-
by adding new property to it by adding regex like below.
<count>(.*)<\/count>
ExtractText Processor configs:-
This regex only captures the value in <count></count> message and adds an attribute count to the flowfile.