Sto cercando di ottenere un elenco di elementi con un tipo xsd specifico con lxml 2.x e non riesco a capire come attraversare xsd per tipi specifici.Trova elementi basati su xsd type con lxml
Esempio di schema:
<xsd:element name="ServerOwner" type="srvrs:string90" minOccurs="0">
<xsd:element name="HostName" type="srvrs:string35" minOccurs="0">
Esempio di dati xml:
<srvrs:ServerOwner>John Doe</srvrs:ServerOwner>
<srvrs:HostName>box01.example.com</srvrs:HostName>
La funzione ideale sarebbe simile:
elements = getElems(xml_doc, 'string90')
def getElems(xml_doc, xsd_type):
** xpath or something to find the elements and build a dict
return elements