What am i doing wrong? i am not able to get the value of a tag inside a child attribute. Here is my xml:
<root>
<time c="00:00:00">
<title>Title</title>
<text>Some Text...</text>
</time>
<time c="00:00:01">
<title>Title 2</title>
<text>Some text...</text>
</time>
</root>
This is what i have done in node:
xml2js = require('xml2js');
fs = require('fs');
var parser = new xml2js.Parser();
var timetag = '00:00:01';
fs.readFile( 'test.xml', function(err, data) {
parser.parseString(data, function (err, result) {
function sendSubs() {
io.sockets.emit('subs', { subs: result.root.time[c=timetag].title });
}
setInterval(sendSubs, 1000);
});
});
Im sure thats a syntax issue but i dont see it!, and its possible to get the values of two childs like title and text?
Regards
See Question&Answers more detail:os