So I'm using HTMLCleaner which returns a org.w3c.dom compatible DOM. Now, I want to insert my own subclassed Elements (which implement additional functionality outside the dom) into this dom tree. Is this possible?
If you use the Document.createElement(), you can't say that you want it to create your implementation of an element. Ideally I don't want my class to implement Element and Node have to manually do all the work that has already been done. I thought that I could subclass ElementImpl from Xerces and potentially add it to the DOM I have. However Xerces expects to be created into DOMs that implement CoreDocumentImpl etc.
It would be a pity, from an elegance point of view. If I had to use plain Element and manage to identify them by their attributes/names etc, as each one needs to point to particular positions in an index. Is something against you extend the already existing implementation provided by this HTMLCleaner library? Package privateness perhaps?
以上就是In java, how do I create my own xml subclassed elements in a DOM returned by 3rd party tools.的详细内容，更多请关注web前端其它相关文章！