What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Messenger Plus! for Live Messenger » Scripting » [HELP]weird xml problem

[HELP]weird xml problem
Author: Message:
DaAniv
Junior Member
**


Posts: 19
30 / Male / Flag
Joined: Jan 2009
O.P. [HELP]weird xml problem
Javascript code:
USS=USSD.getElementsByTagName("UserSentences")[0]

Javascript code:
(line 20) var name=USS.getElementsByTagName("UserSentence")[i].childNodes[0].text;
        Debug.Trace(name)

XML code:
<UserSentences>
    <UserSentence><command>pipy</command><sentence>pipy</sentence></UserSentence></UserSentences>

just wrote stuff in xml check if it works
it gets the name but it still says for some reason
code:
pipy
Error: Object required (code: -2146827864)
       File: xml.js. Line: 20.
Error: Object required (code: -2146827864)
       File: xml.js. Line: 20.

This post was edited on 01-26-2009 at 03:03 PM by DaAniv.
01-26-2009 03:00 PM
Profile E-Mail PM Find Quote Report
matty
Scripting Guru
*****


Posts: 8336
Reputation: 109
39 / Male / Flag
Joined: Dec 2002
Status: Away
RE: [HELP]weird xml problem
Can you post the entire contents of xml.js and we will take a look at it for you.

Javascript code:
getString('C:\\test.xml', '//UserSentences/UserSentence/command');
 
function getString(sXmlFile, sXmlId)
    try {
        var xml = new ActiveXObject('Microsoft.XMLDOM');
    } catch(e) {
        try {
            var xml = new ActiveXObject('MSXML2.DOMDocument');
        } catch(e) {
            return false;
        }
    }
    xml.async = true;
    xml.load(sXmlFile);
    Debut.Trace(xml.selectSingleNode(sXmlId).text);
}


This post was edited on 01-26-2009 at 03:14 PM by matty.
01-26-2009 03:07 PM
Profile E-Mail PM Find Quote Report
DaAniv
Junior Member
**


Posts: 19
30 / Male / Flag
Joined: Jan 2009
O.P. RE: [HELP]weird xml problem
Javascript code:
function OnEvent_Initialize(MessengerStart)
{
xml=new ActiveXObject("Microsoft.XMLDOM");
xml.async=true;
xmlFile=MsgPlus.ScriptFilesPath + "\\Settings.xml";
xml.load(xmlFile);
USSD=new ActiveXObject("Microsoft.XMLDOM");
USSD.async=true;
USSFile=MsgPlus.ScriptFilesPath + "\\UserSentences.xml";
USSD.load(USSFile);
USS=USSD.getElementsByTagName("UserSentences")[0]
GetColor()
}



this is the xml.js
Javascript code:
function saveSentences(SScommand,SSentence)
{  
    US=USSD.createElement("UserSentence")
    SC=USSD.createElement("command")
    SSC=USSD.createTextNode(SScommand)
    SS=USSD.createElement("sentence")
    SSS=USSD.createTextNode(SSentence)
    USS.appendChild(US)
    US.appendChild(SC)
    SC.appendChild(SSC)
    US.appendChild(SS)
    SS.appendChild(SSS)
    USSD.save(USSFile)
}
function GetUserSentences()
{
    children=USS.getElementsByTagName("UserSentence").length
    for(i=0;i<=children;i++)
    {
        var name=USS.getElementsByTagName("UserSentence")[i].childNodes[0].text;
        Debug.Trace(name)
        commands+='<Command>';
            commands+='<Name>'+name+'</Name>';
        commands+='</Command>';
    }
}


This post was edited on 01-26-2009 at 04:32 PM by DaAniv.
01-26-2009 03:19 PM
Profile E-Mail PM Find Quote Report
DaAniv
Junior Member
**


Posts: 19
30 / Male / Flag
Joined: Jan 2009
O.P. RE: [HELP]weird xml problem
it also tells me when the sent message isn't a commend in the xml
code:
Error: Object required (code: -2146827864)
       File: Sentences.js. Line: 570.
Function OnEvent_ChatWndSendMessage returned an error. Code: -2147352567

it's in a function OnEvent_ChatWndSendMessage(ChatWnd, Message){
Javascript code:
for(i=0;i<=children;i++)
{
    if(Message.toLowerCase()=="/"+USS.getElementsByTagName("UserSentence")[i].childNodes[0].text)
    {
        RMessage=Find(USS.getElementsByTagName("UserSentence")[i].childNodes[1].text)
        break;
    }
}


This post was edited on 01-26-2009 at 04:44 PM by DaAniv.
01-26-2009 04:43 PM
Profile E-Mail PM Find Quote Report
ShawnZ
Veteran Member
*****

Avatar

Posts: 3146
Reputation: 43
32 / Male / Flag
Joined: Jan 2003
RE: [HELP]weird xml problem
wtf, when did the forums get syntax highlighting?!
Spoiler:
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
01-26-2009 04:49 PM
Profile PM Web Find Quote Report
matty
Scripting Guru
*****


Posts: 8336
Reputation: 109
39 / Male / Flag
Joined: Dec 2002
Status: Away
RE: [HELP]weird xml problem
quote:
Originally posted by ShawnZ
wtf, when did the forums get syntax highlighting?!
WDZ's reply to [code][/code] suggestion
01-26-2009 04:54 PM
Profile E-Mail PM Find Quote Report
DaAniv
Junior Member
**


Posts: 19
30 / Male / Flag
Joined: Jan 2009
O.P. RE: [HELP]weird xml problem
solved it my problem I did <=children not <children :P
01-26-2009 05:19 PM
Profile E-Mail PM Find Quote Report
matty
Scripting Guru
*****


Posts: 8336
Reputation: 109
39 / Male / Flag
Joined: Dec 2002
Status: Away
RE: [HELP]weird xml problem
quote:
Originally posted by DaAniv
solved it my problem I did <=children not <children :P
Sorry I didn't get a chance to look over it fully to help out. The reason it is like this is because .Length isn't 0 based which means it does not start counting at 0. You can either do .length-1 or not include the = in your condition.
01-26-2009 05:50 PM
Profile E-Mail PM Find Quote Report
DaAniv
Junior Member
**


Posts: 19
30 / Male / Flag
Joined: Jan 2009
O.P. RE: [HELP]weird xml problem
thanks anyway ^_^
01-26-2009 05:53 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