When trying to initialise an XDocument with a string containing XML, I kept getting the error:
Unhandled Exception: System.ArgumentException: Non white space characters cannot be added to content.
With help from a colleague, and recalling how I'd got around this error previously, the solution is to use the static XDocument.Parse( string ) method. Eg:
var myXDoc = XDocument.Parse( xmlString );
Friday, 14 January 2011
Subscribe to:
Post Comments (Atom)
3 comments:
Brilliant! Exactly what I needed. Cheers.
@Awesome..Thank you
brilliant
Post a Comment