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:
我知道ASP.net中的web.config解析器不是一个合适的XML解析器,并且在一些有效的XML构造上失败了,但我想知道反过来是否正确:
Are (valid) web.config files always valid XML Files and thus readable by an XML parser?
(有效)web.config文件是否始终是有效的XML文件,因此可由XML解析器读取?
(I need to manipulate them programatically and would prefer to use XPath, but that requires a valid XML Document)
(我需要以编程方式操作它们,并且更喜欢使用XPath,但这需要有效的XML文档)
1 个解决方案
#1
6
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).
我以前在配置文件上使用过Linq to XML,XPath和XmlDocument,除非配置文件本身不好(在这种情况下,应用程序无法检索配置设置),否则从未出现过XML解析问题。
So, in short, yes, they should always be readable by an XML parser.
所以,简而言之,是的,它们应始终可由XML解析器读取。
#1
6
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).
我以前在配置文件上使用过Linq to XML,XPath和XmlDocument,除非配置文件本身不好(在这种情况下,应用程序无法检索配置设置),否则从未出现过XML解析问题。
So, in short, yes, they should always be readable by an XML parser.
所以,简而言之,是的,它们应始终可由XML解析器读取。