Hi,
Why isn’t the item after the Deserialize XML activity going into For Each?
XMLCode.txt (1.8 KB)
Testt.xaml (34.6 KB)
RPA TEST.xlsx (10.7 KB)
Hi,
Why isn’t the item after the Deserialize XML activity going into For Each?
XMLCode.txt (1.8 KB)
Testt.xaml (34.6 KB)
RPA TEST.xlsx (10.7 KB)
we would recommend that you will handle properly the XML namespaces
I did not understand the problem here. Can you help me?
Your soap XML is defining namespaces and should handle it as described in the LINK.
For a more fast help just let us know the requirements / what you want to achieve in general with the XML. But tell us the task not what was tried as e.g. prefix replaces are leading more to XY Problems and are off from requirement
As already mentioned above: SOAP XML will have the need to handle XML Namespaces (as described in the attached link)
the provided sample XML:
<?xml version="1.0" encoding="ISO-8859-9"?>
<soapenv:Envelope
xmlns:soapenv="aaaaaaa"
xmlns:tem="bbbbbbbbb/">
<soapenv:Header/>
<soapenv:Body>
<ns9:getOpenInvoicesbyKeyResponse
xmlns:ns9="ccccccccccc">
<result>
<bankId>1111</bankId>
<compId>2222</compId>
<curr>3333</curr>
<errMsg>Yes</errMsg>
<invCount>4444</invCount>
<invoceList>
<anyType
xmlns:ns5="5555"
xmlns:xsi="6666" xsi:type="7777">
<controlId>8888</controlId>
<dueDate>2020311</dueDate>
<invAmount>99.99</invAmount>
<invNo>0123456789</invNo>
<invType>00000</invType>
<msisdn>9876543210</msisdn>
<nameSurname>dddddd eeeee</nameSurname>
<orderNo>88</orderNo>
<payAmount>1111</payAmount>
<period>202111</period>
<remark>000</remark>
</anyType>
</invoceList>
<msgDate>1213003550</msgDate>
<orig>
<branch>8888</branch>
<city>0</city>
<teller>1</teller>
<user>XXXX9999</user>
</orig>
<queryKey>gsmNo</queryKey>
<queryKeyValue>951753</queryKeyValue>
<respCode>00</respCode>
<stan>800111</stan>
</result>
</ns9:getOpenInvoicesbyKeyResponse>
</soapenv:Body>
</soapenv:Envelope>
has no elments with the name: FaturaNo,IslemReferansNo
So there is nothing to loop by xd_XmlCode.Root.Descendants(GD.ToString)
You can cross check
I added the new code.
<?xml version="1.0" encoding="ISO-8859-9"?>
<soapenv:Envelope
xmlns:soapenv="aaaaaaa"
xmlns:tem="bbbbbbbbb/">
<soapenv:Header/>
<soapenv:Body>
<ns9:getOpenInvoicesbyKeyResponse
xmlns:ns9="ccccccccccc">
<result>
<bankId>1111</bankId>
<compId>2222</compId>
<curr>3333</curr>
<errMsg>Yes</errMsg>
<invCount>4444</invCount>
<invoceList>
<anyType
xmlns:ns5="5555"
xmlns:xsi="6666" xsi:type="7777">
<controlId>8888</controlId>
<dueDate>2020311</dueDate>
<invAmount>99.99</invAmount>
<invNo>0123456789</invNo>
<invType>00000</invType>
<msisdn>9876543210</msisdn>
<faturaNo>456789123</faturaNo>
<IslemRefenrasNo>9514753</IslemReferansNo>
<nameSurname>dddddd eeeee</nameSurname>
<orderNo>88</orderNo>
<payAmount>1111</payAmount>
<period>202111</period>
<remark>000</remark>
</anyType>
</invoceList>
<msgDate>1213003550</msgDate>
<orig>
<branch>8888</branch>
<city>0</city>
<teller>1</teller>
<user>XXXX9999</user>
</orig>
<queryKey>gsmNo</queryKey>
<queryKeyValue>951753</queryKeyValue>
<respCode>00</respCode>
<stan>800111</stan>
</result>
</ns9:getOpenInvoicesbyKeyResponse>
</soapenv:Body>
</soapenv:Envelope>
did some corrections on the XML
Verifying the Namespace needs (we assume that a different result can occur, once the real namespaces are applied, but chan be checked similar)
(good thing, we do not need here)
retrieve the IslemRefenrasNo elements xDoc.Descendants(“IslemRefenrasNo”)
e.g used for the each
Retrieve value, update value:
in your case loop variable name is item: item.Value = “NewValue String”, done within an assign
check the update:
Ok
Fazit:
I’m getting an error in the for each activity. What should I write in GD for each? I do not understand.
which error?
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.