views:

1577

answers:

1

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'/>

+4  A: 

You can save an XML document as text in an attribute value if you escape the character entities:

&lt;FieldRef Name=&quot;Linkfilename&quot; ...

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.

Robert Rossney