![](/img/trans.png)
[英]How can I remove non-breaking spaces from a JSoup 'Document'?
[英]How can I get the non-breaking spaces between two nodes when using a node visitor?
我嘗試解析以下 HTML 源代碼:
<a href="./">Home</a>
<a href="http://gouessej.wordpress.com/tag/tuer/">Blog</a>
我實現了接口org.jsoup.select.NodeVisitor
。 但是,它似乎跳過了</a>
和<a
之間的內容。 禁用漂亮的打印並不能解決我的問題。
You can run the first JUnit test to reproduce this bug: https://github.com/gouessej/HtmlFlow/blob/patch-1/src/test/java/htmlflow/flowifier/test/TestFlowifier.java It converts the HTML source code of my homepage into Java source code, it converts this Java source code back to HTML and it compares the resulting HTML source code to the original source code.
PS:實際上TextNode.getWholeText()
返回\n
而不是 \n
。
TextNode.getWholeText()
返回一些未轉義的文本,我只需要通過調用Entities.escape(TextNode.getWholeText())
來轉義它。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.