Check if XML Element exists

后端 未结 13 1625
傲寒
傲寒 2020-12-03 06:20

How can someone validate that a specific element exists in an XML file? Say I have an ever changing XML file and I need to verify every element exists before reading/parsing

13条回答
  •  一生所求
    2020-12-03 07:15

    You can validate that and much more by using an XML schema language, like XSD.

    If you mean conditionally, within code, then XPath is worth a look as well.

提交回复
热议问题