Created
December 21, 2009 16:45
-
-
Save evaisse/261055 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Start XML file, create parent node | |
$xml = new XMLWriter(); | |
$xml->openMemory(); // create document in memory (AKA storing into a var) | |
$xml->setIndent(true); // autoindent output | |
$xml->setIndentString(' '); // set kind of indentation | |
$xml->startDocument('1.0','UTF-8'); // start xml declaration with encoding utf-8 | |
$xml->startElement("markers"); | |
foreach( $dbMarkers as $m ) | |
{ | |
$xml->startElement("marker"); | |
$xml->writeAttribute("photo", $m['img'] ); | |
$xml->writeAttribute("name", $m['name'] ); | |
$xml->writeAttribute("lng", $m['lng']); | |
$xml->writeAttribute("lat", $m['lat']); | |
$xml->endElement(); | |
} | |
$xml->endElement(); | |
echo $xml->outputMemory(false); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment