我正在使用Hpple來傳遞HTML文件。該HTML文件與以下內容非常相似。使用Hpple解析HTML
<div class="entry">
<p>some text here
<a>Inside a</a>
another text here
</p>
<div class="caption">
caption here
</div>
<p>Blah
</p>
</div>
我想看到的結果是「這裏有些文字在這裏另一個文本等等」(這忽略一切是標題股利和包括內部和之後的事情)
這裏有一些我」的查詢已經試過:
"//div[@class='entry']/p"
結果:"some text here"
"//div[@class='entry']//p"
結果:"some text here caption here Blah"
"//div[@class='entry']/p//text()"
結果:Nothing
感謝。
實際上,我發現了問題。代碼實際上是正確的,我使用「// div [@ class ='entry']/p」。但我無法從TFHppleElemnt中提取正確的內容。 – 2013-04-25 22:14:49
很高興你能工作! – Douglas 2013-04-25 22:42:43
感謝您的幫助,雖然 – 2013-04-26 21:35:49