Skip to content

Instantly share code, notes, and snippets.

@FruitieX
Created November 5, 2014 15:29
Show Gist options
  • Save FruitieX/09afb3542b1681525fee to your computer and use it in GitHub Desktop.
Save FruitieX/09afb3542b1681525fee to your computer and use it in GitHub Desktop.
var xml = require('xml');
var xmlString = xml({
'atom:entry':
[
{
'_attr': {
'xmlns:atom': 'http://www.w3.org/2005/Atom',
'xmlns:gd': 'http://schemas.google.com/g/2005'
}
},
{
'atom:category': {
'_attr': {
'scheme': 'http://schemas.google.com/g/2005#kind',
'term': 'http://schemas.google.com/contact/2008#contact'
}
}
},
{
'gd:name': [
{ 'gd:givenName': 'Elizabeth' },
{ 'gd:familyName': 'Bennet' },
{ 'gd:fullName': 'Elizabeth Bennet' }
]
},
{
'atom:content': [
{
'_attr': {
'type': 'text'
}
},
'Notes'
]
},
{
'gd:email': {
'_attr': {
'rel': 'http://schemas.google.com/g/2005#work',
'primary': 'true',
'address': 'liz@gmail.com',
'displayName': 'E. Bennet'
}
}
}
]
}, true);
console.log(xmlString);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment