deleting alll elements (and contents) of a certain type

Oxygen general issues.
Geoff16W
Posts: 8
Joined: Fri Mar 04, 2011 3:28 pm

deleting alll elements (and contents) of a certain type

Post by Geoff16W »

I feel like there is an easy a solution to this question, but after lots of frustration I thought I should just ask.

Basically, I want to select all "index" elements and then delete them.

I am able to "find" all elements of certain types and their contents using the Find->find elements/attributes. However, I want to delete all of these at once. But I can't. Am I missing something?

Then I tried to do this with a regular find and replace. But I don't seem to able able "find" the entirely of the element i.e. <index>.. content. </index>

I'm grateful for any help you can give me.
adrian
Posts: 2855
Joined: Tue May 17, 2005 4:01 pm

Re: deleting alll elements (and contents) of a certain type

Post by adrian »

Hello,

To delete all the elements of a certain name and their content you can use the Find/Replace dialog with XPath:

1. Find -> Find/Replace
2. Text to find: .*
3. Replace with: <leave empty>
4. XPath: //index
5. Enable Regular expression and Dot matches all
6. Press Find all to check that it finds what you want to remove.
7. Press "Replace all" to remove the content.

Regards,
Adrian
Adrian Buza
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com
Post Reply