Getting data from xml respose in nifi -
after strating invokehttp processor response data that:
<response xmlns=""> <result> <responsestatus>false</responsestatus> <error> <errorcode>-7</errorcode> <errordescription>not foudn</errordescription> </error> </result> </response> i needed value of errorcode (-7) have added evaluatexpath processor attribute errorcode used command //error/errorcode/text() can't reitreive data of errorcode in attribute errorcode( in flowfile after processing evaluatexpath errorcode attribute doesn't have value ,is empty string) how can value of errrorcode?
to extract desired value, use xpath expression //errorcode. return string value -7. selecting destination flowfile-attribute, can keep flowfile content constant , put new value in flowfile attribute (i.e. named attribute).
you can chain matched relationship updateattribute processor has expression ${attribute:tonumber()} convert numerical representation, i.e. ${attribute:tonumber():plus(10)} return 3.
wiki


Comments
Post a Comment