Guest User

Untitled

a guest
Apr 26th, 2018
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.69 KB | None | 0 0
  1. <?php
  2.  
  3. // Start XML file, create parent node
  4. $xml = new XMLWriter();
  5. $xml->openMemory(); // create document in memory (AKA storing into a var)
  6. $xml->setIndent(true); // autoindent output
  7. $xml->setIndentString(' '); // set kind of indentation
  8.  
  9. $xml->startDocument('1.0','UTF-8'); // start xml declaration with encoding utf-8
  10.  
  11. $xml->startElement("markers");
  12.  
  13. foreach( $dbMarkers as $m )
  14. {
  15. $xml->startElement("marker");
  16. $xml->writeAttribute("photo", $m['img'] );
  17. $xml->writeAttribute("name", $m['name'] );
  18. $xml->writeAttribute("lng", $m['lng']);
  19. $xml->writeAttribute("lat", $m['lat']);
  20. $xml->endElement();
  21. }
  22.  
  23. $xml->endElement();
  24. echo $xml->outputMemory(false);
Add Comment
Please, Sign In to add comment