Parsing HTML in Android: no XSLT? What to use?

2019-04-11 19:36发布

In need in my application to fetch remote HTML document and parse some parts out of it. As I don't want to play with string parsing, which would be really lots of work, I thought about using XSLT, which would let me build small XML document out of HTML and then read it easy.

Seems there is no XSLT support in Android? What other ways I could parse HTML without parsing content as simple string directly?

1条回答
Lonely孤独者°
2楼-- · 2019-04-11 19:53

I thought about using XSLT, which would let me build small XML document out of HTML and then read it easy.

Unlikely. Most HTML is not valid XML.

What other ways I could parse HTML without parsing content as simple string directly?

To parse HTML, you use an HTML parser. There are several open source ones, and it is reasonably likely that one or more will work on Android with few modifications if any.

查看更多
登录 后发表回答