Вам будет лучше использовать SimpleXML, чем использовать строки для создания вашего XML, вы можете легко испортить содержимое, если начнете строить данные такими, какие вы есть.
Ваш контент может быть создан с помощью ...
$Country = "Greece";
$Code = "GR";
// Create base document
$xml =new SimpleXMLElement('<Address FormattedInd="true"></Address>');
// Add in the CityName elment
$xml->addChild("CityName", "Athens Center");
$xml->addChild("Country", $Country);
$countryName = $xml->addChild("CountryName");
// With the CountryName element just created, add the Code attribute
$countryName->addAttribute("Code", $Code);
echo $xml->asXML();
Какие выходы ...
<?xml version="1.0"?>
<Address FormattedInd="true"><CityName>Athens Center</CityName><Country>Greece</Country><CountryName Code="GR"/></Address>