appendChild is changing the owner of the child node and making it the
last child of the parent. Therefore it will have no siblings after it.
You could clone the node and append the clone (if a copy is desired)
or compute the sibling BEFORE performing the append [which is what your
workaround is doing altho a cleaner approach can be done]
HTH,
Larry
For anyone interested, below is my workaround, although I'd still like
to know why my first attempt failed. Thanks..
var child = node.firstChild.firstChild;
var theID=;
var nodeArray = new Array();
var i = 0;
var myGeometryToAdd = '';
while (child != null) {
if(child.nodeType==1){
nodeArray[i] = child;
i=i+1;
}
child = child.nextSibling;
}
for (x=0; xi; x++) {
theID = nodeArray[x].getAttributeNS(null,id);
myGeometryToAdd = document.getElementById(theID+1);
myGeometryToAdd.appendChild(nodeArray[x]);
}
Sean wrote:
There is still one thing nagging me about parseXML. Below is a while
loop that should work, at least as far as I know, but doesn't. The
alerts display the contents of the node, thank you ctl271. If I comment
out myGeometryToAdd.appendChild(child);, all of the child nodes in the
loop and all of the myGeometryToAdd are iterated through, as is proven
by the alerts. Which is all well and good, but I need to append those
child nodes, which is where the problems arise. After the first child
is appended with myGeometryToAdd.appendChild(child);, the loop stops.
When it gets to the second child node it is set to null.
var child = node.firstChild.firstChild;
var theID;
var myGeometryToAdd;
while (child != null) {
if(child.nodeType==1){
theID = child.getAttributeNS(null,id);
myGeometryToAdd = document.getElementById(theID+1);
alert(window.printNode(child));
alert(window.printNode(myGeometryToAdd));
myGeometryToAdd.appendChild(child);
}
child = child.nextSibling;
}
-
To unsubscribe send a message to: [EMAIL PROTECTED]
-or-
visit http://groups.yahoo.com/group/svg-developers and click edit my
membership
Yahoo! Groups Links
.
-
To unsubscribe send a message to: [EMAIL PROTECTED]
-or-
visit http://groups.yahoo.com/group/svg-developers and click edit my
membership
Yahoo! Groups Links
-
To unsubscribe send a message to: [EMAIL PROTECTED]
-or-
visit http://groups.yahoo.com/group/svg-developers and click edit my
membership
Yahoo! Groups Links
* To visit your group on the web, go to:
http://groups.yahoo.com/group/svg-developers/
* To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
* Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/