简体   繁体   中英

Are web.config files always valid XML?

I know that the web.config parser within ASP.net is not a proper XML parser and fails on some valid XML constructs, but I wonder if the reverse is true:

Are (valid) web.config files always valid XML Files and thus readable by an XML parser?

(I need to manipulate them programatically and would prefer to use XPath, but that requires a valid XML Document)

I've used Linq to XML, XPath, and XmlDocument on config files in the past, and there's never been an XML parsing problem unless the config file itself was bad (and in that case, the application couldn't retrieve configuration settings).

So, in short, yes, they should always be readable by an XML parser.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM