I'm creating a bot for the Discord. I'm downloading a horoscope XML-file from the Internet. The XML-file structure is as follows:
<?xml version="1.0" encoding="utf-8"?>
<horo>
<date yesterday="04.01.2019" today="05.01.2019" tomorrow="06.01.2019"/>
<aries>
<yesterday>
Text 1
</yesterday>
<today>
Text 2
</today>
<tomorrow>
Text 3
</tomorrow>
</aries>
......
</horo>
I try to read it in javascript:
const fs = require('fs');
var HoroscopeData = new Object();
fs.readFile('./module/Horoscope.xml', 'utf8', function(err, data){
if(err) {
console.error("ERROR");
}
console.log("OK");
HoroscopeData = data;
}
console.log(HoroscopeData);
In the console, I see the same thing that is in the XML-file
But I don't understand how to refer to "HoroscopeData" fields. How do I return a string which is in "aries->today"?