<?
	if ($this->rows) {
		$xmldoc = new DomDocument('1.0', 'UTF-8');

		// create root node
		$root = $xmldoc->createElement('stores');
		$root = $xmldoc->appendChild($root);

		foreach ($this->rows as $row) {
			$id = $row['customer_id'];
			$name = $row['name'];

			$countryNode = $xmldoc->createElement('store');
			$countryNode = $root->appendChild($countryNode);

			$nameNode = $xmldoc->createElement('name', htmlspecialchars($name));
			$nameNode = $countryNode->appendChild($nameNode);

			$idNode = $xmldoc->createElement('id',$id);
			$idNode = $countryNode->appendChild($idNode);

//			$countryNode->setAttribute('code',htmlspecialchars($abbr));
//			$countryNode->setAttribute('continent',htmlspecialchars($continent));
		}

		$data = $xmldoc->saveXML();
	}
	echo $data;
?>