<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://www.infopathdev.com:443/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Code</title><link>https://www.infopathdev.com:443/forums/45.aspx</link><description /><dc:language>en</dc:language><generator>CommunityServer 2007 SP3 (Build: 31118.962)</generator><item><title>Re: Removing child and putting it back</title><link>https://www.infopathdev.com:443/forums/thread/19524.aspx</link><pubDate>Wed, 02 May 2007 16:02:02 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:19524</guid><dc:creator>Matt Faus</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/19524.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=19524</wfw:commentRss><description>Hi Dan,
&lt;br /&gt;&lt;br /&gt;
Sorry for the late reply. This seems incredibly weird, but I think I might have run into something like this before.  My suggestion would be to use replaceChild(), but you said it gave you the same error.  Since the objects are failing you, you should edit the XML string directly.  Instead of calling insertChild() or replaceChild() on Grandparent, simply do Grandparent.xml = "...";
&lt;br /&gt;&lt;br /&gt;
I hope this helps!</description></item><item><title>Removing child and putting it back</title><link>https://www.infopathdev.com:443/forums/thread/12970.aspx</link><pubDate>Mon, 30 Oct 2006 18:09:48 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:12970</guid><dc:creator>djay</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/12970.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=12970</wfw:commentRss><description>Using C# I am trying to pull a section of XML out of the main data source, do work on it and putting it back.  I'm doing this for speed reasons, when I do the work while it is still in the main data source it takes ten times as long.  But under a certain circumstance the data structure I put back in is not correct.  Here is what it's doing:&lt;br /&gt;Say I have a starting XML of:&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&amp;lt;Grandparent&amp;gt;&lt;br /&gt;  &amp;lt;Parent&amp;gt;&lt;br /&gt;    &amp;lt;Child&amp;gt;Kid1&amp;lt;/Child&amp;gt;&lt;br /&gt;    &amp;lt;Child&amp;gt;Kid2&amp;lt;/Child&amp;gt;&lt;br /&gt;    &amp;lt;Child&amp;gt;Kid3&amp;lt;/Child&amp;gt;&lt;br /&gt;    &amp;lt;Child&amp;gt;Kid4&amp;lt;/Child&amp;gt;&lt;br /&gt;  &amp;lt;/Parent&amp;gt;&lt;br /&gt;&amp;lt;/Grandparent&amp;gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;In code I have IXMLDOMNode objects associated with Grandparent and Parent, so I pull out the Parent object to do work on it.&lt;br /&gt;&lt;br /&gt;&lt;i&gt;Grandparent.removeChild(Parent);&lt;/i&gt;&lt;br /&gt;&lt;br /&gt;Then I remove the child "Kid2" and when I look at it with the debugger Parent looks like this:&lt;br /&gt;&lt;pre&gt;&amp;lt;Parent&amp;gt;&lt;br /&gt;    &amp;lt;Child&amp;gt;Kid1&amp;lt;/Child&amp;gt;&lt;br /&gt;    &amp;lt;Child&amp;gt;Kid3&amp;lt;/Child&amp;gt;&lt;br /&gt;    &amp;lt;Child&amp;gt;Kid4&amp;lt;/Child&amp;gt;&lt;br /&gt;&amp;lt;/Parent&amp;gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Then I add it back into Grandparent:&lt;br /&gt;&lt;br /&gt;&lt;i&gt;Grandparent.appendChild(Parent);&lt;/i&gt;&lt;br /&gt;&lt;br /&gt;And when I look at it XML now it looks like this:&lt;br /&gt;&lt;pre&gt;&amp;lt;Grandparent&amp;gt;&lt;br /&gt;  &amp;lt;Parent&amp;gt;&lt;br /&gt;    &amp;lt;Child&amp;gt;Kid1&amp;lt;/Child&amp;gt;&lt;br /&gt;    &amp;lt;Child&amp;gt;Kid2&amp;lt;/Child&amp;gt;&lt;br /&gt;    &amp;lt;Child&amp;gt;Kid3&amp;lt;/Child&amp;gt;&lt;br /&gt;  &amp;lt;/Parent&amp;gt;&lt;br /&gt;&amp;lt;Grandparent&amp;gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;And when I look at Parent in the debugger it has changed during the append to the new data.&lt;br /&gt;Also, if I do the work without removing Parent first (by commenting out the remove and append lines) it works perfectly.&lt;br /&gt;What is going on here?&lt;br /&gt;&lt;br /&gt;BTW-I have tried this with cloning Parent at the top and using replaceChild at the end and I still get the same problem.&lt;br /&gt;&lt;br /&gt;Anyone have any suggestions?&lt;br /&gt;&lt;br /&gt;Thanks,&lt;br /&gt;-Dan&lt;br /&gt;</description></item></channel></rss>