<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/"><channel><title>Richard Fleming</title><link>http://mindsharpblogs.com/richard/</link><description>Binary Ramblings</description><managingEditor>Richard Fleming</managingEditor><dc:language>en-US</dc:language><generator>.Text Version 0.95.2004.102</generator><item><dc:creator>Richard Fleming</dc:creator><title>Error in XML Document (1,40)</title><link>http://mindsharpblogs.com/richard/archive/2005/03/15/419.aspx</link><pubDate>Tue, 15 Mar 2005 08:44:00 GMT</pubDate><guid>http://mindsharpblogs.com/richard/archive/2005/03/15/419.aspx</guid><wfw:comment>http://mindsharpblogs.com/richard/comments/419.aspx</wfw:comment><comments>http://mindsharpblogs.com/richard/archive/2005/03/15/419.aspx#Feedback</comments><slash:comments>10</slash:comments><wfw:commentRss>http://mindsharpblogs.com/richard/comments/commentRss/419.aspx</wfw:commentRss><trackback:ping>http://mindsharpblogs.com/richard/services/trackbacks/419.aspx</trackback:ping><description>Error messages tend, by default, not to be overly helpful. Sometimes though, they're just plain baffling. This is the case for the Error in XML Document error. I received this error when trying to add my current project to a fresh portal. Every time I went to Add Web Parts and dragged/dropped the part into a zone, the Error in XML Document (1,40) message would appear in the side menu in red letters. 
&lt;P&gt;Well, after much digging, I have figured out why it does this. It is caused by an unhandled exception in a constructor. I had missed a few spots in my code when I went back and refactored my error handling, and so the web part didn&amp;#8217;t gracefully handle empty tables. Fixed the problem (and added a general try/catch to my constructor) and I was able to add the web part back in.&amp;nbsp;
&lt;SCRIPT src="/images/js/codeHandler.js" type=text/javascript&gt;&lt;/SCRIPT&gt;
 &lt;TEXTAREA id=holdtext style="DISPLAY: none"&gt;&lt;/TEXTAREA&gt; 
