Add XML Tools item to Context Menu

  • Hello
    I am trying to add a XML Tools plugin Item in the Context Menu. The name of the item is “Convert selection text to XML (&& lt; && gt; => <>)”. I have added this line to the contextMenu.xml file:
    <Item FolderName = “XML Tools” PluginEntryName = “XML Tools” PluginCommandItemName = “Convert selection text to XML (&& lt; && gt; => <>)” ItemNameAs = “Replace lt and gt” />

    I have tried to replace the escape characters with their corresponding string, but it does not work.

    Can you help me?

    Thank you.

  • @Manuel-Collado

    my first thought was does it not have to be escaped instead - like

    &amp;&amp;lt;&amp;&amp;gt; ...

    because when xml parser parses this line

    “Convert selection text to XML (&& lt; && gt; => <>)”

    I would expect an error complaining that & & isn’t correct.


  • Hi Claudia
    I have tried with:

    <Item FolderName=“XML Tools” PluginEntryName=“XML Tools” PluginCommandItemName=“Convert selection text to XML (& amp;& amp;lt; & amp;& amp;gt; =& gt; & lt;& gt;)” />

    (Note that I put a space between & and following char for the correct display in the forum. In the file code this space does not exist)

    but it still does not work. :(

  • Hi Manuel,

    there are a couple of spaces in your post which, if used, are incorrect.
    What I tried, using python script, is this string

    Convert selection text to XML (&amp;&amp;lt;&amp;&amp;gt; =&gt; &lt;&gt;)

    Btw. do you use a different localization?


  • @Manuel-Collado

    but this string isn’t working when adding to contextmenu - strange.
    Is additional c escaping needed? Need to check.


  • @Manuel-Collado

    Hi Manuel,

    you need to do exactly the opposite from what we thought needs to be done.
    Omit the first two && to get

        <Item PluginEntryName="XML Tools" PluginCommandItemName="Convert selection text to XML (lt;gt; =&gt; &lt;&gt;)" />

    If you are interested in why this is the case checkout the
    purgeMenuItemString function with having in mind that it will be called with keepAmpersand=false in this case.


  • It works now!!
    Thank you Claudia

Log in to reply