Highlighted

built-in function (or a third party plugin/library) that can convert/parse some text into DOM?

Participant ,
Jun 23, 2020

Copy link to clipboard

Copied

as above. at the moment, I'm using the Jsoup Java library. I'm just trying to see if there's anything written in CF out there. Thanks!

Views

69

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more

built-in function (or a third party plugin/library) that can convert/parse some text into DOM?

Participant ,
Jun 23, 2020

Copy link to clipboard

Copied

as above. at the moment, I'm using the Jsoup Java library. I'm just trying to see if there's anything written in CF out there. Thanks!

Views

70

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Jun 23, 2020 0
LEGEND ,
Jun 23, 2020

Copy link to clipboard

Copied

I'd love to help, but don't fully understand your question.  What do you mean by "convert/parse some text into DOM"?  Converting or parsing text into a Document Object Model???

 

V/r,

 

^ _ ^

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Jun 23, 2020 0
Adobe Community Professional ,
Jun 23, 2020

Copy link to clipboard

Copied

I'd say jsoup is your best bet, and it's tbe bomb. Are you leveraging it from within CFML? You can. See resources such as https://tonyjunkes.com/blog/crash-course-in-cfml-and-jsoup/ .

 

More than showing merely how to integrate it into CFML, is also a great general introduction to jsoup, for any seeing this who are not familiar. Another good general intro is the  https://jsoup.org/cookbook/.

 

And in case the idea gets anyone's juices going, I'll share what was the best tip for me when I first started using jsoup: the idea of using the browser dev tools "inspect" feature to help find the "selector" value to use when trying to process some web content using jsoup: https://www.javacodeexamples.com/jsoup-get-css-selector-for-any-dom-element-example/841

 

But yep, Jay, if you somehow really wanted to find something other than jsoup, let us know what you're looking for (I can't imagine much OUTSIDE of CF let alone anything INSIDE of it that would rival jsoup's power).

/Charlie (server troubleshooter, carehart.org)

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Jun 23, 2020 0
BKBK LATEST
Adobe Community Professional ,
Jun 27, 2020

Copy link to clipboard

Copied

Even if there was an HTML parser written in ColdFusion out there, it wouldn't be as efficient as Jsoup. Underneath, ColdFusion would have to convert the CFML code to Java anyway.

 

A Stackoverflow comparison of Java HTML parsers over 10 years ago is still useful.

 

 

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Jun 27, 2020 0