3

I'm not quite familiar with XML files and Notepad++, so a simple solution is better, however clumsy it may be.

I have a large XML file and I'm trying to copy only the content between the tags (hope my terminology is right). To be sure I'm clear, from all the text in the screenshot below I would like to copy only the following text and paste it elsewhere:

DISCUSSION

In this study I

have demonstrated

an approach the

Notepad++ screenshot

Is there any simple and quick way to do so for many lines of text at once?

Any help will be greatly appreciated!

3
  • You can try importing the XML to Excel and then copy the relevant data. this is not a programming question so I'm voting to close it.
    – Yotam Omer
    Feb 8, 2016 at 2:42
  • 1
    Agreed, there is a simple Python library for extracting the text from a Word document. Or, any XML parser should do the trick by iterating over the nodes amd retrieving their inner text. Feb 8, 2016 at 2:50
  • Or replace all the xml tags with regex string replace in notepad++ Find(regex): /(<.[^(><.)]+>)/g replace with enter nothing Feb 8, 2016 at 3:22

1 Answer 1

3

Open up the find and replace window by pressing ctrl+h.

Set the 'Search Mode' to 'Regular expression'.

In the 'find what' text box enter: (?s)<[^><]*?> and leave the 'replace with' text box empty.

Press the replace all button and the tags should disappear.

This is a quick and easy fix using notepad++ but may not work if there are CDATA tags present or comments containing < or >. You'll need an XML parser for more reliable transformations.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.