I am having a problem to reach vc:minVersion
from xsd file.
Part of xsd:
<?xml version="1.0" encoding="utf-8"?>
<xs:schema id="lbs"
elementFormDefault="qualified"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:vc="http://www.w3.org/2007/XMLSchema-versioning"
rb:version="0.2"
vc:minVersion="1.1"
>
<!-- main -->
<xs:element name="lbs">
<xs:complexType>
<xs:sequence>
<xs:element name="header">
My code:
import lxml.etree as ET
dom = ET.parse(u'/lbs.xsd')
rootxml = dom.getroot()
nss = rootxml.nsmap
for subtag in rootxml.xpath(u'//minVersion', namespaces=nss):
#do something
print(subtag)
Code shows nothing, when I expect to get "1.1" as answer. Please help :)
CodePudding user response:
If namespaces are used it should be
//@vc:minVersion
Ignoring namespaces it would be
//@*[local-name()="minVersion"]