Suppose, I have the following 3 kinds of XML files:
file1.xml
<memberdef>
<param>
<type>abc12300xyz__param -> type</type>
</param>
</memberdef>
file2.xml
<memberdef>
<param>
<type>abc12300xyz__param -> type</type>
<declname>abc12300xyz__param -> declname</declname>
</param>
</memberdef>
file3.xml
<memberdef>
<param>
<type>
<ref refid="abc12300xyz__refid" kindref="abc12300xyz__kindref">abc12300xyz -> ref</ref>
</type>
<declname>abc12300xyz__param -> declname</declname>
</param>
</memberdef>
Suppose, I want to read these three files using LXML.
How do I know/test which file is loaded?
For instance, when either file1.xml
or file2.xml
are loaded, the following source code fails:
if memberdef.param.type.ref != None:
... ... ...
... ... ...
What tactic should I use in this case?