I installed xmlsitemap on my local test site, running on Windows Vista, PHP 5.3.1. When building the sitemap files, I repeatedly got the following errors.

warning: XMLWriter::openUri() [xmlwriter.openuri]: Unable to resolve file path in C:\<snip>\sites\all\modules\contributed\xmlsitemap\xmlsitemap.xmlsitemap.inc on line 37.
user notice: Could not open file sites/default/files/xmlsitemap/NXhscRe0440PFpI5dSznEVgmauL25KojD7u4e9aZwOM/1.xml for writing. in C:\<snip>\sites\all\modules\contributed\xmlsitemap\xmlsitemap.xmlsitemap.inc on line 39.
warning: XMLWriter::setIndent() [xmlwriter.setindent]: Invalid or unitialized XMLWriter object in C:\<snip>\sites\all\modules\contributed\xmlsitemap\xmlsitemap.xmlsitemap.inc on line 45.
warning: XMLWriter::startDocument() [xmlwriter.startdocument]: Invalid or unitialized XMLWriter object in C:\<snip>\sites\all\modules\contributed\xmlsitemap\xmlsitemap.xmlsitemap.inc on line 46.
...

This seems more like a deficiency in PHP's XMLWriter than with this module ... it apparently can't handle non-canonical pathnames on Windows. I was able to get it working by adding the following 2 lines at the beginning of the openUri function in the XMLSitemapWriter class.

touch($uri);
$uri = realpath($uri);

I tried it on the live site (running on Linux) without the above fix, and it worked fine.

Comments

Anonymous’s picture

Status: Active » Postponed (maintainer needs more info)
killua99’s picture

That happen to me, I added those lines and it works!. Thanks.

tomsm’s picture

Works for me too.

dave_______1’s picture

Thanks, worked for me too :)

jianxun’s picture

Thanks, worked for me too :)

soloboom’s picture

Just need to add one row: touch($uri);