Is it possible to extend nsIDOMNode and alike?
| Newsgroups | gmane.comp.mozilla.devel.dom |
|---|---|
| Organization | http://groups.google.com |
| Message-ID | <a45e8875-5be6-4c98-9d65-795587a18cd5@e67g2000hsa.googlegroups.com> |
I have Mozilla embedded in my application through Java-xpcom. I want to attach certain reference (to Java object) to each of the nodes in the DOM tree. In another word, once I get a nsIDOMNode from Mozilla, I would like to call methods on its attached reference. I can certainly build a map and store the references in it. But it won't scale well and constantly adding/removing from a big map is kind of expensive. Since nsIDOMNode is an interface, I am thinking if I can wrap Mozilla's implementation in my own class and somehow provide that class back to Mozilla DOM then I should be able to achieve what I need. The problem now lies in how to provide the class back to Mozilla. nsIDOMDOMImplementation looks like a potential entry point but is read-only on nsIDOMDocument. Is the route I am taking even possible in xpcom? Are there any other solutions that you can suggest? Thanks in advance for your help. Feng