What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Messenger Plus! for Live Messenger » Scripting » [split] help finding XML error

[split] help finding XML error
Author: Message:
Alxandr
New Member
*


Posts: 7
34 / Male / Flag
Joined: Jun 2007
O.P. RE: help!!! XML
Can any1 find the error in this?
code:
    var xml = new ActiveXObject("Microsoft.XMLDOM");
    var file = MsgPlus.ScriptFilesPath + '\\test.xml';
    Debug.Trace(file);
    xml.load(file);
    Debug.Trace(xml.documentElement.selectSingleNode("Profiles/Profile").text);

The XML looks like this:
code:
<?xml version="1.0" encoding="iso-8859-1" ?>
<Profiles>
    <Profile Email="aleksander_heintz@hotmail.com">
        <SpecialUser Email="iddy_58@hotmail.com" Name="Ida" />
    </Profile>
</Profiles>

I get the error
code:
Feil: Krever objekt.
       Linje: 28. Kode: -2146827864. (translated: Error: Demands an object)
06-22-2007 10:15 AM
Profile E-Mail PM Web Find Quote Report
markee
Veteran Member
*****

Avatar

Posts: 1622
Reputation: 50
36 / Male / Flag
Joined: Jan 2006
RE: help!!! XML
This is because you are making it an attribute rather than text inside the node.  Check out this site for more information on how to do the stuff you are after.
[Image: markee.png]
06-22-2007 10:21 AM
Profile PM Find Quote Report
Alxandr
New Member
*


Posts: 7
34 / Male / Flag
Joined: Jun 2007
O.P. RE: [split] help finding XML error
Dan... Look at this code:
code:
    var xml = new ActiveXObject("Microsoft.XMLDOM");
    var file = MsgPlus.ScriptFilesPath + '\\test.xml';
    xml.load(file);
    var Profile_nodes = xml.getElementsByTagName("Profile");
    var numProfiles = Profile_nodes.length;
    for(i = 0; i < numProfiles; i++){
        var attributes = Profile_nodes.item( i ).attributes;
        var thisUser = false;
        for(x = 0; x < attributes.length; x++){
            if(attributes[x].name == "Email" && attributes[x].value == Messenger.MyEmail){
                Debug.Trace("Fant online user!");
                thisUser = true;
            }
        }
        if(thisUser){
            var spessUsers = Profile_nodes.item( i ).childNodes;
            for(x = 0; x < spessUsers.length; x++){
                var att = spessUsers[x].attributes;
                for(y = 0; y < att.length; y++){
                    Debug.Trace("--" + att[y].name + " = " + att[y].value);
                }
            }
        }
    }
06-22-2007 10:57 AM
Profile E-Mail PM Web 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