Does Deserialize Contain XML Value?

Hi,
In the loop, I update the value I read from the excel cell in xml. But I need help on how to check if the data I read from excel cell is the value sought in xml.

For example, the XML code below does not contain the <“test”> tag. I want to check if it contains <“test”> tag.

<?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>
1 Like

Hi @ridvanucok ,

If you want to find if text exists in particular contest or not, you can use Is Match? activity and you will get output as Boolean.

Thanks
Likith.

1 Like

Hey @ridvanucok

You can do it in two ways,

  1. String contains

  2. XML namespace contains

Hope this helps

Thanks
#nK

1 Like

we would recommend to do a first check on only local name. So we do not have handle unknown namespaces.

grafik
xdoc.Descendants().Any(Function (x) x.Name.LocalName.tolower.equals(strElementNameVar.toLower))

3 Likes

I am working with function for the first time. What is the reason for the error here?

would you be so kind and share the validation message with us. Thanks

1 Like

@ppr,
I shared the validation message. Thanks for your help.

I updated the variable type to boolean and updated the name of the variable specified as xdoc to my code. @ppr Thank you very much for your help.

xd_Data.Descendants().Any(Function (x) x.Name.LocalName.tolower.equals(str_Deger.ToString.toLower))

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.