XElement & UTF-8 Issue

EDN Admin

Well-known member
Joined
Aug 7, 2010
Messages
12,794
Location
In the Machine
I have a .NET Web Service(.asmx, not .svc) that accepts a string via HTTP POST. The strings it accepts are xml infosets I then parse via XElement.Parse. Once parsed into an XElement instance, I add a node to one of the elements within the instance.
The problem Im having is that if a string representing an xml infoset comes through with then for some reason, me adding a node to the element XElement throws an exception such as " , hexadecimal value 0x06, is an invalid character. Line 1, position 40.".
I get a wide array of 0x(*) errors thrown. If I dont attempt to add nodes to the XElement, everythings fine. Heres how Im adding the element:
<pre>
Code:
var prospect = doc.Element("prospect");
var provider = prospect.Element("provider");

provider.Add(new XElement("id",
  new XAttribute("reservation-code",
  reservationCode)
));
[/code]
Is there some sort of string conversion I ought to be doing somewhere? <hr class="sig Blades Dont Need Reloading...

View the full article
 
Back
Top