XML Deserialize won't work because of xmlns attribute

Hi humans,
I need your help, please!
I am trying to extract the data from simple XML (below).
I am trying to use either
xmlDeserialized.Element(soap+“Envelope”).Element(soap+“Body”).Element(“GetDocumentXMLResponse”).Element(“GetDocumentXMLResult”).Element(“GetDocumentResponse”).Element(“GetDocumentResult”).Value

(Where ‘soap’ is an XNamespace and xmlDeserialized is XDocument)
or
xmlDeserialized.Root.Descendants(“GetDocumentXMLResult”).Value

Both methods work, BUT ONLY IF I manually remove the attribute xmlns=“http://tempuri.org/” (replace it with an empty string). There must be a better way to handle this issue. The attribute must be very common.
Thanks a lot! V.
image

Hi,

xmlns="http://tempuri.org/" means default XML namespace.
So can you try the following?

Regards,

1 Like

Everything works now.
Thanks a lot! God Bless You.
V.

1 Like

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