Moving write function out of mp_xml

That will prevent php Cannot redeclare write() Fatal Error