Sitemap XML validation fails because of missing end tag
|Target version:||Release 2.5.0|
|Google Code Legacy ID:||Tested version:|
This was reported in the user forum here: https://groups.google.com/forum/#!topic/ica-atom-users/bYDBUwU1mkk. When a sitemap is generated using the command line tool 'php symfony tools:sitemap' the resulting XML fails validation because the final tag </urlset> is missing. Adding the tag manually allows the XML to validate.
#2 Updated by Steve Breker 3 months ago
There was an issue with the sitemap CLI task where the last chunks of
data were never written to the output files because the end() method
registered with register_shutdown_function() was being called after
both the sitemap index file and the last sitemap file were closed for
writing - end() for the last files was being called after the "DONE"
message was written.
I have removed the call to register_shutdown_function() in favour of
calling end() directly from the sitemap task to complete writing the
last sitemap.#.xml file, and added a call to flush() in the
SitemapWriter class to flush the sitemap index file.
As per AtoM's documentation, a sitemap index file will always be created
and the sitemap file will be broken into 50K line chunks. The sitemap
index file can be ignored if there is only one sitemap chunk created.
A side effect of this fix is that static pages are now included in the
sitemap file as intended, where before they were always in the last
chunk and omitted due to the flush issue on the last file.
#5 Updated by Dan Gillean 3 months ago
- Category set to CLI tools
- Status changed from QA/Review to Verified
- Target version set to Release 2.5.0
- Requires documentation set to No
Nice work! Looks good. Interestingly, the extra sitemap file is also no longer empty! Contains pointer information, even when there's only 1 file.