Shoutbox

Read from XML - Printable Version

-Shoutbox (https://shoutbox.menthix.net)
+-- Forum: MsgHelp Archive (/forumdisplay.php?fid=58)
+--- Forum: Messenger Plus! for Live Messenger (/forumdisplay.php?fid=4)
+---- Forum: Scripting (/forumdisplay.php?fid=39)
+----- Thread: Read from XML (/showthread.php?tid=67790)

Read from XML by Joakin on 10-28-2006 at 06:57 PM

I dont know nothing about that. I am a beginin... So.. Can you help me please??

ok.. this is what i want...

I have to read some ¿variables? from a XML... From this XML archive.
I need to read some variables like TotalKeyCount, TotalMouseClicks, etc.

And then send by menssage like: I have been made "TotalKeyCount" keys.

i dont know what i have to do... please someone help me! *-)

thanks...

(Sorry for my Bad English)


RE: Read from XML by Matti on 10-28-2006 at 07:13 PM

You can use the Microsoft XML object for this. :)

code:
var xml = new ActiveXObject('Microsoft.XMLDOM'); //Create the ActiveX object
xml.load("http://whatpulse.org/api/users/171247.xml"); //Load the XML file
var totalKeyCount = xml.selectNodes("/UserStats/TotalKeyCount/text()"); //Get the text from the node
var message = "I have made "+totalKeyCount+" key strokes."; //Create a message
ChatWnd.SendMessage(message); //Send the message --- Make sure ChatWnd is defined!!!
Normally, it should work perfectly. ;)

RE: Read from XML by Joakin on 10-28-2006 at 07:32 PM

Thank you so much!
What i have to do to define the ChatWnd xD :S


RE: RE: Read from XML by Felu on 10-28-2006 at 07:45 PM

quote:
Originally posted by Joakin
What i have to do to define the ChatWnd xD :S

The ChatWnd is the Window with a contact to whom you want to send the message to. To use the ChatWnd the ChatWnd should already be created or you'll have to create a chatwnd.
RE: Read from XML by Joakin on 10-28-2006 at 07:48 PM

Testing the code i write this:

code:
function wp(ChatWnd){
var xml = new ActiveXObject('Microsoft.XMLDOM');

//Create the ActiveX object
xml.load("http://whatpulse.org/api/users/171247.xml");
//Load the XML file
var totalKeyCount = xml.selectNodes("/UserStats/TotalKeyCount/text()");
//Get the text from the node
var message = "I have made "+totalKeyCount+" key strokes.";
//Create a message
ChatWnd.SendMessage(message);
//Send the message --- Make sure ChatWnd is defined!!!
}


And i write in my first chat window: /script wp 1

but the menssage is:   Joakin dice (16:42):
I have made  key strokes.

it doesnt show the numbers.
:(
RE: Read from XML by Spunky on 10-28-2006 at 09:38 PM

The xml in the first link has an error (reported error anyways) and so can't be read. Try fixing your xml file and then trying again


RE: Read from XML by Joakin on 10-28-2006 at 09:51 PM

the error is that the xml dont have style. but it is not necesary. I think. Becouse it used in mane others script in php or IRC script. And I cant modified the XML.