The following macro:

;; Keyboard Macro Editor. Press C-c C-c to finish; press C-x k RET to cancel.
;; Original keys: C-s <attr 2*M-f 2*C-f C-SPC C-s </att 5*C-b ESC xcapital TAB reg TAB RET

Command: last-kbd-macro
Key: none

Macro:

C-s\t\t\t;; isearch-forward
<attr\t\t\t;; self-insert-command * 5
2*M-f\t\t\t;; forward-word
2*C-f\t\t\t;; forward-char
C-SPC\t\t\t;; set-mark-command
C-s\t\t\t;; isearch-forward
</att\t\t\t;; self-insert-command * 5
5*C-b\t\t\t;; backward-char
ESC
xcapital\t\t;; self-insert-command * 4
TAB\t\t\t;; lisp-indent-line
reg\t\t\t;; self-insert-command * 3
TAB\t\t\t;; lisp-indent-line
RET\t\t\t;; newline


Used on the following:

asdsgas<attr ibute="foo">DINGLE_BERRIES</attr>jlj;lj;l
<attr ibute="foo">DINGLE_BERRIES</attr><moo>on you</moo>
<attr ibute="foo">DINGLE_BERRIES</attr><barry>likes herrings</barry>
<attr ibute="foo">DINGLE_BERRIES</attr>

Produces:

asdsgas<attr ibute="foo">Dingle_Berries</attr>
jlj;lj;l<attr ibute="foo">Dingle_Berries</attr><moo>on you</moo>
<attr ibute="foo">Dingle_Berries</attr>
<barry>likes herrings</barry>
<attr ibute="foo">Dingle_Berries</attr>

Like I said, the exact form of the macro is going to depend on the specific data.

The macro above is suitable for pasting into ^x^k^xe, incidentally. ;-)