7
특정 xsd 유형의 요소 목록을 lxml 2.x와 함께 가져 오려고하는데 특정 유형의 xsd를 탐색하는 방법을 알 수 없습니다. 스키마의lxml을 사용하여 xsd 유형을 기반으로 요소를 찾습니다.
예 :
<xsd:element name="ServerOwner" type="srvrs:string90" minOccurs="0">
<xsd:element name="HostName" type="srvrs:string35" minOccurs="0">
예 XML 데이터 : 이상적인 기능의 모습
<srvrs:ServerOwner>John Doe</srvrs:ServerOwner>
<srvrs:HostName>box01.example.com</srvrs:HostName>
:
elements = getElems(xml_doc, 'string90')
def getElems(xml_doc, xsd_type):
** xpath or something to find the elements and build a dict
return elements