I need to parse the .xsd file in Python as I will parse the XML.
I am using libxml2.
I need to parse xsd, which looks like this:
<xs:complexType name="ClassType">
<xs:sequence>
<xs:element name="IeplcHeader">
<xs:complexType>
<xs:sequence>
<xs:element name="device-number" type="xs:integer" fixed="1"/>
</xs:sequence>
<xs:attribute name="version" type="xs:integer" use="required" fixed="0"/>
</xs:complexType>
</xs:element>
when i access using
doc.xpathEval('//xs:complexType/xs:sequence/xs:element[@name="IeplcHeader"]'):
tells me that he cannot find the way.
and if I delete all xs: as it should
<complexType name="ClassType">
<sequence>
<element name="IeplcHeader">
<complexType>
<sequence>
<element name="device-number" type="xs:integer" fixed="1"/>
</sequence>
<attribute name="version" type="xs:integer" use="required" fixed="0"/>
</complexType>
</element>
that way it works
doc.xpathEval('//complexType/sequence/element[@name="IeplcHeader"]'):
Does anyone know how I can read this problem with prefix fix? righ now I am preparing a file that removes xs: but this is an orrible solution, and I really hope to find a better solution.
(I haven't tried with py-dom-xpath yet, and I don't know if it can even work with xs :)
thanks Ste
source
share