It's straightforward to store XML in an application configuration setting if you've serialized it as XML text, e.g. to save it, assuming that myXmlDocument
is an XmlDocument
:
Properties.Settings.Default.MyXmlSkeleton = myXmlDocument.OuterXml;
and to retrieve it:
myXmlDocument.LoadXml(Properties.Settings.Default.MyXmlSkeleton);
But you won't readily to be able to change the XML by editing the configuration file, since it will be stored as XML text, e.g.:
value='<MyXmlDocument/>'
That's probably not a problem, because you're probably not going to want to edit the application configuration file to change the XML anyway - there's far too much risk of introducing well-formedness errors if you do that.
Generally, though, I find that this isn't the right approach; I'll either load the XML from the file system at runtime and store the path to the XML document in the configuration file, or I'll include the XML as a string resource.