forked from michaelkourlas/node-js2xmlparser
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathexample.js
More file actions
39 lines (37 loc) · 827 Bytes
/
Copy pathexample.js
File metadata and controls
39 lines (37 loc) · 827 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
var js2xmlparser = require("../lib/js2xmlparser.js");
var data = {
"firstName": "John",
"lastName": "Smith",
"dateOfBirth": new Date(1964, 7, 26),
"address": {
"@": {
"type": "home"
},
"streetAddress": "3212 22nd St",
"city": "Chicago",
"state": "Illinois",
"zip": 10000
},
"phone": [
{
"@": {
"type": "home"
},
"#": "123-555-4567"
},
{
"@": {
"type": "cell"
},
"#": "456-555-7890"
}
],
"email": function() {return "john@smith.com";}
};
console.log(js2xmlparser("person", data));
console.log(js2xmlparser("person", data, {
wrapArray: {
enabled: true,
element: "item"
}
}));