我想使用 lxml.XMLSchema 针对 XSD 文件验证 XML 文件.但问题是 XSD 在 1.1 中.所以它不起作用.
I want validate an XML file against an XSD file using lxml.XMLSchema. But the problem is the XSD is in 1.1. So it doesn't work.
这是 XML 的一部分:
This is a part of the XML:
<?xml version="1.0" encoding="UTF-8"?>
<dictionary xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="!!assert.xsd">
<SizeType>10</SizeType>
</dictionary>
这是它的 XSD 文件:
And this is its XSD file:
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
elementFormDefault="qualified">
<xs:element name="SizeType">
<xs:simpleType>
<xs:restriction base="xs:integer">
<xs:assertion test="$value = 10"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
</xs:schema>
那么,是否可以针对使用 xs:assertion 语句 (1.1) 的 XSD 文件来验证 XML 文件?
So, is it possible to validate an XML file against a XSD file that uses xs:assertion statements (1.1)?
我认为这个问题与此密切相关:lxml with schema 1.1
I think this question is closely related to this: lxml with schema 1.1
截至 2013 年 11 月上旬,只有以下 XML 处理器支持 XSD 1.1:
As of early November 2013, only the following XML processors support XSD 1.1:
目前还没有用 Python 编写的可针对 XSD 1.1 进行验证的 XML 解析器.
There is no XML parser written in Python that validates against XSD 1.1 yet.
这篇关于是否可以在 Python 中针对 XSD 1.1 验证 XML 文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!
如何在python中的感兴趣区域周围绘制一个矩形How to draw a rectangle around a region of interest in python(如何在python中的感兴趣区域周围绘制一个矩形)
如何使用 OpenCV 检测和跟踪人员?How can I detect and track people using OpenCV?(如何使用 OpenCV 检测和跟踪人员?)
如何在图像的多个矩形边界框中应用阈值?How to apply threshold within multiple rectangular bounding boxes in an image?(如何在图像的多个矩形边界框中应用阈值?)
如何下载 Coco Dataset 的特定部分?How can I download a specific part of Coco Dataset?(如何下载 Coco Dataset 的特定部分?)
根据文本方向检测图像方向角度Detect image orientation angle based on text direction(根据文本方向检测图像方向角度)
使用 Opencv 检测图像中矩形的中心和角度Detect centre and angle of rectangles in an image using Opencv(使用 Opencv 检测图像中矩形的中心和角度)