&lt;P&gt;To test: Create a new web part, verify it is safe and working, then add the following: 
&lt;P&gt;
&lt;TABLE cellSpacing=0 cellPadding=0 width=600 border=1&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD colSpan=3&gt;&lt;FONT face="Courier New" size=2&gt;
&lt;DIV id=divCS10 style="DISPLAY: block"&gt;public YourClassName(){&lt;BR&gt;&amp;nbsp;&amp;nbsp; throw new Exception();&lt;BR&gt;}&lt;BR&gt;&amp;nbsp; &lt;/DIV&gt;
&lt;DIV id=divVB10 style="DISPLAY: none"&gt;Public Sub New()&lt;BR&gt;&amp;nbsp;&amp;nbsp; Throw New Exception()&lt;BR&gt;End Sub&lt;BR&gt;&amp;nbsp; &lt;/DIV&gt;&lt;/FONT&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;
&lt;TABLE cellSpacing=0 cellPadding=0 width=600 border=1&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD id=tdCS10 onmouseover=javascript:mouseOver(this); style="BORDER-RIGHT: black 1px solid; FONT: bold small-caps 12pt Courier New; BORDER-LEFT: black 1px solid; BORDER-BOTTOM: black 1px solid; BACKGROUND-COLOR: yellow" onclick="javascript:toggleClick('divVB10', 'divCS10', 'tdVB10', this.id);" onmouseout=javascript:mouseOut(this); align=middle&gt;&lt;IMG height=1 src="/images/shim.gif" width=100&gt;&lt;BR&gt;C#&lt;/TD&gt;
&lt;TD id=tdVB10 onmouseover=javascript:mouseOver(this); style="BORDER-RIGHT: black 1px solid; FONT: bold small-caps 12pt Courier New; BORDER-BOTTOM: black 1px solid; BACKGROUND-COLOR: dimgray" onclick="javascript:toggleClick('divCS10', 'divVB10', 'tdCS10', this.id);" onmouseout=javascript:mouseOut(this); align=middle&gt;&lt;IMG height=1 src="/images/shim.gif" width=100&gt;&lt;BR&gt;VB&lt;/TD&gt;
&lt;TD width="100%"&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;
&lt;P&gt;Rebuild/deploy. The web part that was already added in will display a &amp;#8216;Cannot desieralize&amp;#8217; error message. If you try to add it in again, you will get the XML Document error. To fix change the constructor to this: 
&lt;P&gt;
&lt;TABLE cellSpacing=0 cellPadding=0 width=600 border=1&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD colSpan=3&gt;&lt;FONT face="Courier New" size=2&gt;
&lt;DIV id=divCS20 style="DISPLAY: block"&gt;public YourClassName(){&lt;BR&gt;&amp;nbsp;&amp;nbsp; try&lt;BR&gt;&amp;nbsp;&amp;nbsp; {&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; throw new Exception();&lt;BR&gt;&amp;nbsp;&amp;nbsp; }&lt;BR&gt;&amp;nbsp;&amp;nbsp; catch { }&lt;BR&gt;}&lt;BR&gt;&amp;nbsp; &lt;/DIV&gt;
&lt;DIV id=divVB20 style="DISPLAY: none"&gt;Public Sub New()&lt;BR&gt;&amp;nbsp;&amp;nbsp; Try&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Throw New Exception()&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Catch err As Exception&lt;BR&gt;&amp;nbsp;&amp;nbsp; End Try&lt;BR&gt;End Sub&lt;BR&gt;&lt;BR&gt;&amp;nbsp; &lt;/DIV&gt;&lt;/FONT&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;
&lt;TABLE cellSpacing=0 cellPadding=0 width=600 border=1&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD id=tdCS20 onmouseover=javascript:mouseOver(this); style="BORDER-RIGHT: black 1px solid; FONT: bold small-caps 12pt Courier New; BORDER-LEFT: black 1px solid; BORDER-BOTTOM: black 1px solid; BACKGROUND-COLOR: yellow" onclick="javascript:toggleClick('divVB20', 'divCS20', 'tdVB20', this.id);" onmouseout=javascript:mouseOut(this); align=middle&gt;&lt;IMG height=1 src="/images/shim.gif" width=100&gt;&lt;BR&gt;C#&lt;/TD&gt;
&lt;TD id=tdVB20 onmouseover=javascript:mouseOver(this); style="BORDER-RIGHT: black 1px solid; FONT: bold small-caps 12pt Courier New; BORDER-BOTTOM: black 1px solid; BACKGROUND-COLOR: dimgray" onclick="javascript:toggleClick('divCS20', 'divVB20', 'tdCS20', this.id);" onmouseout=javascript:mouseOut(this); align=middle&gt;&lt;IMG height=1 src="/images/shim.gif" width=100&gt;&lt;BR&gt;VB&lt;/TD&gt;
&lt;TD width="100%"&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;BR&gt;Rebuid/deploy. Error will be fixed.&lt;/P&gt;&lt;img src ="http://mindsharpblogs.com/richard/aggbug/419.aspx" width = "1" height = "1" /&gt;</description></item><item><dc:creator>Richard Fleming</dc:creator><title>The manditory hi it's me post.</title><link>http://mindsharpblogs.com/richard/archive/2005/03/15/418.aspx</link><pubDate>Tue, 15 Mar 2005 08:39:00 GMT</pubDate><guid>http://mindsharpblogs.com/richard/archive/2005/03/15/418.aspx</guid><wfw:comment>http://mindsharpblogs.com/richard/comments/418.aspx</wfw:comment><comments>http://mindsharpblogs.com/richard/archive/2005/03/15/418.aspx#Feedback</comments><slash:comments>11</slash:comments><wfw:commentRss>http://mindsharpblogs.com/richard/comments/commentRss/418.aspx</wfw:commentRss><trackback:ping>http://mindsharpblogs.com/richard/services/trackbacks/418.aspx</trackback:ping><description>My name is Richard Fleming (though if you didn't know that you need to be thwacked with a fresh trout), a programmer for the Kansas Army National Guard.  I am the sole developer for the Kansas Knowledge Online, the KSARNG's implementation of Sharepoint Portal.  Mindsharp has been kind enough (or crazy enough, take your pick) to provide this nice blog for me to post my thoughts, ideas, code, ect on Sharepoint.  For this I would like to say thanks.

Ok, enough babbling.  To code!&lt;img src ="http://mindsharpblogs.com/richard/aggbug/418.aspx" width = "1" height = "1" /&gt;</description></item></channel></rss>