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 = XML_tree.xpath('//text[@title="book"]/div/div/p/text()')
gets: "A house that has is a beautiful house"
But I would like also all the text of all the possible children and great children of the first
appearing under
basically; look for then look for the first
and give me all the text under that p tag whatever the nesting.
pseudo code:
text = XML_tree.xpath('//text[@title="book"]/... any number of nodes.../p/ ....all text under p')
Thanks.