使用PHP更改XML的结构

I need to take this text file http://gis.fcd.maricopa.gov/apps/forecastzone/wxlabels.txt and using php export an xml file. I have this current code which exports the xml but I need a different format

<?php

date_default_timezone_set("MST"); //or whatever your default timezone is.
header("Content-Type: text/xml"); 

$fp = fopen('http://gis.fcd.maricopa.gov/apps/forecastzone/wxlabels.txt', 'r');

$xml = new XMLWriter;
$xml->openURI('php://output');
$xml->startDocument(); 
$xml->setIndent(true); // makes output cleaner

$xml->startElement('messages'); 

while ($line = fgetcsv($fp)) {

   $xml->startElement('zones');
   $xml->writeElement('name', $line[0]);
   $xml->writeElement('times', $line[1]);
   $xml->endElement();
}

$xml->endElement();

?>

It exports to http://alert.fcd.maricopa.gov/alert/Google/v3/php/msp.php and looks like this:

<messages>
<zones>
<name>Gila Bend</name>
<times>2:00pm-5:00pm</times>
</zones>
</messages>

I need it to look like this:

<messages>
<zones name="Gila Bend" times="2:00pm-5:00pm"</zones>
</messages>

What do I need to add/edit in my php file?

<?php

date_default_timezone_set("MST"); //or whatever your default timezone is.
header("Content-Type: text/xml"); 

$fp = fopen('http://gis.fcd.maricopa.gov/apps/forecastzone/wxlabels.txt', 'r');

$xml = new XMLWriter;
$xml->openURI('php://output');
$xml->startDocument(); 
$xml->setIndent(true); // makes output cleaner

$xml->startElement('messages'); 

while ($line = fgetcsv($fp)) {

   $xml->startElement('zones');
   $xml->writeAttribute('name', $line[0]);
   $xml->writeAttribute('times', $line[1]);
   $xml->endElement();
}

$xml->endElement();

?>