What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Messenger Plus! for Live Messenger » Scripting » [Help] Enumerating XML nodes...

[Help] Enumerating XML nodes...
Author: Message:
whiz
Senior Member
****


Posts: 568
Reputation: 8
– / – / Flag
Joined: Nov 2008
O.P. RE: [Help] Enumerating XML nodes...
quote:
Originally posted by matty
This is code from Screenshot Sender to enumerate controls it could be altered to do what you would need it to do:

js code:
/*
    Name:     EnumControls
    Purpose:    Enum the controls from a specified window
    Parameters: File - The name of the file
             pPlusWnd - The Plus! window object
    Return:     None
*/
function EnumControls ( File , pPlusWnd ) {
    _debug.getfuncname ( arguments ) ;
    // Load the XML from the specified file
    var XML = new ActiveXObject ( 'MSXML.DOMDocument' ) ;
    XML.load ( File ) ;
    // Loop through all of the controls
    var Controls = XML.selectNodes ( '/Interfaces/Window [ @Id='' + pPlusWnd.WindowId + '' ] /Controls/Control' ) ;
    for ( i=0 ; i<Controls.length ; i ++) {
        var Id = Controls [ i ].getAttribute ( 'Id' ) ;
        var Type = Controls [ i ].getAttribute ( 'xsi:type' ) ;
        // Get the value depending on the control's type
        objControls [ Id ] = {} ;
        objControls [ Id ].XsiType = Type ;
        objControls [ Id ].Value = pPlusWnd_GetControlvalue ( pPlusWnd , Id , Type ) ;
    }
}

That loops through all of the controls, but I need it to loop through all the children of the controls.  The problem I have is that some nodes, like the <Image> node, store their data in another child, meaning that I have to do a loop in a loop, in a loop, and so on.

Obviously, I can only go so far, and I'd rather just have the entire code, but I don't think that can be done, unless I don't use the XML DOM, and start checking each line through the FileSystemObject.  But that's a bit ridiculous.  :S

EDIT: Done it now.  Ended up using the nodeObj.xml property, and filtering out the recognized bits.  Perhaps not the best method, but it works.  :P
js code:


This post was edited on 11-16-2009 at 08:39 PM by whiz.
11-16-2009 07:36 PM
Profile E-Mail PM Find Quote Report
« Next Oldest Return to Top Next Newest »

Messages In This Thread
[Help] Enumerating XML nodes... - by whiz on 11-16-2009 at 07:14 PM
RE: [Help] Enumerating XML nodes... - by matty on 11-16-2009 at 07:27 PM
RE: [Help] Enumerating XML nodes... - by whiz on 11-16-2009 at 07:36 PM
RE: [Help] Enumerating XML nodes... - by Matti on 11-17-2009 at 06:42 PM
RE: [Help] Enumerating XML nodes... - by matty on 11-17-2009 at 07:08 PM
RE: [Help] Enumerating XML nodes... - by whiz on 11-18-2009 at 03:22 PM


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