What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Messenger Plus! for Live Messenger » Scripting » [?] Using XML DOM "childNodes" property...

[?] Using XML DOM "childNodes" property...
Author: Message:
whiz
Senior Member
****


Posts: 568
Reputation: 8
– / – / Flag
Joined: Nov 2008
O.P. [?] Using XML DOM "childNodes" property...
I'm trying to use Node.childNodes (as opposed to enumerating Node.selectNodes(), so that I can access comments in interfaces, as well as windows, controls and elements.

...except that I don't know how to loop through one.  :S
Javascript code:
XMLO = new ActiveXObject("Microsoft.XMLDom"); // defined globally
if (XMLO.load(MsgPlus.ScriptFilesPath + "\\File.xml")) // load a file
{
    var WindowEnum = new Enumerator(XMLO.selectNodes("//Interfaces/Window"));
    for (; !WindowEnum.atEnd(); WindowEnum.moveNext()) // loop through each window in the file
    {
        var WindowId = WindowNode.getAttribute("Id");
        var WindowXMLPath = "//Interfaces/Window[@Id=\"" + WindowId + "\"]/";
        // process window size, position etc.
        var ControlEnum = XMLO.selectSingleNode(WindowXMLPath + "Controls").childNodes;
         // error: object required (-2146827864)
    }
}


Following instructions here: http://www.devguru.com/technologies/xmldom/quickr...de_childNodes.html
07-25-2010 11:37 AM
Profile E-Mail PM Find Quote Report
foaly
Senior Member
****

Avatar

Posts: 718
Reputation: 20
37 / Male / Flag
Joined: Jul 2006
RE: [?] Using XML DOM "childNodes" property...
quote:
Originally posted by whiz
Javascript code:
var ControlEnum = XMLO.selectSingleNode(WindowXMLPath + "Controls").childNodes;


just guessing here, but shouldn't there be slashes after WindowXMLPath ?

This post was edited on 07-25-2010 at 11:45 AM by foaly.
[signature.jpg]
07-25-2010 11:44 AM
Profile E-Mail PM Find Quote Report
whiz
Senior Member
****


Posts: 568
Reputation: 8
– / – / Flag
Joined: Nov 2008
O.P. RE: [?] Using XML DOM "childNodes" property...
The slashes are in the path variable.
Javascript code:
var WindowXMLPath = "//Interfaces/Window[@Id=\"" + WindowId + "\"]/";
                                                          // here ^

07-25-2010 12:11 PM
Profile E-Mail PM Find Quote Report
Eljay
Elite Member
*****

Avatar
:O

Posts: 2949
Reputation: 77
– / Male / –
Joined: May 2004
RE: [?] Using XML DOM "childNodes" property...
Are you sure the window actually has a "Controls" node? It seems to work fine here...

As for how to loop through them, you simply create an Enumerator like you have already done for the Windows.

JScript code:
var ControlEnum = new Enumerator(node.childNodes);
for(; !ControlEnum.atEnd(); ControlEnum.moveNext()) {
    ...
}

07-25-2010 02:50 PM
Profile PM Find Quote Report
whiz
Senior Member
****


Posts: 568
Reputation: 8
– / – / Flag
Joined: Nov 2008
O.P. RE: [?] Using XML DOM "childNodes" property...
Okay, I think I've got it working now.  :)
07-25-2010 03:06 PM
Profile E-Mail PM Find Quote Report
« Next Oldest Return to Top Next Newest »


Threaded Mode | Linear Mode
View a Printable Version
Send this Thread to a Friend
Subscribe | Add to Favorites
Rate This Thread:

Forum Jump:

Forum Rules:
You cannot post new threads
You cannot post replies
You cannot post attachments
You can edit your posts
HTML is Off
myCode is On
Smilies are On
[img] Code is On