Shoutbox

help!!! XML - 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: help!!! XML (/showthread.php?tid=64309)

help!!! XML by cicklow on 08-01-2006 at 07:59 AM

this code return null... :(

code:
var Sec1 = 0;
var Min1 = 0;
var Hrs1 = 0;
var Days1 = 0;
var Weeks1 = 0;

    var xml = new ActiveXObject("Microsoft.XMLDOM");
    var file = MsgPlus.ScriptFilesPath + '/config.xml';
    xml.load(file);
    Sec1 = xml.selectSingleNode("/Sec/name");
    Min1 = xml.selectSingleNode("/Min/name");
    Hrs1 = xml.selectSingleNode("/Hrs/name");
    Days = xml.selectSingleNode("/Days/name");
    Weeks1 = xml.selectSingleNode("/Weeks/name");
    Debug.Trace("----" + Sec1);
// and error with:
// Debug.Trace("----" + Sec1.text);



in debug windows:

----null

the config.xml
code:
<Sec>
<name>0</name>
</Seg>
<Min>
<name>0</name>
</Min>
<Hrs>
<name>0</name>
</Hsr>
<Days>
<name>0</name>
</Days>
<Weeks>
<name>0</name>
</Weeks>


RE: help!!! XML by Silentdragon on 08-01-2006 at 08:20 AM

code:
Sec1 = xml.selectSingleNode("/Min/name");
I'm pretty sure you want /Sec/name

code:
<Sec>
<name>0</name>
</Seg>
I spy a spelling error

code:
<Hrs>
<name>0</name>
</Hsr>
And another

And Lastly if I recall xml files are only allowed one toplevel node, and don't forget to change the xpath accordingly.

code:
<Content>
<Sec>
<name>0</name>
</Sec>
<Min>
<name>0</name>
</Min>
<Hrs>
<name>0</name>
</Hrs>
<Days>
<name>0</name>
</Days>
<Weeks>
<name>0</name>
</Weeks>
</Content>

RE: help!!! XML by cicklow on 08-01-2006 at 08:29 AM

not :(, return... nothing

my code:

code:

function OnEvent_Signin(Email)
{
    var xml = new ActiveXObject("Microsoft.XMLDOM");
    var file = MsgPlus.ScriptFilesPath + '/config.xml';
    xml.load(file);
    Sec1 = xml.selectSingleNode("Content/Sec/name");
    Min1 = xml.selectSingleNode("Content/Min/name");
    Hrs1 = xml.selectSingleNode("Content/Hrs/name");
    Days = xml.selectSingleNode("Content/Days/name");
    Weeks1 = xml.selectSingleNode("Content/Weeks/name");
    Debug.Trace("----" + Sec1);
}


debug:
code:
El script está iniciandose
El script está cargado y listo
Función llamada: OnEvent_Signin
----

config.xml
code:
<Content>
    <Sec>
        <name>0</name>
    </Sec>
    <Min>
        <name>0</name>
    </Min>
    <Hrs>
        <name>0</name>
    </Hrs>
    <Days>
        <name>0</name>
    </Days>
    <Weeks>
        <name>0</name>
    </Weeks>
</Content>

some function that reads xml?

i speak spanish.. my English is of 65%
RE: help!!! XML by cooldude_i06 on 08-01-2006 at 08:31 AM

There are quite a few mistakes there. Heres the working code.

Code in js file

code:
function OnEvent_Initialize(MessengerStart)
{
var Sec1 = 0;
var Min1 = 0;
var Hrs1 = 0;
var Days1 = 0;
var Weeks1 = 0;

var xml = new ActiveXObject("Microsoft.XMLDOM");
var file = MsgPlus.ScriptFilesPath + '\\config.xml';
xml.load(file);
Sec1 = xml.documentElement.selectSingleNode("Sec/name");
Min1 = xml.documentElement.selectSingleNode("Min/name");
Hrs1 = xml.documentElement.selectSingleNode("Hrs/name");
Days1 = xml.documentElement.selectSingleNode("Days/name");
Weeks1 = xml.documentElement.selectSingleNode("Weeks/name");
Debug.Trace("Sec----" + Sec1.text);
Debug.Trace("Min----" + Min1.text);
Debug.Trace("Hrs----" + Hrs1.text);
Debug.Trace("Days----" + Days1.text);
Debug.Trace("Weeks----" + Weeks1.text);

}


config.xml
code:
<?xml version="1.0" encoding="iso-8859-1" ?>
<Time>
    <Sec>
        <name>0</name>
    </Sec>
    <Min>
        <name>0</name>
    </Min>
    <Hrs>
        <name>0</name>
    </Hrs>
    <Days>
        <name>0</name>
    </Days>
    <Weeks>
        <name>0</name>
    </Weeks>
</Time>


RE: help!!! XML by cicklow on 08-01-2006 at 08:37 AM

thanks, I work perfectly
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!