简体   繁体   English

python xml 使用 xsd 文件进行验证

[英]python xml validation with xsd file

Every year or so someone seems to ask the same question.每年左右似乎都会有人问同样的问题。 Is there a good Python library to validate xml files comparing them to an xsd schema?是否有一个好的 Python 库来验证 xml 文件将它们与 xsd 模式进行比较? The closest I've found is suggestions involving lxml, which unfortunately is not pure python (based on a few C libraries)我发现的最接近的是涉及 lxml 的建议,不幸的是它不是纯 python (基于一些 C 库)

I would be surprised to find any pure Python XSD validation libraries.我会惊讶地发现任何纯 Python XSD 验证库。 I am aware of the following alternatives for CPython, but they all depend on non-Python code:我知道 CPython 的以下替代方案,但它们都依赖于非 Python 代码:

I've used XSV for this.我为此使用了 XSV It's about four years since any active dev, but it works.自任何活跃的开发人员以来大约四年,但它有效。

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

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