查找具有特定后代和特定后代属性的元素属性

时间:2019-07-05 09:24:51

标签: python-3.x

xml_content=
    <record record_id = "1">
        <level level_id = "0">
            <format format_id ="2"/>
            <number number_id ="3"/>
        </level>
    </record>
    <record record_id = "2">
        <level level_id = "a">
            <format format_id ="b"/>
            <number number_id ="c"/>
        </level>
    </record>      

如何使用xpath在以下子元素条件下提取元素的record_idlevel_id = "0", format_id = "2" and number_id = "3"?

输出应为1(即第一个元素的record_id)

0 个答案:

没有答案