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

I need to get a remote HTML document in my application and parse some parts of it. Since I don't want to play with parsing, which would be a lot of work, I thought about using XSLT, which would allow me to create a small XML document from HTML, and then easily read it.

Doesn't Android seem to have XSLT support? What other ways could I parse HTML without parsing the content as a simple string?

+3
source share
1 answer

I was thinking about using XSLT, which would allow me to create a small XML document from HTML, and then easily read it.

Hardly. Most HTML is invalid XML.

What other ways can I parse HTML without parsing the content as a simple string?

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

+2
source

Source: https://habr.com/ru/post/1761910/


All Articles