XML error is generated:
XML Parsing error. XML or text declaration not at start of entity
Line Number 3, Column 1
I see the comments about a blank space at the beginning of the line creating that erro
I can not see anywhere that extension/feed/google_sitemap is generating that blank space.
Is there a working OC file that actually WORKS to generate the sitemap?
Thanks
Dave
Duplication of: viewtopic.php?f=202&t=223961 .
Dedication and passion goes to those who are able to push and merge a project.
Regards,
Straightlight
Programmer / Opencart Tester
No real reason to duplicate a topic either. Forum rules.
Dedication and passion goes to those who are able to push and merge a project.
Regards,
Straightlight
Programmer / Opencart Tester
What are in the first two lines of the XML output?DaveRiba wrote: ↑Fri May 28, 2021 2:34 amTrying to generate a sitemap using OC 3.0.3.6
XML error is generated:
XML Parsing error. XML or text declaration not at start of entity
Line Number 3, Column 1
I see the comments about a blank space at the beginning of the line creating that erro
I can not see anywhere that extension/feed/google_sitemap is generating that blank space.
Is there a working OC file that actually WORKS to generate the sitemap?
Thanks
Dave
It could be something before <?php or after ?> tags in one of your PHP files. Not just in the google_sitemap.php file, but any included PHP file.
If I manually run the datafeed in a browser:
https://harbor-sales.com/index.php?rout ... le_sitemap
the error is:
XML Parsing Error: XML or text declaration not at start of entity
Location: https://harbor-sales.com/index.php?rout ... le_sitemap
Line Number 3, Column 1:
Looking at the sitemap generated, the file begins in Column 1 --
<?xml version="1.0" encoding="UTF-8"?><urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:image="http://www.google.com/schemas/sitemap-image/1.1">
Breaking the string apart, I can not see an issue.
Attached is the sitemap that is generated.
Attachments
This is the beginning of the code, unmodified, from google_sitemap.php
I can not see anywhere that it is creating 2 blank lines.
What am I missing?
Where is could they be originating from?
<?php
class ControllerExtensionFeedGoogleSitemap extends Controller {
public function index() {
if ($this->config->get('feed_google_sitemap_status')) {
$output = '<?xml version="1.0" encoding="UTF-8"?>';
$output .= '<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:image="http://www.google.com/schemas/sitemap-image/1.1">';
DISCLAIMER:
You should not modify core files .. if you would like to donate a cup of coffee I will write it in a modification for you.
https://www.youtube.com/watch?v=zXIxDoCRc84
Attachments
Screen-Shot-2021-05-31-at-21.47.42.jpg (77.92 KiB) Viewed 1342 times
DISCLAIMER:
You should not modify core files .. if you would like to donate a cup of coffee I will write it in a modification for you.
https://www.youtube.com/watch?v=zXIxDoCRc84
If you view the source of any page on your website you will also see the two blank lines at the start. It could be something before the <?php or after ?> tags in one of your PHP files. Not just in the google_sitemap.php file, but any included PHP file. Start with index.php and work through the common files that are used on every page. Check any files you have modified and also your template header.twig. Disable any extensions to see it they are the cause the issue.DaveRiba wrote: ↑Tue Jun 01, 2021 4:02 amThank you.
This is the beginning of the code, unmodified, from google_sitemap.php
I can not see anywhere that it is creating 2 blank lines.
What am I missing?
Where is could they be originating from?
<?php
class ControllerExtensionFeedGoogleSitemap extends Controller {
public function index() {
if ($this->config->get('feed_google_sitemap_status')) {
$output = '<?xml version="1.0" encoding="UTF-8"?>';
$output .= '<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:image="http://www.google.com/schemas/sitemap-image/1.1">';
You could also use a file comparison program to compare against a clean download of the same version of OpenCart.
Users browsing this forum: No registered users and 151 guests