New topic: 

Node.Replace Doesn't seem to work

<http://forums.realsoftware.com/viewtopic.php?t=47754>

         Page 1 of 1
   [ 2 posts ]                 Previous topic | Next topic          Author  
Message        mamerica          Post subject: Node.Replace Doesn't seem to 
workPosted: Wed May 01, 2013 12:00 pm                         
Joined: Sun Jul 01, 2012 5:40 pm
Posts: 16                My app allows users to copy and paste settings from 
one place to another. All of the settings are stored in an xml file. When the 
user chooses copy, I set a reference to the corresponding node. When they click 
paste, I want to overwrite the new node.

I receive the xml error "Reference to a Non Existent Node". Which is strange 
because both the target and source xmlNodes show up in the debug window as 
xmlNodes and have all the properties and methods of an xmlNode. 

Has anyone used this function successfully? There is another similar question 
on this forum without a response. I've been trying to get this to work for a 
couple of days and I'm beginning to wonder if it even works.   
                             Top                timhare          Post subject: 
Re: Node.Replace Doesn't seem to workPosted: Wed May 01, 2013 12:50 pm          
               
Joined: Fri Jan 06, 2006 3:21 pm
Posts: 12273
Location: Portland, OR  USA                Here is a working example:
dim doc as new xmldocument
dim root, n1, n2, val as xmlnode

root= doc.AppendChild(doc.CreateElement("root"))
n1= root.AppendChild(doc.CreateElement("name"))
val= n1.AppendChild(doc.CreateTextNode("Sam Snee"))

n2= doc.CreateElement("name")
val= n2.AppendChild(doc.CreateTextNode("Joe Cool"))

root.ReplaceChild(n2, n1)
   
                             Top             Display posts from previous: All 
posts1 day7 days2 weeks1 month3 months6 months1 year Sort by AuthorPost 
timeSubject AscendingDescending          Page 1 of 1
   [ 2 posts ]      
-- 
Over 1500 classes with 29000 functions in one REALbasic plug-in collection. 
The Monkeybread Software Realbasic Plugin v9.3. 
http://www.monkeybreadsoftware.de/realbasic/plugins.shtml

[email protected]

Reply via email to