What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Messenger Plus! for Live Messenger » Scripting » Help xml dom .removeChild()

Help xml dom .removeChild()
Author: Message:
psypersky
New Member
*


Posts: 1
Joined: Sep 2008
O.P. Help xml dom .removeChild()
Can someone help me whit this?

it always remove the first node <nick> no matter the value of "i"


jscript code:
var xml = new ActiveXObject("Microsoft.XMLDOM");
    var xml2 = new ActiveXObject("Microsoft.XMLDOM");
    var xmlIndent = new ActiveXObject("Microsoft.XMLDOM");
    xmlIndent.async = false;
    xmlIndent.loadXML(xsl);
    xml.async = false;
    xml.load(logFile);



    var node= xml.getElementsByTagName("Nicknames")[0];
    var y;
   
            Debug.Trace(node.childNodes.length);
           
    for(var i=0; i<node.childNodes.length; i++)
    {       
       
            if( node.childNodes[i].childNodes[0].nodeValue = window.LstView_GetItemText("LsvNicks", Index, 0) )
            {
           
                >>>y=xml.getElementsByTagName("Nick")[i];<<<
                >>>node.removeChild(y);<<<
                >>>Debug.Trace("entro!!");<<<
               
                break;
            }
    }
       
    xml.transformNodeToObject(xmlIndent, xml2);
    xml2.save(logFile);

the XML archive

xml code:
<?xml version="1.0" encoding="UTF-8"?>
<Nicknames>
    <Nick>uno</Nick>
    <Nick>dos</Nick>
    <Nick>tres</Nick>
    <Nick>cuatro</Nick>
    <Nick>cinco</Nick>
    <Nick>seis</Nick>
</Nicknames>

I find the problem

   
jscript code:
var xml = new ActiveXObject("Microsoft.XMLDOM");
    var xml2 = new ActiveXObject("Microsoft.XMLDOM");
    var xmlIndent = new ActiveXObject("Microsoft.XMLDOM");
    xmlIndent.async = false;
    xmlIndent.loadXML(xsl);
    xml.async = false;
    xml.load(logFile);



    var node= xml.getElementsByTagName("Nicknames")[0];
    var y;
   
            Debug.Trace(node.childNodes.length);
           
    for(var i=0; i<node.childNodes.length; i++)
    {       
       
            if( node.childNodes[i].childNodes[0].nodeValue[b] == [/b]window.LstView_GetItemText("LsvNicks", Index, 0) )
            {
           
                y=xml.getElementsByTagName("Nick")[i];
                node.removeChild(y);
                Debug.Trace("borrado");
                Debug.Trace(i)
               
                break;
            }
    }
       
    xml.transformNodeToObject(xmlIndent, xml2);
    xml2.save(logFile);

This post was edited on 11-12-2008 at 01:08 AM by psypersky.
11-11-2008 07:50 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