Java Android使用RSS提要的DOM解析器解析HTML实体
我正在为我正在构建的Android应用程序使用google books api。这是XML文件的一个示例Java Android使用RSS提要的DOM解析器解析HTML实体,java,android,html-parsing,rss,domparser,Java,Android,Html Parsing,Rss,Domparser,我正在为我正在构建的Android应用程序使用google books api。这是XML文件的一个示例 <dc:description>This trilogy includes &quot; The Hitchhiker&#39;s Guide to the Galaxy&quot; , &quot; TheRestaurant at the End of the Universe&quot; , &
<dc:description>This trilogy includes &quot; The Hitchhiker&#39;s Guide to the Galaxy&quot; , &quot; TheRestaurant at the End of the Universe&quot; , &quot; Life, Universe and Everything&quot; and &quot; So Long ...</dc:description>
<dc:format>590 pages</dc:format>
<dc:format>book</dc:format>
问题是,当使用HTML.fromHtml(Str)函数时,它会在第一个HTML实体处截断文本(因此在本例中,它只表示
这部三部曲包括
当我在Android之外运行相同的代码时,它工作正常,并且至少显示带有转义字符的字符串,即
This trilogy includes " The Hitchhiker's Guide to the Galaxy" , " TheRestaurant at the End of the Universe" , " Life, Universe and Everything" and " So Long ...
如果我随后手动将其添加到应用程序中,HTML.fromHtml()工作正常,因此我猜问题在于Android对解析器的实现
类似的问题是。我已经尝试将工厂的验证设置为false,由于它是一个RSS提要,我无法声明HTML根元素(如本文所建议的)。我最终没有从Google获得描述数据,但我认为运行normalise()可以解决这个问题关于document元素,我在另一个API上遇到了类似的问题,并且解决了它。我也遇到了同样的问题,您能解释一下“normalise()”是什么意思吗?
This trilogy includes " The Hitchhiker's Guide to the Galaxy" , " TheRestaurant at the End of the Universe" , " Life, Universe and Everything" and " So Long ...