I want to move a node around in XML

for e.g. if the string is

<strong><u><?cu stom_mark_start ForFormatCount= 'BU' Forunformatchar ='i' data='evolved'? >evolved<?custo m_format_mark_e nd ?></u></strong>

then the custom PI should be moved before the formatting tags

The Result should be

<?custom_mark_s tart ForFormatCount= 'BU' Forunformatchar ='i'...