lxml xpath expression for selecting all text under a given child node including his children
- 阅读更多 关于 lxml xpath expression for selecting all text under a given child node including his children
问题 Provided I have a XML as follows: <node1> <text title='book'> <div chapter='0'> <div id='theNode'> <p xml:id="40"> A House that has: <p xml:id="45">- a window;</p> <p xml:id="46">- a door</p> <p xml:id="46">- a door</p> its a beuatiful house </p> </div> </div> </text> </node1> I would like to locate text title and get all the text from the first p tag appearing inside the text title book node so far I know: from lxml import etree XML_tree = etree.fromstring(XML_content,parser=parser) text =