What's the best way to validate an XML file against an XSD file?

前端 未结 13 1297
滥情空心
滥情空心 2020-11-22 07:37

I\'m generating some xml files that needs to conform to an xsd file that was given to me. What\'s the best way to verify they conform?

相关标签:
13条回答
  • 2020-11-22 08:41

    We build our project using ant, so we can use the schemavalidate task to check our config files:

    <schemavalidate> 
        <fileset dir="${configdir}" includes="**/*.xml" />
    </schemavalidate>
    

    Now naughty config files will fail our build!

    http://ant.apache.org/manual/Tasks/schemavalidate.html

    0 讨论(0)
提交回复
热议问题