Simple Xml Generator

Hi there,

As I needed to create some custom XMLs for a project I am working on, I have created an Yii extension based on a nice class which was developed by Simon Willison.

Using this simple extension, everyone will be easily able to generate an XML.


Hm. I think my approach is better ;)


Where can I found any description of how your approach does work?

Hm, there is none yet. It works roughly like this: A set of data is serialized into XML with help of domxml by the CXslViewRenderer which will then apply some XSL against that. In return: Generic XML of any flavour ;D

The FeedController of the blog demo should give a good example.

This works very good.

But when it shows the xml var on screen, it shws first line blank. This cause an XML error, because first xml line must be <?xml version="1.0" encoding="utf-8"?>

What can I do? Seems that yii create this blank line, and not the extension.



Hi Leo,

Would you please download again the .zip folder and just replace the xmlgenerator.php file on your application? It should work fine now, please let me know.


Hello Marco. It not works, it generate a clean page.

However, I just try ob_end_clean() and it works :)



Ops, it works locally, but not on my host… I´ll investigate it.

I know it’s a quite old thread but I’m stuck on the same problem…

I’m trying to generate a xml rss feed trough Controller but Yii keeps showing the first line blank.

I’m using an filter to remove blank lines from all pages on my RssController (this one) and I also put the ob_end_clean() in my rss layout. It’s working fine locally, however, on my host it keeps showing the blank first line :(

Any Ideas?