How to check for valid xml in string input before calling .LoadXml()

后端 未结 5 506
一个人的身影
一个人的身影 2020-11-30 05:48

I would much prefer to do this without catching an exception in LoadXml() and using this results as part of my logic. Any ideas for a solution that doesn\'t in

5条回答
  •  失恋的感觉
    2020-11-30 05:54

    If catching is too much for you, then you might want to validate the XML beforehand, using an XML Schema, to make sure that the XML is ok, But that will probably be worse than catching.

提交回复
热议问题