Hi ExpertALL,
I need support, check the source and target structures.
Source structure below:
Target structure:
As you can see the structure "item" it´s unbound, means repeat many times, inside <item> there is a tag <TYPE> that´s cointains two values "S" or "E".
Check the part of request XML below:
<T_RETURN> <item> <TYPE>S</TYPE> <MESSAGE>Lote baixado com sucesso !!!</MESSAGE> <MESSAGE_V1>AC13033621</MESSAGE_V1> <SYSTEM/> </item> <item> <TYPE>E</TYPE> <MESSAGE>ERROR!</MESSAGE> <MESSAGE_V1>AC13033622</MESSAGE_V1></item> <item> <TYPE>S</TYPE> <MESSAGE>Lote baixado com sucesso !!!</MESSAGE> <MESSAGE_V1>AC13033623</MESSAGE_V1></item> <item> <TYPE>E</TYPE> <MESSAGE>ERROR!</MESSAGE> <MESSAGE_V1>AC13033624</MESSAGE_V1></item></T_RETURN>
What I need to do, when the value of tag <TYPE> only once comes with value "E", I need insert value "1" into tag <ERROR> in response structure.
If contains only "S" leave <ERROR>blank</ERROR>
Like this exemple below:
<?xml version="1.0" encoding="UTF-8"?><ns1:MT_OUTPUT xmlns:ns1="zurn:greefa.fischer"> <E_EMAIL>xpto@teste.com</E_EMAIL> <RESPOSTA> <TYPE>S</TYPE> <MESSAGE_V1>AC13033621</MESSAGE_V1> </RESPOSTA> <RESPOSTA> <TYPE>E</TYPE> <MESSAGE_V1>AC13033622</MESSAGE_V1> </RESPOSTA> <RESPOSTA> <TYPE>S</TYPE> <MESSAGE_V1>AC13033623</MESSAGE_V1> </RESPOSTA> <RESPOSTA> <TYPE>S</TYPE> <MESSAGE_V1>AC13033624</MESSAGE_V1> </RESPOSTA> <ERROR>1</ERROR></ns1:MT_OUTPUT>
Suggestions ?
Kind regards,
Ricardo Viana.