I am trying to store an xml value in my app.config file.
The app.config does not like this and I cannot use the <![CDATA[
construct to ignore the XML'ness of my value.
Is there a way to do it?
Value example:<FieldRef Name='LinkfileName' Nullable='True'/><FieldRef Name='Web' Nullable='True'/>
The primary motivation for using XML-based configuration is to be able to configure different instances of the same object in different ways. For example, with a single XML configuration file, you can specify different options for different applications.
You can save an XML document as text in an attribute value if you escape the character entities:
<FieldRef Name="Linkfilename" ...
You can then use XmlDocument.Load() to parse the text value.
Note that this won't work for your example because your value is an XML document fragment and not a well-formed XML document. You either need to wrap it in an enclosing document element (whose markup will still be escaped) or use a properly-initialized XmlReader to process the value once you've retrieved it from the configuration.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With