MODX Community

XML file error : html tags generated despite empty template using the adaptiveimage plugin

Hi all,
Getting a weird error when generating manually (no plugin) a simple sitemap index file.

Using Modx 2.7.3 on a Apache server, i don’t get this error with an older site on the very same server where i am still using 2.6.5 and haven’t done the migration to 2.7 yet

!DOCTYPE html PUBLIC “-//W3C//DTD HTML 4.0 Transitional//EN” "http://www.w3.org
?xml version=“1.0” encoding=“UTF-8”?
html
body
sitemapindex xmlns=“https://www.sitemaps.org/schemas/sitemap/0.9” sitemap loc

and then /sitemap/sitemapindex
/body/html at the end.

obviously we dont want the DOCTYPE and the html, body tags triggering the error

With the template empty and the xml type selected , i really don’t understand why these html tags
are automatically generated ??

To generate the resource : document template empty, settings : document, xml, inline and all boxes empty except empty cache
Emptied cache several times including manually with Filezilla

Any idea re this error ?
Thanks

PS : how do you insert code into a post, i had to remove the <

You can type three backticks ``` on their own above and below your code block or single backticks to just format one line as code.

Can you come back edit the code so we can see the proper code wrapped in ```?

Is there by chance a file on the file system with the same alias/extension? If there is, the server will server that instead of the MODX Resource.

Also, can you show a screen shot of what you’re seeing in the edit view including the template? It would be good to also see the output of the view source. Does changing the resource content change anything? How are you generating the sitemap? Are you manually editing the xml in the resource?

Hi and thanks for your answers
Below is the code of the xml resource generated :

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" ***">
<?xml version="1.0" encoding="UTF-8"?>
<html><body>

<sitemapindex xmlns="***">
* * *
</lastmod>
</sitemap>
</sitemapindex>

</body></html>

No other identical alias.xml file on line
snapshots (resource has been published initially, unpublished following this error)

i typed “void” instead in the content field to check, i get the same tags

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
<html><body><p>void</p></body></html>

Sitemap index manually written

Sounds like the rich text editor is working despite the box unticked ??

Thanks !

PS : am using the adaptiveimage plugin (just seen in an older forum thread this could be the issue)
Is there a way to disable a plugin when the template is empty ?

It seems that the issue was fixed in the code (https://bitbucket.org/seilersteinbachgmbh/modx-adaptive-image/src/137b63ddffc818b9008a6a39df8957ed21f89923/core/components/adaptiveimage/elements/plugins/adaptiveimage.php#lines-53) but then never distributed in a new version of the extra.

So add this line to your plugin-code. (Check the link above to see where to place it in the code).

if($modx->resource->content_type != 1) return;

Solved
Many thanks for your help as i wouldn’t have found this on my own !
Cheers

PS : Is there a way to modify the subject of this thread ? I would have liked to add AdaptiveImage plugin
in my first post title for others facing the same pb., but cannot edit this post anymore

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.

Hi @justinet how would you like the thread retitled? I’ll happily edit it for you so it better helps future readers.