Refactor: libcrmcommon: New pcmk__xe_replace_match()
To replace replace_xml_child(). Also use pcmkxe_first_child() and
pcmkxe_next() -- this function can succeed only for element nodes, so
don't try with non-elements.
Maintain a separate function body for replace_xml_child().
pcmk__xe_replace_match() will soon drop its parent argument. Keeping a
separate body for replace_xml_child() is only way to preserve existing
behavior in insane cases where an external caller passes a non-NULL
parent to the root call. replace_xml_child() was only supposed to take a
non-NULL parent in recursive calls, but nothing enforced that.
Signed-off-by: Reid Wahl <nrwahl@protonmail.com>