Need help to replace tags to one xml from another xml

  • @ganesan-govindarajan
    After loading the last post, and proofing it I spotted a small mistake.

    @Terry-R said:

    Close the current tab, no need to save this file.
    Click “open…”, you can do “File”, then “Open…” or the 2nd icon from left achieves the same result.

    Between these 2 steps, close Notepad++, then re-open it. This is because Notepad++ will only update the shortcuts.xml file on closing. You won’t find the “test” macro unless you close and re-open it.


  • @Terry-R

    Thanks for provide the detailed information’s.

    I am just given the count just for as i have the more tags in that file. Sorry if my English may not be professional.

    I didn’t think that the regex will help on this task.

    Also i am working with ms-office and different kind of xml editors past 9 years. So i just doing the research for what thinks needs to be automate the different kind of tasks as i have faced in the past. Currently, i have the N++ editor and do research how this editor will make more effective and automate the task very efficiently. I just realized that the N++ having the lot of plugins which will use to automate the tasks very efficiently. That the think make join this community.

    However i had tried these instructions as above but i am not able to save the shortcuts.xml after insert the macro code. I have tried both ways as, record dummy macro but not found/update in the shortcuts.xml and directly open the xml and paste the code as you provide above but not able to save it is asking the DTD path.

    Please advise to proceed further.

    Thanks again for your help!!

    Ganesan. G

  • @ganesan-govindarajan , were you able to create the test macro I referred to as “tagtransfer”. When saving the recorded macro (step 9), then exiting Notepad++ and re-opening Notepad++ (this was a step I’d missed and added in another post), do you see that Macro listed under the Macro menu option?

    If that step is not working then I currently don’t know what your issue is. How do you run Notepad++, is it as a normal account, or do you use “administrator” as there may be differences in how Notepad++ works in these 2 modes.


  • @Terry-R

    Yes. After added the “tagtransfer” macro i have closed the entire application and reopen it. Also i can able to see the macro under the Macro menu. I tried both normal and administrator account but still not found the macro in shortcuts.xml.

    When i tried to add the macro manually in shortcuts.xml but asking the DTD.

    Please advise.

  • @ganesan-govindarajan , so you have shown that you can write to a shortcuts.xml file. We now need to find which one you are using. Back in step 13 I said if the first shortcuts.xml file did NOT show the test macro, then look in 2 other locations. Try that now. If you find the test macro, complete the steps with that file.

    You mention DTD, I don’t know what that means.


  • @Terry-R

    Now I can able to find the xml file in other location. I have updated the macro and replace the file in to the current Notepad++ installation folder.
    I have followed the steps but nothing has changed in the patient file. I have added the 10 = without quotes in the second line of the patient file and ran the macro.
    The Macro is running but there is no changes in the patient file.
    Please advise.

  • Did you add the “donor” file contents in line 1, above the 10 = ?

    If so, then try the Replace function and copy the regex I provided in the previous posting (shown in red with find what and replace in front). Click on the find button and confirm that some of the donor file and patient file highlight. If so then the macro should also work.


  • @Terry-R

    Yes!!. Now can able to run this macro successfully.

    Thanks a lot!!

  • @Terry-R

    Is there any regex to find text within the particular tag.

    For example: the text “MDOK” needs to identify the child element.

  • At this point I’d suggest you start with reading the following post It contains lots of helpful guidance on how to create regex’s.

    As the documentation points out, we aren’t a professional regex-writing forum, just people who enjoy using Notepad++ and yes regex, and also want to offer help to others who are learning.

    So the rub of it is, we like people who ask questions to have at least tried to get the answer themselves. When they cannot solve it themselves they need to present a good representation of the data they are working with and hopefully what they’ve tried, be it a regex or if related to other aspects of Notepad++, any additional information.

    I was interested in your original problem as it gave me a chance to work on a real issue and also to learn a bit more myself. I’m glad that once you DID follow the instructions it all worked out well. However with your latest request it sounds a bit like you expect us (forum contributors) to just be at your beck and call.

    So with respect, I’d firstly suggest you do some reading, have a go at trying to solve the issue yourself and yes, if you cannot, then come back with some examples and what you have tried. Then maybe someone on the forum will be happy to help.


  • @Terry-R

    Thank you so much!

    I will check that link and try to get resolve myself.


Log in to reply