<?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: reset dom</title><link>https://www.infopathdev.com:443/forums/thread/14777.aspx</link><pubDate>Fri, 15 Sep 2006 06:55:57 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:14777</guid><dc:creator>buki79</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/14777.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=14777</wfw:commentRss><description>Thanks for your help! That works fine!</description></item><item><title>Re: reset dom</title><link>https://www.infopathdev.com:443/forums/thread/14776.aspx</link><pubDate>Thu, 14 Sep 2006 17:08:45 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:14776</guid><dc:creator>Agni Jonnalagadda</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/14776.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=14776</wfw:commentRss><description>Hi buki79,&lt;br /&gt;&lt;br /&gt;This is the problem with your reset code. your reset code is making the root node empty. you can use below reset code instead:&lt;br /&gt;&lt;br /&gt; var nodes = XDocument.DOM.selectNodes("//*");&lt;br /&gt; while(node = nodes.nextNode())&lt;br /&gt; {&lt;br /&gt;   if(node.selectNodes("child::*").length == 0)&lt;br /&gt;    {&lt;br /&gt;	 	node.text = "";&lt;br /&gt;    }&lt;br /&gt; }&lt;br /&gt;&lt;br /&gt;</description></item><item><title>Re: reset dom</title><link>https://www.infopathdev.com:443/forums/thread/14775.aspx</link><pubDate>Wed, 13 Sep 2006 10:57:08 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:14775</guid><dc:creator>buki79</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/14775.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=14775</wfw:commentRss><description>Hi,&lt;br /&gt;&lt;br /&gt;I guess my import code works fine. When I import the same xml file once, twice or three times without reseting it just adds the contents to the form. But if I use the reset function, this next time I use the import function I get the error "selectSingleNode(..) Null or no object".&lt;br /&gt;This is an example of my import code:&lt;pre&gt;if (gdomImported.selectSingleNode("/NOTIF/NOTIF_PARTNER/item[PARVW_VTEXT/text()='Autor']/PARNR_NAM"))&lt;br /&gt;{&lt;br /&gt;  objDataDOM.selectSingleNode("/my:ECx/my:BASIC_DATA/my:BD_INITIATOR").text = gdomImported.selectSingleNode("/NOTIF/NOTIF_PARTNER/item[PARVW_VTEXT/text()='Autor']/PARNR_NAM").text; &lt;br /&gt;}&lt;br /&gt;if(gdomImported.selectSingleNode("/NOTIF/NOTIF_TEXT/item[1]/TDLINE"))&lt;br /&gt;{&lt;br /&gt;  objDataDOM.selectSingleNode("/my:ECx/my:BASIC_DATA/my:BD_REASON_CR").text = gdomImported.selectSingleNode("/NOTIF/NOTIF_TEXT/item[1]/TDLINE").text; &lt;br /&gt;}&lt;br /&gt;var parent = objDataDOM.selectSingleNode("/my:ECx/my:BASIC_DATA");&lt;br /&gt;var firstRow = objDataDOM.selectSingleNode("/my:ECx/my:BASIC_DATA/my:BD_CHANGEDESC");             &lt;br /&gt;var i = 2;&lt;br /&gt;while (gdomImported.selectSingleNode("/NOTIF/NOTIF_TEXT/item["+i+"]/TDLINE"))&lt;br /&gt;{&lt;br /&gt;  var newRow = firstRow.cloneNode(true);&lt;br /&gt;  newRow.text = gdomImported.selectSingleNode("/NOTIF/NOTIF_TEXT/item["+i+"]/TDLINE").text; &lt;br /&gt;  parent.insertBefore(newRow, firstRow);&lt;br /&gt;  i++;&lt;br /&gt;}&lt;/pre&gt;&lt;br /&gt;This is mainly taken from the CD import example provided by Microsoft.&lt;br /&gt;But if you have any hints on how to clear a form by script, I'd appreciate that very much.&lt;br /&gt;&lt;br /&gt;Best regards,&lt;br /&gt;&lt;br /&gt;buki</description></item><item><title>Re: reset dom</title><link>https://www.infopathdev.com:443/forums/thread/14774.aspx</link><pubDate>Tue, 12 Sep 2006 05:50:34 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:14774</guid><dc:creator>Patrick Halstead</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/14774.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=14774</wfw:commentRss><description>Hi Buki,&lt;br /&gt;My guess is that it's a bug in your custom import code. I'd have to look at that. Sorry for not responding sooner!</description></item><item><title>reset dom</title><link>https://www.infopathdev.com:443/forums/thread/12940.aspx</link><pubDate>Thu, 07 Sep 2006 10:53:59 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:12940</guid><dc:creator>buki79</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/12940.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=12940</wfw:commentRss><description>Hi,&lt;br /&gt;&lt;br /&gt;I import an xml file into a form by custom code. Now I wanted to insert a link in the custom task pane which resets the form. &lt;br /&gt;This peace of code resets the form.&lt;pre&gt;&lt;br /&gt;var nodes = XDocument.DOM.selectNodes("/*");&lt;br /&gt;while(node = nodes.nextNode())&lt;br /&gt;      node.text=" "; &lt;/pre&gt;&lt;br /&gt;But when I wanted to import another xml file I get a nullpointer exception. It seems that this peace of code deletes the whole dom or why can't I import the xml at the second time?&lt;br /&gt;&lt;br /&gt;Regards,&lt;br /&gt;&lt;br /&gt;buki</description></item></channel></rss>