How to get some kind of walkable DOM Document out of CEF?

Having problems with building or using the JCEF Java binding? Ask your questions here.

How to get some kind of walkable DOM Document out of CEF?

Postby KatrinaS » Mon Jul 10, 2023 8:24 pm

Hiya, the title really plus as an extra maybe how add some kind of like change listener to the Context that updates the Browsers view of the Document,, I know about the Javascript and yes that seems easy enough, but surely there's a better more, I dunno, more industry standard way, I don't mind having to get down and dirty into the CEF source to provide some plumbing and JNI to return some kind of Element tree or whatever, but C/CPP is not my first language and I really have no idea where that Rabbit hole starts, where is the single root (or roots) of where that all starts? :D
KatrinaS
Mentor
 
Posts: 83
Joined: Tue Jul 04, 2023 6:30 pm

Re: How to get some kind of walkable DOM Document out of CEF

Postby KatrinaS » Mon Jul 10, 2023 8:46 pm

I see that there is Functions and Window Binding / RenderProcessHandler but this doesn't seem to be the same / JCEF CefRenderHandler(Adapter), like that isn't RenderProcessHandler :)
KatrinaS
Mentor
 
Posts: 83
Joined: Tue Jul 04, 2023 6:30 pm

Re: How to get some kind of walkable DOM Document out of CEF

Postby magreenblatt » Tue Jul 11, 2023 12:20 am

JavaScript is the industry standard way.
magreenblatt
Site Admin
 
Posts: 12409
Joined: Fri May 29, 2009 6:57 pm

Re: How to get some kind of walkable DOM Document out of CEF

Postby KatrinaS » Tue Jul 11, 2023 7:42 am

There's no way (that I am aware of) to return a fully fleshed out window.document, Element, Node or whatever, Object, but of course if you have written the Document you don't need it :)

Edit, edit. CEF seems to be able to (potentially) return Objects via (I think) CefV8Accessor,, why can't we (I) just plumb in GetValue("document.documentElement.childNodes");,, calling Setters on perhaps a zillion :lol: Elements seems clunky via Javascript but that said, it'll be the same amount of calls on the Document but without (perhaps) the overhead or more overhead :)
KatrinaS
Mentor
 
Posts: 83
Joined: Tue Jul 04, 2023 6:30 pm

Re: How to get some kind of walkable DOM Document out of CEF

Postby KatrinaS » Tue Jul 11, 2023 10:38 am

And (on having a cursory squizz) why is dom_document_impl.cc not plugged in / exposed? :)
KatrinaS
Mentor
 
Posts: 83
Joined: Tue Jul 04, 2023 6:30 pm

Re: How to get some kind of walkable DOM Document out of CEF

Postby KatrinaS » Tue Jul 11, 2023 12:31 pm

The thing just needs return something that implements (more or less), there's a lot of overlap :

javax.swing.tree.MutableTreeNode;
javax.swing.tree.TreeNode;
org.w3c.dom.Attr;
org.w3c.dom.DocumentFragment;
org.w3c.dom.NamedNodeMap;
org.w3c.dom.Node;
org.w3c.dom.NodeList;
org.w3c.dom.TypeInfo;
org.w3c.dom.UserDataHandler;

And catches / throws :

org.w3c.dom.DOMException;

Don't make me have to maul your code with cackhandedness :lol:
KatrinaS
Mentor
 
Posts: 83
Joined: Tue Jul 04, 2023 6:30 pm

Re: How to get some kind of walkable DOM Document out of CEF

Postby magreenblatt » Tue Jul 11, 2023 2:15 pm

This isn’t something that we are interested in for JCEF. If you need such a representation you could just parse the HTML file contents in your application.
magreenblatt
Site Admin
 
Posts: 12409
Joined: Fri May 29, 2009 6:57 pm

Re: How to get some kind of walkable DOM Document out of CEF

Postby KatrinaS » Tue Jul 11, 2023 2:35 pm

CEF obviously has it, it seems a glaring and crippling omission just for MuH bElOvEd jAvA but okay :D
KatrinaS
Mentor
 
Posts: 83
Joined: Tue Jul 04, 2023 6:30 pm

Re: How to get some kind of walkable DOM Document out of CEF

Postby magreenblatt » Tue Jul 11, 2023 3:00 pm

This was answered in your previous thread at viewtopic.php?f=17&t=19502#p53834
magreenblatt
Site Admin
 
Posts: 12409
Joined: Fri May 29, 2009 6:57 pm

Re: How to get some kind of walkable DOM Document out of CEF

Postby KatrinaS » Tue Jul 11, 2023 4:43 pm

I beg to differ but okay, I can have access to everything as long as it's a String and if I want access to the actual DOM I have to plumb it myself or parse a String that's already been parsed by CEF,, gotcha :D This unreasonable coveting of the DOM is ridiculous :)
KatrinaS
Mentor
 
Posts: 83
Joined: Tue Jul 04, 2023 6:30 pm


Return to JCEF Forum

Who is online

Users browsing this forum: No registered users and 94 guests