I need to parse a file .xsd in Python as i would parse an XML.
I am using libxml2.
I have to parse an xsd that look as follow:
<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 with
doc.xpathEval('//xs:complexType/xs:sequence/xs:element[@name="IeplcHeader"]'):
tells me that cannot find the path.
while if i remove all the xs: as follow
<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>
in this way it works
doc.xpathEval('//complexType/sequence/element[@name="IeplcHeader"]'):
Does anyone knows how can i get read of this problem fixing a prefix? righ now i am preparsing the file removing the xs: but it's an orrible solution and i really hope to be able to find a better solution.
(I did not try with py-dom-xpath yet and i do not know if may work even with the xs:)
thanks, ste