Validating XML on XSD with the error line numbers

前端 未结 6 1031
盖世英雄少女心
盖世英雄少女心 2021-01-04 15:19

Is there any way to validate an XML file on an XSD schema with the output of the error line numbers?

The XmlReader reader doesn\'t allow line numbers, it shows only

6条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2021-01-04 16:00

    You can use XMLStarlet. That supports validating, and provides error line numbers:

    $ xml val -e --xsd file.xsd file.xml
    file.xml:8: Element 'atitle': This element is not expected. Expected is ( title ).
    file.xml - invalid
    

提交回复
热议问题