473,322 Members | 1,494 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

"node.InsertAfter" method only inserts node on final call

hiya,

I succesfully return a "nodeList" thru the "xmlDoc.SelectNodes" method.
This nodeList is taken from a repetitive, uniform xml doc.

I can successfully append a child node at the correct position using the
following code:

<code>
<!--Node inserted into corrrect position in nodeList(0)-->
nodeList(0).InsertAfter(additionalNode, nodeList(0).ChildNodes(5))
</code>

however, as soon as I try to do the same with nodeList(1), then
apparently the SAME code that previously inserted the node into
nodeList(0) doesn't do its job.

<code>
<!--Node NOT inserted into nodeList(0)-->
nodeList(0).InsertAfter(additionalNode, nodeList(0).ChildNodes(5))

<!--Node inserted into corrrect position in nodeList(1)-->
nodeList(1).InsertAfter(additionalNode, nodeList(1).ChildNodes(5))
</code>
Surely, If i am using the "InsertAfter" method, then the node should
have been inserted BOTH times?

As a test, I swapped my code round, and I can confirm that the node is
ONLY inserted on the 2nd call.

<code>
<!--Node NOT inserted into nodeList(1)-->
nodeList(1).InsertAfter(additionalNode, nodeList(1).ChildNodes(5))

<!--Node inserted into corrrect position in nodeList(0)-->
nodeList(0).InsertAfter(additionalNode, nodeList(0).ChildNodes(5))
</code>

Can someone comment?I have been spent a bit of time on this, and am no
further forward.
Even if i could get hold of some sample code in vb / c# that did this,
then I'm sure I could take it from there ;-)

ta,
yogiberr

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Jul 20 '05 #1
1 3705
/chris yoker/:
<code>
<!--Node NOT inserted into nodeList(0)-->
nodeList(0).InsertAfter(additionalNode, nodeList(0).ChildNodes(5))

<!--Node inserted into corrrect position in nodeList(1)-->
nodeList(1).InsertAfter(additionalNode, nodeList(1).ChildNodes(5))
</code>
Surely, If i am using the "InsertAfter" method, then the node should
have been inserted BOTH times?

As a test, I swapped my code round, and I can confirm that the node is
ONLY inserted on the 2nd call.

<code>
<!--Node NOT inserted into nodeList(1)-->
nodeList(1).InsertAfter(additionalNode, nodeList(1).ChildNodes(5))

<!--Node inserted into corrrect position in nodeList(0)-->
nodeList(0).InsertAfter(additionalNode, nodeList(0).ChildNodes(5))
</code>
Surely it is inserted both times but it is getting removed prior
inserting it the second time. There's no 'InsertArfter' method in
the standard DOM interfaces but if you look at the
'Node.appendChild' [1], 'Node.insertBefore' [2] and
'Node.replaceChild' [3] documentation you would find:
If the 'newChild' is already in the tree, it is first removed.


[1] http://www.w3.org/TR/DOM-Level-2-Cor...ml#ID-184E7107
[2] http://www.w3.org/TR/DOM-Level-2-Cor...l#ID-952280727
[3] http://www.w3.org/TR/DOM-Level-2-Cor...l#ID-785887307

--
Stanimir
Jul 20 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: John | last post by:
Hi, I have an application which is built from many modules. I re-use the modules in different applications. I'd like to have each of my modules implement a "SaveState()" method. The method...
8
by: chris yoker via DotNetMonster.com | last post by:
hiya, I succesfully return a "nodeList" thru the "xmlDoc.SelectNodes" method. This nodeList is taken from a repetitive, uniform xml doc. I can successfully append a child node at the correct...
4
by: Thiru | last post by:
Hi, Greetings to All. I have encountered a problem while working on DB2 Governer. I build my configuration file as below.(Just for practise) desc "Restrict the Unit of Work to be less then 1...
8
by: Don Wash | last post by:
Hi There! I'm using VB.NET to create a TreeView application and unfortunately I could not find "Key" property in Node items of the TreeView. We used to have "Key" property in TreeView node...
2
by: yawnmoth | last post by:
When I visit the following webpage: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <title>Test</title> </head> <body> <div id="demo">this is a test...</div>
2
by: syvman | last post by:
Hi... I am working on a simple program (in VB.net) that will grab the values of elements out of an XML file that are tagged as "databasePath"... My program works, but I am getting too many...
7
by: dennis.sprengers | last post by:
I am trying to write an editor object, which adds some functionality and a toolbar to every textarea with a "form-textarea" class. Both FF and IE generate an error in line 20...
2
by: Fred | last post by:
"Warning: session_start() : Node no longer exists in" the call to session_start() on my page. Seemingly, the error comes and goes. From what I've gathered, this is some bug which arises when...
2
by: Tom Chang | last post by:
Try to read following type of XML file, but only get data back on first node: <log id="1234"> <message type="Action"/> </log> <log id="5678"> <message type="Drama"/> </log> <log id="1357">
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.