Parsing a table with HTMLRewriter

I am attempting to use HTMLRewriter to parse a table. Each row is in the format (I am not in control of the format)

    <td class="1"> <p> data </p></td>
   <td class="2">  <p> moreData </p> </td>

How would I go about pulling the data out of each row so I can create a json object such as

{ "1": "data", "2": "moreData" }

The specific piece I am stuck on is how to get the children of each row in the element handler

class ElementHandler {
  element(element) {
     // how do I get the children of an element?

HTMLRewriter sounds like JavaScript. Stack Overflow should have more JavaScript tutorial resources.

1 Like

I checked SO and there isnt much about HTMLRewriter. Since it was developed by cloudflare and is built into workers I assumed this would be a better spot to ask - if Iā€™m wrong let me know and i can post a new question on SO

That is correct, but your question is still related to standard JavaScript development and here @sdaymanā€™s suggestion is spot on, as the forum is not intended for generic development questions. Everything that is libary specific is at

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.