I have tested various libraries like Jquery, Parse5, and JsDom, but unfortunately they are not compatible with nativescript. Jquery relies on the DOM, while Parse5 and JsDom require Node.js which is currently not supported by nativescript. I am in need of an HTML parser only; is it feasible to incorporate jquery into nativescript as an HTML parser? If so, how can I achieve this? If not, is there a user-friendly HTML parser available for use in Nativescript (With Angular2 + TypeScript)?
Here are some details about my project: I am building a mobile app for Moodle using nativescript. The app interacts with Moodle through its REST API, and receives HTML string content. Therefore, I require an HTML parser to extract information from these HTML strings.
For instance, when I send a "mod_quiz_get_attempt_data" request to Moodle, I receive a JSON response like the following:
{"questions": [ { "slot": 1, "type": "multichoice", "page": 0, "html": "Html string here. Can be very complex. Unfortunately, stackoverflow does not allow posting HTML strings.", } ] }
The necessary data is within the "html" section, which contains the HTML string. Since Moodle is a third-party platform, I prefer handling this parsing within my app.
Mentioned users: @Marek Maszay, @Emil Oberg
@Emil Oberg, I attempted to use Cheerio but faced issues. Cheerio depends on htmlparser2, which also requires Node.js.