Posts

Extracting HTML Content with MLE JavaScript

Image
In the past, when I've seen people build out processes to extract a piece of data from a HTML document, it has usually involved crafting some RegEx statements or building a program that runs external to the database. With MLE JS available in 23c, I wanted to explore the possibility of using JavaScript in the database to use the same functions we may have used in the past - namely, document.querySelectorAll . Choosing a Module Unlike in the browser, in server side JavaScript, we don't have access to these document constructs, so we need to choose a module to facilitate this. Previously I have used the jsdom module, but unfortunately this project doesn't support ESM style. With a bit of searching, I came across another library, linkedom , which I will be using for this example. A lot of other examples on the web for using third party modules to enhance your applications involve those that are self contained and don't have any dependencies. Linkedom is a little more compl