[split] help finding XML error - 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: [split] help finding XML error (/showthread.php?tid=75534)
RE: help!!! XML by Alxandr on 06-22-2007 at 10:15 AM
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)
RE: help!!! XML by markee on 06-22-2007 at 10:21 AM
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.
RE: [split] help finding XML error by Alxandr on 06-22-2007 at 10:57 AM
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);
}
}
}
}
|