lxml

xpath

尋找符合某個 屬性值 的 下層元素

e.xpath('descendant::div[@id="xxx"]')

尋找符合某個 屬性值 的 上層元素

e.xpath('ancestor::div[@id="xxx"]')

尋找同一層在自己後面的所有 node (含文字節點)

e.xpath('following-sibling::node()')