wpf - Reading XML from resource -


i trying read xml resource return error. here code;

string s = properties.resources.myxmlfile; xdocument x = xdocument.load(s); 

the error message follows;

an exception of type 'system.argumentexception' occurred in mscorlib.dll not handled in user code  additional information: illegal characters in path. 

stepping through code can see xml file in string s. opening file both in vs , other xml parsers file not give errors. why error occurring?

xdocument.load() expects string containing path xml file argument. if have xml content string, should use xdocument.parse() instead :

string s = properties.resources.myxmlfile; xdocument x = xdocument.parse(s); 

Comments

Popular posts from this blog

commonjs - How to write a typescript definition file for a node module that exports a function? -

openid - Okta: Failed to get authorization code through API call -

thorough guide for profiling racket code -