<?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: [b]Infopath XML insertBefore method[/b]</title><link>https://www.infopathdev.com:443/forums/thread/14347.aspx</link><pubDate>Tue, 28 Feb 2006 21:26:18 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:14347</guid><dc:creator>Agni Jonnalagadda</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/14347.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=14347</wfw:commentRss><description>Hi,&lt;br /&gt;I think there might be a mistake where you have actually cloned the node, you might be assigning the cloned node instead of cloned node to "NodeToAppend" variable. Just look at the code that you have written to clone the node. &lt;br /&gt;</description></item><item><title>[b]Infopath XML insertBefore method[/b]</title><link>https://www.infopathdev.com:443/forums/thread/12795.aspx</link><pubDate>Tue, 28 Feb 2006 18:24:56 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:12795</guid><dc:creator>plsames</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/12795.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=12795</wfw:commentRss><description>&lt;b&gt;&lt;/b&gt;I hope this is the right place to ask this question.  I have an Infopath form that has the following structure:&lt;br /&gt;&lt;br /&gt;my:Fields&lt;br /&gt;  my:Customer&lt;br /&gt;    my:WorkOrder (repeating) &lt;br /&gt;    my:otherfields&lt;br /&gt;&lt;br /&gt;When I use the insertBefore method to insert another my:WorkOrder node, it does not insert it, it replaces the existing my:WorkOrder node.  I have used the same code in two other forms with similar structures,and it works fine.&lt;br /&gt;&lt;br /&gt;Here's the code:&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;function AppendOrInsertNewNode(Parent, StrNode, NodeToAppend)&lt;br /&gt;{&lt;br /&gt;  /** Set all Nodes count to zero so we can get an accurate count of each.**/&lt;br /&gt;	var LastChildNodeWithCorrectTag = 0;&lt;br /&gt;		&lt;br /&gt;	&lt;br /&gt;	//Go through all Child Nodes that we want OF WorkOrder and get a count of each.&lt;br /&gt;	for(var i = 0; i&amp;lt;Parent.childNodes.length;i++)&lt;br /&gt;	{&lt;br /&gt;		if(Parent.childNodes(i).tagName == StrNode)&lt;br /&gt;		{&lt;br /&gt;			LastChildNodeWithCorrectTag = i;&lt;br /&gt;		}&lt;br /&gt;	}&lt;br /&gt;		try&lt;br /&gt;		{	&lt;br /&gt;			Parent.insertBefore(NodeToAppend, Parent.childNodes(LastChildNodeWithCorrectTag).nextSibling);&lt;br /&gt;		}&lt;br /&gt;		catch(er)&lt;br /&gt;		{&lt;br /&gt;			XDocument.UI.Alert("Can't insert before: " + er.message)&lt;br /&gt;		}&lt;br /&gt;		&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;The Parent is sent as the my:Customer node, the nodeToAppend is a clone of the my:WorkOrder node with the text of each child node changed.&lt;br /&gt;&lt;br /&gt;Any help would be appreciated?&lt;br /&gt;&lt;br /&gt;Patti&lt;b&gt;&lt;/b&gt;</description></item></channel></rss>