Community
    • Login

    Add XML Tools item to Context Menu

    Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
    7 Posts 2 Posters 4.3k Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • Manuel ColladoM
      Manuel Collado
      last edited by

      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.

      Claudia FrankC 1 Reply Last reply Reply Quote 0
      • Claudia FrankC
        Claudia Frank @Manuel Collado
        last edited by

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

        Cheers
        Claudia

        1 Reply Last reply Reply Quote 0
        • Manuel ColladoM
          Manuel Collado
          last edited by

          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. :(

          Claudia FrankC 2 Replies Last reply Reply Quote 0
          • Claudia FrankC
            Claudia Frank
            last edited by

            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?

            Cheers
            Claudia

            1 Reply Last reply Reply Quote 0
            • Claudia FrankC
              Claudia Frank @Manuel Collado
              last edited by

              @Manuel-Collado

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

              Cheers
              Claudia

              1 Reply Last reply Reply Quote 0
              • Claudia FrankC
                Claudia Frank @Manuel Collado
                last edited by

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

                Cheers
                Claudia

                1 Reply Last reply Reply Quote 2
                • Manuel ColladoM
                  Manuel Collado
                  last edited by

                  It works now!!
                  Thank you Claudia

                  1 Reply Last reply Reply Quote 1
                  • First post
                    Last post
                  The Community of users of the Notepad++ text editor.
                  Powered by NodeBB | Contributors