RegEx or XPath parsing?

Hi,

I am building a public transport monitor. While every request to my local services web API is answered as JSON the final display is a simple 3 column HTML table. I now need to convert this so I can display the data. The simplest way would be a RegEx because I already have one from an implementation for a different platform. Or some other way to convert an HTML table to a hash/dictionary. Do you guys know how I can parse HTML to a dict in MonkeyC?

Cheers,
Stefan
  • About all I can see is when you request the HTML data is use "HTTP_RESPONSE_CONTENT_TYPE_TEXT_PLAIN" (new in CIQ 3.0.0) and parse it yourself.
  • I must be missing something.. If the service provides JSON, why are you trying to parse HTML?
  • Former Member
    Former Member over 7 years ago
    Not sure if that was intention of MrMarbury - but honestly - I have also very good reason to do JSON parsing by myself :(

    I've tried probably everything - background process is quite limited in memory and there is no way to accept response from the server I need to process with _JSON response type. With 3.0 beta have checked - and _TEXT_PLAIN is working - hurray!
    Oh, well, now I have to write a light parser by myself. But I believe - 16kB remaining should hopefully be enough to do so…

    So, will write one...
  • ups, I am so sorry. I totally forgot about that. I was under a lot of stress lately.

    @Travis: The obtaining of the final departure data is a multistep process. And unfortunately, the API returns the most important page with the actual departure data as HTML (every other step beforehand is answered as JSON - meh)

    @jim: Thx for the info. I will try this and see what it gets me into. First I have to find out why with 3.0.x playing back my fit file in the simulator doesn't do anything anymore