Page 1 of 1

Find empty elements

Posted: Sat Jun 09, 2007 6:44 pm
by escarole
Does Oxygen have any tools that would help me find empty elements (and possibly remove them all) in a large document?

The application that created this document makes lots of empty elements for fields in which someone doesn't enter data.

(Newby here)

Posted: Mon Jun 11, 2007 6:40 am
by escarole
Or, of Oxygen doesn't, can someone suggest something else?

Posted: Mon Jun 11, 2007 10:45 am
by sorin_ristache
Hello,

You can remove the empty elements by executing a Find/Replace with the following regexp as the find expression: <([^</>"=]+?)>(\s*?)</(.+?)> and the empty string as the replace expression. This works for elements in the form:

Code: Select all

<elem1>   </elem1>
and

Code: Select all

<elem2>

</elem2>
For elements of the form:

Code: Select all

<elem3 />
you should use the find expression: <([^</>"=]+?)/>


Regards,
Sorin