-
Notifications
You must be signed in to change notification settings - Fork 63
Urlset not preset #16
Comments
Hello @jarodium, |
builder $sitemap = new Sitemap($dominio);
$sitemap->setFilename($dominio_id);
$sitemap->setPath(getenv('OPENSHIFT_DATA_DIR').'sitemaps/');
foreach($paths as $c) {
$dom = ($dominio != $c) ? str_replace("$dominio","",$c) : $c;
$sitemap->addItem($dom, '0.5', 'weekly', 'Today');
}
`
reader ( i don't read directly from the sitemap index, go to the sitemap directly ):
```php
function remove_utf8_bom($text)
{
$bom = pack('H*','EFBBBF');
$text = preg_replace("/^$bom/", '', $text);
return $text;
}
header("Content-type: text/xml");
echo trim(remove_utf8_bom(file_get_contents(getenv('OPENSHIFT_DATA_DIR')."sitemaps/5628afa9-eb78-4930-a6e5-8cc76d1a2113.xml")));
echo '</urlset>';
` |
I don't have a lot of time unfortunately to work on this project, so the best way to get this fixed is by submitting a pull request |
I will try to patch it up and submit a PR. |
Do you mind if I change the class to use SimpleXML? It's just that in the docs, i've found out that end-element immediately closes the element, but from what I can infer is that there is no reference being kept to urlset, thus, endElement will not close it. I've tried to use a solution in the man page with no luck. Perhaps a switch to SimpleXML would be simpler as it can retain the parent element in a variable and we can close it in the endsitemap function. |
My intent is actually to switch to sabre/xml: http://sabre.io/xml/ If you're willing to make that change instead I'd definitely be happy about that. simplexml I consider a step backwards though. |
I will take a look at sabre/xml. Looks good xD |
Nope! |
Hello, I am trying to validate a sitemap file this class generates and I am encountering the following errors in W3c validator:
closing urlset is missing
Thanks
The text was updated successfully, but these errors were encountered: