General XMetaL Discussion
XMetaL Community Forum › General XMetaL Discussion › Remove an element from the Element List.
-
anton February 21, 2018 at 3:55 pm
Remove an element from the Element List.
February 21, 2018 at 3:55 pmParticipants 1Replies 2Last Activity 5 years, 1 month agoHey Derek,
Our plugin highlights words in XML documents by embracing them into a new tag.
To allow that we add this tag to the document's DTD:LPDISPATCH p = docOwner.get_doctype();
DOMDocumentType dtd(p);
dtd.addElement(pszTag, “”, TRUE, TRUE);
Having this done we can start highlighting words.
As a result this tag gets viewable in the Element List pane.However it remains there even after the highlight has been cleared and all occurances of the tags removed from the document.
Any chance to remove it from the Element List so that it no longer irritates customers?
thank you,
Anton.Derek Read February 21, 2018 at 8:26 pm
Reply to: Remove an element from the Element List.
February 21, 2018 at 8:26 pmWhen 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.
-
AuthorPosts
- You must be logged in to reply to this topic.