For a given Element, I want to check whether the xsi:nil attribute is set to true.
My current code is
xsinil = dataFact.get('{http://www.w3.org/2001/XMLSchema-instance}nil', False)
But instead of being True xsinil is of type string…
What’s the best solution? I don’t think this is very elegant:
xsinil=dataFact.get('{http://www.w3.org/2001/XMLSchema-instance}nil', False)
if xsinil == 'true' or xsinil == '1' :
xsinil = True
This looks nicer:
It assigns
Truetoxsinilvariable only if result ofgetfunction is one ofTrue,'true'or'1'.