Xml2Rss Generator

PHP class


Xml2Rss is a helper class for easy RSS generation from an existing XML

Xml2Rss Generator PHP class

This class is an easy to use, simple XML to RSS generator. You can automatically convert your XML feed (or XML file) to a valid RSS 2.0 feed, with only a few required parameters.
Advanved features include setting of optional RSS feed fields, custom description HTML output, including images in the feed etc

Features:

 

Example: Simple generation

This example shows a minimum setting for the XML to RSS generation. You only need to set up the elemetnts, which are required by the RSS 2.0 standard

<?php
$x = new XmlToRss();
$x->url('example.xml')
  ->title('Rss test')
  ->description('Some RSS description')
  ->autoConvert(array(
    'description' => 'field1',
    'link' => 'field2',  
    'title' => 'field3',
    'pubDate'=>'field4',
    'guid'=>'field5',
));
?> 

To start generating, just  3 simple steps are needed.

1. Include the Xml2Rss PHP class in your code

<?php
  require_once("Xml2Rss.class.php");
?>

2. Make a new instance of the class

<?
  $x = new XmlToRss();
?>

3. Set up the required elements and start the geneation with the autoConvert() function

<?
  $x->url('example.xml');
  $x->title('Rss test');
  $x->description('Some RSS description');
  $x->map(array(
    'description' => 'field1',
    'link' => 'field2',  
    'title' => 'field3',
    'pubDate'=>'field4',
    'guid'=>'field5',
));
$x->autoConvert();

?>

 

As this class is an extension to the Xml2Csv class, so if you need some advanced ways of using it, please refer to the documentation of the Xml2Csv class

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Here you can find the complete reference of properties and functions:

If you want to see the converter in action, check out the live demo:

http://praca.webax.sk/xml2rss/torss.php