user27923437
user27923437

Reputation: 1

Convert XElement to string is failing when we have special char's in it. Any idea, how we can convert xelement to string?

I have an XElement which is having special char \u0002 in it and when I am doing XElement.ToString() its throwing error.

XElement Text:

Party B represents to Party A that it [is] [is not] a “financial end user” as such term is defined by the Commodity Futures Trading Commission (17 CFR §23.151).  If we have, or are putting in place, a regulatory compliant VM CSA with the counterparty, this provision is notrequired. In the situation where there is no regulatory compliant

c# code:

var str = xelement.ToString();

Exception:

System.ArgumentException: ''', hexadecimal value 0x02, is an invalid character.'

Let me know if any other workaround. I just wanted to convert complete xelement to base64 encoded value.

Upvotes: 0

Views: 24

Answers (0)

Related Questions