且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

使用XMLPullParser解析包含html标记的内容

更新时间:2023-11-05 09:05:46

XmlPullParser用于处理XML.很少会遇到在网络上结构良好的XHMTL页面. XML解析器期望格式很好的数据,并且不应容错.另一方面,HTML通常是松散组织的.

XmlPullParser is meant to deal with XML. It's really rare to encounter XHMTL pages that are well structured on the web. An XML Parser would expect very well formatted data and is not supposed to be fault tolerant. On the other hand, HTML is usually loosely organized.

所以,不,这不是一个好主意.您应该更喜欢其他库,例如 tagsoup

So, no, it's not a good idea. You should prefer other libraries like tagsoup or geronimo.

PS:当您问一个栈溢出问题时,***的方法是自己尝试一些操作,如果被阻止,则提出要求.并非如此.

PS : and the best when you ask a stack over flow question is to try something by yourself and, if blocked, then ask. Not the other way around.