Post by DaveRiba » Fri May 28, 2021 2:34 am

Trying 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

Active Member

Posts

Joined
Wed Oct 07, 2020 11:41 pm

Post by straightlight » Fri May 28, 2021 8:08 am

Take a look on the Marketplace. There are several extensions offered for this.

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


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON

Post by DaveRiba » Fri May 28, 2021 9:19 pm

Thank you, but that thread never had a conclusion.
It just petered out with a kludge.
No real solution offered.
The issue was never resolved. Thus, I ask it again.

Active Member

Posts

Joined
Wed Oct 07, 2020 11:41 pm

Post by straightlight » Fri May 28, 2021 9:39 pm

DaveRiba wrote:
Fri May 28, 2021 9:19 pm
Thank you, but that thread never had a conclusion.
It just petered out with a kludge.
No real solution offered.
The issue was never resolved. Thus, I ask it again.
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


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON

Post by DaveRiba » Sat May 29, 2021 12:58 am

Which is basically a non-answer
Thanks anyway for your non-support

Dave

Active Member

Posts

Joined
Wed Oct 07, 2020 11:41 pm

Post by ADD Creative » Sat May 29, 2021 4:35 am

DaveRiba wrote:
Fri May 28, 2021 2:34 am
Trying 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
What are in the first two lines of the XML output?

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.

www.add-creative.co.uk


Expert Member

Posts

Joined
Sat Jan 14, 2012 1:02 am
Location - United Kingdom

Post by DaveRiba » Sat May 29, 2021 5:02 am

Thank you for your response.
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.

Active Member

Posts

Joined
Wed Oct 07, 2020 11:41 pm

Post by ADD Creative » Sat May 29, 2021 5:51 am

You have two line feeds at the start of the XML at the URL. Whatever you are viewing it with is stripping them. But if you download the file they are there and this is what is giving you the error.

www.add-creative.co.uk


Expert Member

Posts

Joined
Sat Jan 14, 2012 1:02 am
Location - United Kingdom

Post by DaveRiba » Tue Jun 01, 2021 4:02 am

Thank 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">';

Active Member

Posts

Joined
Wed Oct 07, 2020 11:41 pm

Post by by mona » Tue Jun 01, 2021 4:16 am

You are adding line feeds to the top of the output, the xml file itself is fine.
3 (2).JPG

3 (2).JPG (77.12 KiB) Viewed 1359 times

when viewing the sitemap:
1 (2).JPG

1 (2).JPG (33.84 KiB) Viewed 1359 times

When viewing the source:
2 (2).JPG

2 (2).JPG (59.16 KiB) Viewed 1359 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


User avatar
Expert Member

Posts

Joined
Mon Jun 10, 2019 9:31 am

Post by by mona » Tue Jun 01, 2021 4:51 am

Look elsewhere - 3.0.3.6

Attachments

Screen-Shot-2021-05-31-at-21.47.42.jpg

Screen-Shot-2021-05-31-at-21.47.42.jpg (77.92 KiB) Viewed 1343 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


User avatar
Expert Member

Posts

Joined
Mon Jun 10, 2019 9:31 am

Post by ADD Creative » Tue Jun 01, 2021 7:47 am

DaveRiba wrote:
Tue Jun 01, 2021 4:02 am
Thank 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">';
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.

You could also use a file comparison program to compare against a clean download of the same version of OpenCart.

www.add-creative.co.uk


Expert Member

Posts

Joined
Sat Jan 14, 2012 1:02 am
Location - United Kingdom
Who is online

Users browsing this forum: No registered users and 251 guests