ホーム > Other > How to Resolve "Extra content at the end of the document" XML Sitemap Error
Other

How to Resolve "Extra content at the end of the document" XML Sitemap Error

Thank you for your continued support.
This article contains advertisements that help fund our operations.

⇨ Click here for the table of contents for Laravel articles

Error Description

The sitemap being created through batch processing

error on line 23 at column 19: Extra content at the end of the document

was displaying this error.

Error Causes

  1. Missing closing tags
  2. Improperly formed XML documents
  3. Extra text in the XML document

The above three reasons could be considered for the error.

In this case, a missing closing tag was the cause

In this case, the error was caused by the XML file missing a closing tag.

In my case,

An error occurred during batch processing, causing it to stop while writing the XML

seems to be the case.

Status of this case (error)

<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<url></url>

The closing tag for urlset was missing.

Solution for this case (error)

<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<url></url>
</urlset>

Adding the closing tag resolved the error.

②The XML document is not properly formatted as per XML standards

XML files are often read by programs like crawlers in a format that follows predefined standards.

If the document is not written in the specified format, this error occurs.

Check the document again and ensure that necessary elements and attributes are added correctly.

③Extra text is included in the XML

If there is extra text in the XML, this error message will also be displayed.

Check for any extra text in the XML and if it is outside the XML elements or attributes, it needs to be removed or appropriately enclosed in tags.

Conclusion

That's all for now.

I hope this can be helpful to someone.

For feedback or complaints, please contact via Twitter DM.

Until next time!

Popular Articles

Deploying a PHP 7.4 + Laravel 6 Project to AWS EC2

Implementing Breadcrumbs in Laravel with laravel-breadcrumbs

Please Provide Feedback
We would appreciate your feedback on this article. Feel free to leave a comment on any relevant YouTube video or reach out through the contact form. Thank you!