问题描述
使用 lxml 我正在尝试使用 XSD 验证 XML 文档。
问题: 该架构继承自另一个架构,并且(可能)因为文件不是本地文件,所以我收到一条错误消息。
架构来源: https://github.com/IHEC/ihec-ecosystems/tree/master/schemas/xml
使用的架构:
- SRA.experiment.xsd
- SRA.sample.xsd
两者都继承自:
- SRA.common.xsd
问题:是否可以将 SRA.experiment.xsd 和 SRA.sample.xsd 分别与 SRA.common.xsd 合并?
这是使用其中一种架构的示例:
import lxml.etree
from urllib.request import urlopen
xsd = urlopen("https://raw.githubusercontent.com/IHEC/ihec-ecosystems/master/schemas/xml/SRA.sample.xsd").read()
schema = lxml.etree.XMLSchema(lxml.etree.fromstring(xsd))
错误:
Traceback (most recent call last):
File "delme.py",line 5,in <module>
schema = lxml.etree.XMLSchema(lxml.etree.fromstring(xsd))
File "src/lxml/xmlschema.pxi",line 88,in lxml.etree.XMLSchema.__init__
lxml.etree.XMLSchemaParseError: complex type 'SampleType',attribute 'base': The QName value '{SRA.common}ObjectType' does not resolve to a(n) simple type deFinition.,line 17
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)