<?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>Controls</title><link>https://www.infopathdev.com:443/forums/43.aspx</link><description> </description><dc:language>en</dc:language><generator>CommunityServer 2007 SP3 (Build: 31118.962)</generator><item><title>Re: filling Rich Text Box with XHTML</title><link>https://www.infopathdev.com:443/forums/thread/33473.aspx</link><pubDate>Fri, 24 Oct 2008 07:06:13 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:33473</guid><dc:creator>Jimmy</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/33473.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=43&amp;PostID=33473</wfw:commentRss><description>&lt;p&gt;After a bit of experimenting I think I&amp;#39;ve found a solution!&lt;/p&gt;
&lt;p&gt;First, save your form as its source files (from the File menu).&amp;nbsp; Then close infopath and browse to the directory where you saved the files.&lt;/p&gt;
&lt;p&gt;Open up the main schema file (probably myschema.xsd) and add this text to the end of the &amp;lt;xsd:schema&amp;gt; node at the top, along with the other namespace declarations:&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; xmlns:xhtml=&amp;quot;http://www.w3.org/1999/xhtml&amp;quot; &lt;/p&gt;
&lt;p&gt;Then save the file, right-click manifest.xsf and choose Design.&amp;nbsp; Use File-&amp;gt;Save As... to re-save your template as an .xsn.&lt;/p&gt;
&lt;p&gt;In your code you will need to explicitly use a blank namespace prefix, so instead of:&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; rtfWriter.WriteStartElement(&amp;quot;div&amp;quot;, &amp;quot;http://www.w3.org/1999/xhtml&amp;quot;);&lt;/p&gt;
&lt;p&gt;use&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;rtfWriter.WriteStartElement(&amp;quot;&amp;quot;, &amp;quot;div&amp;quot;, &amp;quot;http://www.w3.org/1999/xhtml&amp;quot;);&amp;nbsp;&lt;/p&gt;
&lt;p&gt;I hope that&amp;nbsp;works.&lt;/p&gt;
&lt;p&gt;Good luck,&lt;br /&gt;Jimmy&lt;/p&gt;
&lt;p&gt;P.S. Just thought I would point out that you don&amp;#39;t need to use &lt;strong&gt;rtfWriter.Close();&lt;/strong&gt; when the code is inside&amp;nbsp;a&amp;nbsp;using() block.&amp;nbsp; The&amp;nbsp;using() block takes care of that for you.&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/p&gt;</description></item><item><title>Re: filling Rich Text Box with XHTML</title><link>https://www.infopathdev.com:443/forums/thread/33356.aspx</link><pubDate>Wed, 22 Oct 2008 12:49:36 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:33356</guid><dc:creator>n0e2008</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/33356.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=43&amp;PostID=33356</wfw:commentRss><description>&lt;p&gt;ok, i was wrong. it&amp;#39;s not the namespace BUT something strange happens after saving the form, exiting designer and opening the form again. before the form is closed everything looks fine, after reopening - no formatting. xml of the form looks exactly the same in both cases. &lt;/p&gt;
&lt;p&gt;is it a bug?&lt;/p&gt;</description></item><item><title>Re: filling Rich Text Box with XHTML</title><link>https://www.infopathdev.com:443/forums/thread/33347.aspx</link><pubDate>Wed, 22 Oct 2008 09:49:16 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:33347</guid><dc:creator>n0e2008</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/33347.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=43&amp;PostID=33347</wfw:commentRss><description>&lt;p&gt;&amp;nbsp;oh and outerxml of my:Example after appending xhtml child nodes looks like this:&lt;/p&gt;&lt;p&gt;&amp;lt;my:Example xmlns:my=&amp;quot;http://schemas.microsoft.com/office/infopath/2003/myXSD/2008-10-08T08:15:26&amp;quot;&amp;gt;&lt;br /&gt;&amp;lt;xhtml:div xmlns:xhtml=&amp;quot;http://www.w3.org/1999/xhtml&amp;quot;&amp;gt;this is an example&amp;lt;/xhtml:div&amp;gt;&lt;br /&gt;&amp;lt;xhtml:div xmlns:xhtml=&amp;quot;http://www.w3.org/1999/xhtml&amp;quot;&amp;gt;linia2&amp;lt;/xhtml:div&amp;gt;&amp;lt;/my:Example&amp;gt; &lt;/p&gt;&lt;p&gt;this theoretically should work, but it doesn&amp;#39;t. &lt;br /&gt;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;</description></item><item><title>filling Rich Text Box with XHTML</title><link>https://www.infopathdev.com:443/forums/thread/33346.aspx</link><pubDate>Wed, 22 Oct 2008 09:29:26 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:33346</guid><dc:creator>n0e2008</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/33346.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=43&amp;PostID=33346</wfw:commentRss><description>&lt;p&gt;&amp;nbsp;Hi&lt;/p&gt;&lt;p&gt;I&amp;#39;ve got a little problem concerning Rich Text Box (in IP2007), which I want to fill programmatically with XHTML data. I know I need to append XHTML nodes as child nodes of a Rich Text Box, so I&amp;#39;m doing something like this:&lt;/p&gt;&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (localNode.MoveToChild(&amp;quot;Example&amp;quot;, myNamespace))&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; using (XmlWriter rtfWriter = localNode.AppendChild())&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; rtfWriter.WriteStartElement(&amp;quot;div&amp;quot;, &amp;quot;http://www.w3.org/1999/xhtml&amp;quot;);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; rtfWriter.WriteString(memberNode.InnerXml);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; rtfWriter.WriteEndElement();&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; rtfWriter.WriteStartElement(&amp;quot;div&amp;quot;, &amp;quot;http://www.w3.org/1999/xhtml&amp;quot;);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; rtfWriter.WriteString(&amp;quot;linia2&amp;quot;);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; rtfWriter.WriteEndElement();&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; rtfWriter.Close();&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; } &lt;/p&gt;&lt;p&gt;&amp;nbsp;After appending these two div nodes I should be seeing two strings in new lines in the Rich Text Box. Unfortunately this is not happening, I see them inline, without any formatting, like it was just plain text. &lt;br /&gt;&lt;/p&gt;&lt;p&gt;&amp;nbsp;I&amp;#39;ve tried to test aforementioned approach in a new infopath template, and surprisingly everything was fine (button click filled the richtextbox with xhtml) BUT after saving the template and opening it again, it was filling the box with plain text instead of xhtml! After searching a bit I&amp;#39;ve discovered there&amp;#39;s a problem with
namespace of the parent node (&amp;#39;localNode&amp;#39; in this example). The
&amp;#39;myNamespace&amp;#39; in example above is defined as:&lt;/p&gt;&lt;p&gt;string myNamespace = NamespaceManager.LookupNamespace(&amp;quot;my&amp;quot;);&lt;/p&gt;&lt;p&gt;In the newly created form there wasn&amp;#39;t any namespace added to the rich text box node (so it looked like &amp;lt;Example&amp;gt;) but after saving the default &amp;quot;my&amp;quot; namespace was added to the control&amp;#39;s node (so it looked like &amp;lt;my:Example xmlns:my=...&amp;gt;) and the xhtml content was rendered as plain text.&lt;/p&gt;&lt;p&gt;I know the namespace nodes are defined upon element&amp;#39;s creation and afterwards they are read-only, so what can I do? Any ideas?&lt;/p&gt;&lt;p&gt;Outerxml of my root node is (unneeded parts cut):&lt;/p&gt;&lt;p&gt;&amp;nbsp;&amp;lt;?xml version=&amp;quot;1.0&amp;quot;?&amp;gt;&amp;lt;?mso-infoPathSolution 
name=&amp;quot;urn:schemas-microsoft-com:office:infopath:DocView1:-myXSD-2008-10-08T08-15-26&amp;quot; 
solutionVersion=&amp;quot;1.0.0.307&amp;quot; productVersion=&amp;quot;12.0.0&amp;quot; PIVersion=&amp;quot;1.0.0.0&amp;quot; 
?&amp;gt;&amp;lt;?mso-application progid=&amp;quot;InfoPath.Document&amp;quot; 
versionProgid=&amp;quot;InfoPath.Document.2&amp;quot;?&amp;gt;&lt;/p&gt;&lt;p&gt;&amp;lt;my:MainGroup 
xmlns:xsi=&amp;quot;http://www.w3.org/2001/XMLSchema-instance&amp;quot; 
xmlns:xhtml=&amp;quot;http://www.w3.org/1999/xhtml&amp;quot; 
xmlns:my=&amp;quot;http://schemas.microsoft.com/office/infopath/2003/myXSD/2008-10-08T08:15:26&amp;quot; 
xmlns:xd=&amp;quot;http://schemas.microsoft.com/office/infopath/2003&amp;quot; 
xml:lang=&amp;quot;en-us&amp;quot;&amp;gt; &lt;/p&gt;&lt;p&gt;&amp;nbsp;&amp;lt;my:Example&amp;gt;&amp;lt;/my:Example&amp;gt; &lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;br /&gt;&lt;/p&gt;</description></item></channel></rss>