skrapeit / skrape.it

A Kotlin-based testing/scraping/parsing library providing the ability to analyze and extract data from HTML (server & client-side rendered). It places particular emphasis on ease of use and a high level of readability by providing an intuitive DSL. It aims to be a testing lib, but can also be used to scrape websites in a convenient fashion.
https://docs.skrape.it
MIT License
805 stars 59 forks source link

[QUESTION] Preserve element order while parsing #147

Closed Neitex closed 3 years ago

Neitex commented 3 years ago

describe what you want to archive I want to parse some timetable web page, so right ordering of elements while parsing is crucial. It seems that skrape{it} does not keep order of elements. Is it somehow possible to parse HTML while preserving order of elements as they appear in HTML?

christian-draeger commented 3 years ago

It should already. Depending on your selector it will Traverse the Dom and return matching ordered as list.

could you provide some example code that show-case the issue? :)

Nevertheless I will do some testing regarding the order if I am back home (in a few hours). I am also pretty sure that this is tested multiple times in unit and integration tests. I will check I am back to keyboard as well

Neitex commented 3 years ago

I'm sorry for taking your time. It seems that I somehow messed something up in my code, so it wasn't ordered right. Thank you and, again, sorry.

christian-draeger commented 3 years ago

No problem, here to help. Just Let me know if you find issues or have questions :)