C#: Line information when parsing XML with XmlDocument

后端 未结 2 546
忘掉有多难
忘掉有多难 2021-01-12 10:32

What are my options for parsing an XML file with XmlDocument and still retain line information for error messages later on? (as an aside, is it possible to do the same thing

2条回答
  •  情书的邮戳
    2021-01-12 10:59

    The only other option I know of is XDocument.Load(), whose overloads accept LoadOptions.SetLineInfo. This would be consumed in much the same way as an XmlDocument.

    Example

提交回复
热议问题