简体   繁体   English

使用 shell 脚本的 xml 模式验证

[英]xml schema validation using shell script

Is it possible to validate an XML file against a XML schema definition using shell script?是否可以使用 shell 脚本针对 XML 模式定义验证 XML 文件? Its easy to do with Java but can't find in the internet on how to get this done using shell script.使用 Java 很容易做到,但在互联网上找不到如何使用 shell 脚本完成此操作。

If you have it installed you can use xmllint --noout -schema [schema name] [file name]如果你安装了它,你可以使用xmllint --noout -schema [schema name] [file name]

More than likely you would need to either use a command line interface to a third party product, or write your own command to validate then call that from the shell.您很可能需要使用第三方产品的命令行界面,或者编写自己的命令进行验证,然后从 shell 调用它。

I don't know whether you will like it or not, but you can invoke a Java code from your shell script, and then you can use native API for validating an XML or other validations on data present in XML. I don't know whether you will like it or not, but you can invoke a Java code from your shell script, and then you can use native API for validating an XML or other validations on data present in XML.

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM