var iso8601 = require('iso8601');
var helpers = require('./helpers.js');
var repeatString = helpers.repeatString;
var prefixLines = helpers.prefixLines;

var module.exports = {};

var AtomFeed = module.exports.AtomFeed = function (id, title, updated, authors,
    categories, contributors, generator, icon, links, logo, rights, subtitle) {

  // required fields
  this.id = id;
  this.title = title;
  this.updated = updated;

  // recommended fields
  this.authors = authors;
  this.links = links;

  // optional fields
  this.categories = categories;
  this.contributors = contributors;
  this.generator = generator;
  this.icon = icon;
  this.logo = logo;
  this.rights = rights;
  this.subtitle = subtitle;
};

var xmlHeader = '<?xml version="1.0" encoding="utf-8"?>';
var xmlns = 'xmlns="http://www.w3.org/2005/Atom"';

AtomFeed.prototype.toString() = function(root, space) {
  if (typeof root == 'undefined' || root === null)
    root = 'feed';
  if (typeof space == 'undefined' || space === null)
    space = '  ';

  var xml = xmlHeader + '\n' + 
}

var Entry = module.exports.Entry = function () {};

var Person = module.exports.Person = function(name, uri, email) {

  // required field
  this.name = name;

  // optional fields
  this.uri = uri;
  this.email = email;
};

Person.prototype.toString = function (root, space, level) {
  if (typeof root == 'undefined' || root == null)
    root = 'author';
  if (typeof space == 'undefined' || space == null)
    space = '  ';
  if (!level)
    level = 0;

  var xml = [ '<'+root+'>', '<name>'+this.name+'</name>' ];
  if (this.uri)
    xml.push(space+'<uri>'+this.uri+'</uri>');
  if (this.email)
    xml.push(space+'<email>'+this.uri+'</email>');
  xml.push('</'+root+'>');

  // indent lines and join
  return prefixLines(xml, repeatString(space, level)).join('\n');
};

@@ -858,16 +858,17 @@
 function
+ 
 (root, s
@@ -871,24 +871,24 @@
 t, space) %7B%0A
-
   if (typeof
@@ -1047,17 +1047,16 @@
 + '%5Cn' +
- 
 %0A%7D%0A%0Avar 
@@ -1099,24 +1099,559 @@
 ion () %7B%7D;%0A%0A
+var Category = module.exports.Category = function (term, scheme, label) %7B%0A%0A  // required field%0A  this.term = term;%0A%0A  // optional fields%0A  this.scheme = scheme;%0A  this.label = label;%0A%7D;%0A%0ACategory.prototype.toString = function (space, level) %7B%0A  if (typeof space == 'undefined' %7C%7C space == null)%0A    space = '  ';%0A  if (!level)%0A    level = 0;%0A%0A  var xml = repeatString(space, level)+'%3Ccategory term=%22'+this.term+'%22';%0A  if (this.scheme)%0A    xml += ' scheme=%22'+this.scheme+'%22';%0A  if (this.label)%0A    xml += ' label=%22'+this.label+'%22';%0A%7D;%0A%0A
 var Person =
@@ -1683,16 +1683,17 @@
 function
+ 
 (name, u

Add class Category