Xml response tag toupper

Hello all!

I have the following expression, to check if an invoice is present within one of the tags in the response:

xdoc.Root.Descendants(xnamespace+“INVOICE”).Any(Function (x)x.Value.ToUpper.Trim.Equals(InvoiceExtracted))

now, very simply, I capitalize (toupper) the value of my variable, the problem is if the content of the response is not capitalized, how do I change the expression so that the content of the INVOICE tag is also capitalized and avoid mismatch?

Thanks in advance


It might not be very good solution, however how about to convert it to uppercase before de-serializing, as the following?

strXML = System.Text.RegularExpressions.Regex.Replace(strXml,"(?i)(?<=</?)invoice","INVOICE")

This assumes there is no element which starts with invoice except “invoice”

Edit: the following expression may be better



1 Like

so there is no way to convert the value present in the tag after deserializing it?

The only possibility is to do a replace via regex?


after deserializing it?

Can you try the following expression?

xDoc.Root.Descendants().Where(Function(x) x.Name.LocalName.ToUpper="INVOICE").Any(Function (x)x.Value.ToUpper.Trim.Equals(InvoiceExtracted))