I'm trying to have my sitemap update automatically as pages are added. I'm defining var containing the child name I need, which is including a colon character. PHP or XML is removing the colon and word to the right or left of it. How can I keep that colon in the child elements name?
I'm using this:
<?php
$imagechild = 'image:image';
$imageloc = 'image:loc';
$xml=simplexml_load_file("sitemap.xml");
$map = $xml->addChild('url');
$map->addChild('loc', "http:/some website".$page_path);
$img = $map->addChild($imagechild);
$img->addChild($imageloc, $img_link);
$xml->saveXML('sitemap.xml');
?>
I'm getting this:
<url>
<loc>web url</loc>
<image>
<loc>image url</loc>
</image>
</url>
I need this
<url>
<loc>web url</loc>
<image:image>
<loc>image url</loc>
</image:image>
</url>
Thank you in advance!