Convert valid XML to PHP DOM code script for easy character sanitation and dynamic extension.