Xml parser fails - 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: Xml parser fails (/showthread.php?tid=83603)
Xml parser fails by SmokingCookie on 05-08-2008 at 05:22 PM
Hi,
I am currently gathering some experience witn the XMLDOM object.
I have a weird error, though, in the following piece of code:
code: var Notification = new Object();
XmlParser.load(MsgPlus.ScriptFilesPath + BackSlash + "Notifs.xml");
Key = MsgPlus.ScriptRegPath + BackSlash + "LastNotif";
LastNotif = RegRead(Key); // RegRead(Key) works fine.. My script basically relies on it
NodeName = "//Notification" + (LastNotif + 1);
Debug.Trace("> " + NodeName)
D = XmlParser.selectSingleNode(NodeName);
Notification.Name = D.attributes.getNamedItem("Name").value; // Line 1400
The error is:
Error detected in line 1400 of "Date calculator.js": Object required.
Can anyone please help me?
Tnx in advance..
RE: Xml parser fails by Matti on 05-08-2008 at 06:42 PM
A quick research pointed out that you were very close, but yet so far. There's no value child of the Node object, you should use the nodeValue property instead!
Even better: the return value of selectSingleNode is in your case an Element object (which is an extension of Node), so you can simply use D.getAttribute("Name") which is simpler, cleaner, more efficient and does the same thing.
code: D = XmlParser.selectSingleNode(NodeName);
Notification.Name = D.getAttribute("Name");
RE: Xml parser fails by SmokingCookie on 05-08-2008 at 07:52 PM
Quite complex, but I'll give it a try
EDIT::
Gives me "null".
WORKS!! ThanQ
Check your rep..
Now I have one small (off-topic) problem:
code: NotificationPages[i] = Script.MainUrl + D.getAttribute("Page"); // Works
WndNotifs.LstView_SetItemText("LstVNotifs",i,2,NotificationPages[i]);
Does nothing (2nd line)..
I am completely unfamiliar with the "LsdView_SetItemText(...)" function..
The column index is probably wrong (I need the 2nd column from the left; also tried 1)..
Could anyone please help me?
|