Reply to: Remove an element from the Element List.February 21, 2018 at 8:26 pm
When you use addElement() you are modifying the in-memory model of the DTD (which is why it is used in the event On_DTD_Open_Complete). That change is permanent until the DTD is reloaded. There is no equivalent API for removing such definitions from the in-memory model of the DTD.
If the only issue is that you don't want the user to insert the element using the Element List you can modify what appears in the Element List using the On_Update_ElementList event and the API ElementList.RemoveItem(elemname). This event fires each time the element list is updated which gives you the flexibility to include logic that decides whether or not to remove an item under specific circumstances. If you want it to never be listed then your logic would just always remove it.
This will not stop a user from pasting the element into a document or typing it into Plain Text view. That would require the DTD to be reloaded.