Hi folks,
i need to create the following
<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<url>
<loc>http://www.erikastokes.com/</loc>
<lastmod>2010-07-29</lastmod>
<changefreq>monthly</changefreq>
<priority>0.8</priority>
</url>
</urlset>
now i have this code
<?php
$xml = new DomDocument("1.0","UTF-8");
$container = $xml->createElement("urlset xmlns=\"http://www.sitemaps.org/schemas/sitemap/0.9\"");
$container = $xml->appendChild($container);
$url = $xml->createElement("url");
$url = $container->appendChild($url);
$loc = $xml->createElement("loc","http://xxxxxx.com/property/234");
$loc = $url->appendChild($loc);
$changefreq = $xml->createElement("changefreq","never");
$changefreq = $url->appendChild($changefreq);
$priority = $xml->createElement("priority","0.5");
$priority = $url->appendChild($priority);
$xml->FormatOutput = true;
$string_value = $xml->saveXML();
$xml->save("example.xml");
?>
i am getting an error in 3rd line.
Fatal error: Uncaught exception ‘DOMException’ with message ‘Invalid Character Error’ in …DOMDocument->createElement(‘urlset xmlns="h…’) #1