I'm working on an XML DOM plugin that requires dynamically adding child elements to the DOM based on an external data source found at runtime (in my case, annotations on classes that map to XML tags). These can't be DomElement classes found on disk because they're only discoverable at runtime. The information I retrieve at runtime tells me what kinds of attributes and children the element should support and other validation logic I need to enforce.
I've already implemented a DomExtender, but what's the best way to go about creating DomElements with custom validation at runtime? Should I look at using some like java.lang.reflect.Proxy to create my custom DOM elements at runtime, or is there a better / built-in way in IntelliJ to dynamically create these elements and their validation logic?