The core of my website is an XML-file master.xml. I am trying to create feeds out of it, a classic rss-feed and a podcast-feed, which means XML to XML.
The first method I tried was creating a real XML-file with PHP's DomDocument, but I ran into fundamental problems. Even if it works correctly, it still creates a file which is not the file that is being requested.
Now I have changed podcast.xml into podcast.php and echo the XML-declaration and the XML-markup with a loop of the items. Readers like iTunes work perfectly with that. But the browsers can't be fooled for real.
Chrome puts the content into a pseudo-HTML-file and displays plain text, ignoring the xsl-stylesheet. Nonetheless it displays nothing but XML in the codeview.
Firefox displays it like a real XML-file, but in the codeview it shows the closing reddishly as if the was a markup error (which is not the case).
That makes me (as a private person with ambition) wonder how professionals deal with the desire to create feeds dynamically. Surely, I am not the first person who is trying this.
Copyright Notice:Content Author:「Helen」,Reproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/40467445/creating-xml-file-with-php-dynamically-general-strategy