Project

General

Profile

Actions

Bug #63899

closed

Rendering XML output with the PAGE object goes wrong in TYPO3 6.2.x

Added by Arek van Schaijk almost 10 years ago. Updated almost 9 years ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
Content Rendering
Target version:
-
Start date:
2014-12-15
Due date:
% Done:

0%

Estimated time:
TYPO3 Version:
6.2
PHP Version:
5.5
Tags:
Complexity:
Is Regression:
No
Sprint Focus:

Description

It looks like TYPO3 doesn't render the XML output well in TYPO3 6.2.x by using the TypoScript PAGE object.

I'm using the following configuration:

xmlsitemap = PAGE
xmlsitemap {
    typeNum = 1234
    10 = USER_INT
    10 {
        userFunc = TYPO3\CMS\Extbase\Core\Bootstrap->run
        pluginName = Pi1
        extensionName = MyExt
        vendorName = TYPO3
        controller = XmlSitemap
        action = render
        switchableControllerActions {
            XmlSitemap {
                1 = render
            }
        }
    }
    config {
        disableAllHeaderCode = 1
        additionalHeaders = Content-type:text/xml
        xhtml_cleaning = 0
        admPanel = 0
        debug = 0
    }
}

The controller returns the following content (this works fine in 4.5, 4.6 and 4.7):

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
  <url>
    <loc>https://www.domain.com/</loc>
    <lastmod>2014-11-20T11:37:00+01:00</lastmod>
    <changefreq>monthly</changefreq>
  </url>
  [..]
</urlset>

But in 6.2.x the output looks like:

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
<?xml version="1.0" encoding="UTF-8"?><html><body><urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"><url><loc>http://www.domain.com/</loc><lastmod>2014-12-12T14:12:35+01:00</lastmod><changefreq>monthly</changefreq></url>[..]</urlset></body></html>

- Everything is rendered on a single line (error on line 2 at column 6: XML declaration allowed only at the start of the document).
- HTML and BODY tag are added.

I've tried also this configuration but it didn't work:

xmlsitemap = PAGE
xmlsitemap {
    typeNum = 1234
    10 = USER_INT
    10 {
         [..]
    }
    config {
        [..]
        xmlprologue = <?xml version="1.0" encoding="[config.renderCharset]">
        config.doctype (
            <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
        )
    }
}

So it looks like TYPO3 6.2.x doesn't render the XML output well.

Actions #1

Updated by Mathias Schreiber almost 10 years ago

  • Status changed from New to Needs Feedback

Does it work with this?


xmlsitemap = PAGE
xmlsitemap {
    typeNum = 1234
    1 = TEXT
    1.value = <?xml version="1.0" encoding="utf-8">
    10 = TEXT
    10.value = <node>Hi</node>
    config {
        disableAllHeaderCode = 1
        additionalHeaders = Content-type:text/xml
        xhtml_cleaning = 0
        admPanel = 0
        debug = 0
    }
}
Actions #2

Updated by Riccardo De Contardi almost 10 years ago

Tested with TYPO3 6.2.9, WAMP enviroment, PHP 5.5.12:

@Mathias Schreiber
the prologue is a bit wrong ;) nonetheless with:

page >
xmlsitemap = PAGE
xmlsitemap {
    typeNum = 1234
    1 = TEXT
    1.value = <?xml version="1.0" encoding="utf-8"?>
    10 = TEXT
    10.value = <node>Hi</node>
    config {
        disableAllHeaderCode = 1
        additionalHeaders = Content-type:text/xml
        xhtml_cleaning = 0
        admPanel = 0
        debug = 0
    }
}

in my root TS Template, the resulting page is (source):
<?xml version="1.0" encoding="utf-8"?><node>Hi</node>

I also tried to use
xmlsitemap.config.xmlprologue = xml_10

or
config.xmlprologue = xml_10

But it seems that the config.xmlprologue works only when config.disableAllHeaderCode = 0

Actions #3

Updated by Markus Klein over 9 years ago

Is this still an issue on 6.2.12?

Actions #4

Updated by Riccardo De Contardi over 9 years ago

@Markus: I have not tried, but, before doing so, I will try to explain why I am not sure if there is an issue at all...

1) As far as I can remember, the way to remove all the html+head+body tags is

config.disableAllHeaderCode = 1

then the output is completely blank and you can write the PAGE object as you like. Am I correct?

2) About:

config.xmlprologue = xml_10

as I said, it does not work when config.disableAllHeaderCode = 1, but...let me ask: can this be considered the standard behavior or not?

Actions #5

Updated by Alexander Opitz about 9 years ago

What is the state of this issue?

Actions #6

Updated by Riccardo De Contardi about 9 years ago

I just tried with TYPO3 7.5-dev (current master), using the code in comment N°2, and the result is the same.
As I said, if you use

config.disableAllHeaderCode = 1

Then the output is a completely empty slate and you can write whatever you want and config.xmlprologue = xml_10 does nothing.

Using:

config.disableAllHeaderCode = 0

then config.xmlprologue = xml_10 works.

can this be considered the standard behavior?

Actions #7

Updated by Alexander Opitz almost 9 years ago

  • Status changed from Needs Feedback to Closed

No feedback within the last 90 days => closing this issue.

If you think that this is the wrong decision or experience this issue again, then please write to the mailing list typo3.teams.bugs with issue number and an explanation or open a new ticket and add a relation to this ticket number.

Actions

Also available in: Atom PDF