dylang/node-rss — pull request #6 by hermanjunge (2012-09-01 00:00:51+00:00)
Title: Enables more fields on items besides default and more namespaces in XML RSS Header

### Feature 1: Enables to add your custom fields on every item, since only default ones where parsed and included. Originally you can add just the following fields:

````javascript
title
description
url
guid
categories
author
date
`````
To add more fields, just define them in the item creation, like this:

````javascript
feed.item({
title: 'item 1',
description: 'description 1',
url: 'http://example.com/article1',
date: 'May 24, 2012 04:00:00 GMT',
'myClass:otherField': 'f06057b8b5877e75e7333074cc057e4d'
});

`````

### Feature 2: Enables to add more namespace definitions into the XML RSS Header using the function `xmlAddAttr (attrKey, attrValue)`. For example:

````javascript
feed.xmlAddAttr('xmlns:myClass', 'http://www.example.com/myClass');
`````

renders to:

````xml

````

### Running the tests

Step in the root of this module and run:

````bash
$ nodeunit test
````

You should get:

````bash
$ nodeunit test

test
✔ empty feed
✔ easy test
✔ easy test without image_url
✔ easy test without image_url with extra fields on items
✔ easy test without image_url with extra fields on items and an extra XML RSS Header

OK: 10 assertions (15ms)
````

(If you don't have [nodeunit](https://github.com/caolan/nodeunit), do like below)

````bash
$ [sudo] npm install -g nodeunit
````

Regards!

[Herman Junge](http://geekli.st/hermanjunge)