私は XML 初心者で、スキーマの解析に関して奇妙な問題を抱えています。実行できる最小限の例を次に示します。
#! /usr/bin/env python
from lxml import etree
from StringIO import StringIO
XML = StringIO('''<?xml version="1.0" encoding="ISO-8859-1" ?>
<xs:schema xmlns="http://www.w3.org/2001/XMLSchema"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">
<xs:import namespace="http://schemas.xmlsoap.org/soap/encoding/" />
<xs:complexType name="ArrayOfDocumentLink">
<xs:complexContent>
<xs:restriction base="soapenc:Array">
<xs:attribute ref="soapenc:arrayType" wsdl:arrayType="tns:DocumentLink[]"/>
</xs:restriction>
</xs:complexContent>
</xs:complexType>
</xs:schema>''')
etree.XMLSchema(file=XML)
与える
lxml.etree.XMLSchemaParseError: complex type 'ArrayOfDocumentLink', attribute 'base': The QName value '{http://schemas.xmlsoap.org/soap/encoding/}Array' does not resolve to a(n) simple type definition., line 7
私は無知です。さまざまなメーリング リストとこのSO の質問は、すべての定義を外部ファイルに収集することを含む回避策があることを示唆しています。しかし、それは初心者が何が起こっているのかを理解するのに本当に役立ちません. どんな洞察も大歓迎です!