<?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: Manipulating XML using C#</title><link>https://www.infopathdev.com:443/forums/thread/13779.aspx</link><pubDate>Fri, 14 Oct 2005 08:03:12 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:13779</guid><dc:creator>DavidCrabbe</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/13779.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=13779</wfw:commentRss><description>I have come up with an answer of sorts, and I'll post it for review:&lt;br /&gt;&lt;br /&gt;I've used the OnSwitchView event to check for when the 'approval' view is selected.  For each of the optional sections I wish to include I test the checkbox value, set in the 'request' view, and use xOptional::insert to add it in if required.&lt;br /&gt;&lt;br /&gt;David.</description></item><item><title>Re: Manipulating XML using C#</title><link>https://www.infopathdev.com:443/forums/thread/13778.aspx</link><pubDate>Thu, 13 Oct 2005 03:01:25 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:13778</guid><dc:creator>DavidCrabbe</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/13778.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=13778</wfw:commentRss><description>Hi Matt,&lt;br /&gt;&lt;br /&gt;Thanks for the suggestion, I could do that however:&lt;br /&gt;a) Validation would be painful, I've got 50+ fields to check, and how do I indicate which fields cannot be blank other than hardcoding?&lt;br /&gt;b) I'd lose the natty little red star next to the mandatory fields which inform the user that the they cannot be blank.&lt;br /&gt;&lt;br /&gt;I can't help but feel there must be a better option, one that actually uses the XML schema and InfoPath built-in functionality to indicate 'cannot be blank'.&lt;br /&gt;&lt;br /&gt;David.</description></item><item><title>Re: Manipulating XML using C#</title><link>https://www.infopathdev.com:443/forums/thread/13777.aspx</link><pubDate>Wed, 12 Oct 2005 14:00:30 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:13777</guid><dc:creator>Matt Faus</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/13777.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=13777</wfw:commentRss><description>Instead of inserting/removing sections of XML with "Cannot be blank" fields in them, why don't you just take off the "Cannot be blank" flag, use conditional formatting, and do data validation via code?&lt;br /&gt;&lt;br /&gt;---------------&lt;br /&gt;Matt Faus&lt;br /&gt;</description></item><item><title>Re: Manipulating XML using C#</title><link>https://www.infopathdev.com:443/forums/thread/13776.aspx</link><pubDate>Wed, 12 Oct 2005 09:52:22 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:13776</guid><dc:creator>DavidCrabbe</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/13776.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=13776</wfw:commentRss><description>I should point out that XML that I'm trying to insert (an InfoPath Group) is defined within my InfoPath data source (.xsd) and all I wish to do is include or exclude it based on a user selection.  &lt;br /&gt;&lt;br /&gt;I don't want to have to explicitly define the XML data structure in code.&lt;br /&gt;&lt;br /&gt;Thanks!</description></item><item><title>Manipulating XML using C#</title><link>https://www.infopathdev.com:443/forums/thread/12617.aspx</link><pubDate>Wed, 12 Oct 2005 09:39:34 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:12617</guid><dc:creator>DavidCrabbe</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/12617.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=12617</wfw:commentRss><description>I have a number of optional sections in my form that are, by default, not included in the form's data structure until the user checks a checkbox and the section is included using thisXDocument.View.ExecuteAction( xOptional::insert, &amp;lt;xPath&amp;gt; ).  When the user unchecks the checkbox, the group is removed using xOptional::remove.  &lt;br /&gt;&lt;br /&gt;Note: I'm forced to use conditional presence as the sections contain 'cannot be blank' fields that would otherwise cause the validation to fail if they were merely hidden by conditional formatting.&lt;br /&gt;&lt;br /&gt;This works fine if the section to be inserted is in the same view as the checkbox which controls its insertion.  However, I have a group which should only appear on an 'approval' view that I only want to include if the user selects a checkbox on the 'request' view.  &lt;br /&gt;&lt;br /&gt;Using View.ExecuteAction doesn't work as the optional section is on a different view.  I can create an empty optional section on the 'request' view that inserts the group, however this is a messy workaround and if I hide it using conditional formatting I can't remove it using xOptional::remove when the user unchecks the option.&lt;br /&gt;&lt;br /&gt;Can anyone advise me as to how I can add and remove groups from my XML document using C# code that doesn't use View.Execute action?  &lt;br /&gt;&lt;br /&gt;I've read that the DOM offers this facility but I'm not at all familiar with it and a brief flirtation resulted a flurry of errors.&lt;br /&gt;&lt;br /&gt;I'd really appreciate some help with this query as I'm kinda stuck at the moment...&lt;br /&gt;&lt;br /&gt;David.</description></item></channel></rss>