General XMetaL Discussion

XMetaL Community Forum General XMetaL Discussion Remove an element from the Element List.

  • anton

    Remove an element from the Element List.

    Participants 1
    Replies 2
    Last Activity 4 years, 4 months ago

    Hey 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.

    Reply

    Derek Read

    Reply to: Remove an element from the Element List.

    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.

    Reply

    anton

    Reply to: Remove an element from the Element List.

    Thank you, Derek, that's exactly what we need!

    Reply

  • You must be logged in to reply to this topic.

Lost Your Password?

Products
Downloads
Support