Remove Empty PCDATA 'Text' Nodes From a Document
The method outlined below basically uses an F3 search to find empty text nodes, applies the search 'as a filter', then applies a 'filter action' of 'delete node' to all nodes that match the search filter. (Please note that as of writing (2014-05) this procedure is not currently safe to run on ODBC databases, as the 'Filter element actions' are not yet ODBC-safe.)
• NB: Before starting, make sure you save an extra backup copy of your database/document
• Go to Search (F3)
• Enter "^$" as the search text (without quotes)
• Tick the 'Regular expression' option
• Click the F3 'Fields' button to pop out the list of fields
• Click the 'Clear all' button to untick all fields in the list of fields
• Tick (only) the "[text]" checkbox in the list of fields
• Click the "Search" button to perform the search (the search results window should now show some matches)
• Click 'Filter +' in the search results window to apply the search 'as a filter'
• Go to Filter (F5)
• Click the "Advanced" button
• Select the 'Filter element actions' sub-menu
• Select the sub-menu item 'Delete all matching elements/nodes'
• Double-check that the correct thing has happened (TIP: a handy way to do this is to use 'File/Compare merge' and compare the document against the same as-yet-unsaved document to see what changes have occurred.)