// XML file
    $xmlBody = "<?xml version='1.0' encoding='UTF-8'?>
    <locations>
        <city1>New York</city1>
        <city2>Los Angeles</city2>
        <city3>Chicago</city3>
    </locations>";
    
    // Loading from XML file
<?php
    $xmlFile = new DOMDocument();
    $xmlFile ->load("path/file.xml");
    print $xmlFile ->saveXML();
?>