<?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: Add attribute</title><link>https://www.infopathdev.com:443/forums/thread/14338.aspx</link><pubDate>Thu, 18 Jan 2007 21:11:19 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:14338</guid><dc:creator>EricL</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/14338.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=14338</wfw:commentRss><description>Hi,&lt;br /&gt;The posted code above was a great help.  I transformed it into C# in a VS2003 project and thought it might be helpful:&lt;br /&gt;Thanks!&lt;br /&gt;&lt;br /&gt;// CUSTOM Method: SetNil&lt;br /&gt;// Needed because of the xml and form validation rules on certain fields like DateTime, Boolean, etc.&lt;br /&gt;public void SetNil(IXMLDOMNode node)&lt;br /&gt;{&lt;br /&gt;        if( node.text == "")&lt;br /&gt;		{	return;	}&lt;br /&gt;	IXMLDOMElement nilElement;&lt;br /&gt;	IXMLDOMAttribute nilAttribute;&lt;br /&gt;&lt;br /&gt;	// Create an element and an attribute for xsi:nil with the proper namespace.&lt;br /&gt;	nilElement   = (IXMLDOMElement)node;&lt;br /&gt;	nilAttribute = (IXMLDOMAttribute)node.ownerDocument.createNode((int)DOMNodeType.NODE_ATTRIBUTE,"xsi:nil",xsiNS);&lt;br /&gt;	nilAttribute.text = "true";&lt;br /&gt;			&lt;br /&gt;	// The order is important&lt;br /&gt;	node.text = String.Empty;&lt;br /&gt;	nilElement.setAttributeNode(nilAttribute);&lt;br /&gt;}</description></item><item><title>Re: Add attribute</title><link>https://www.infopathdev.com:443/forums/thread/14337.aspx</link><pubDate>Fri, 24 Feb 2006 15:23:17 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:14337</guid><dc:creator>Matt Faus</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/14337.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=14337</wfw:commentRss><description>This might be helpful:&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;/*------------------------------------------------------------------------------&lt;br /&gt;	setNil() - Empty a nillable element.&lt;br /&gt;------------------------------------------------------------------------------*/&lt;br /&gt;function setNil(xpath)&lt;br /&gt;{&lt;br /&gt;	var xmlNode = getNode(xpath);&lt;br /&gt;&lt;br /&gt;	if (!xmlNode || xmlNode.text === "")&lt;br /&gt;		return;&lt;br /&gt;&lt;br /&gt;	// Create xsi:nil attribute with the proper namespace.&lt;br /&gt;	var xmlNil = xmlNode.ownerDocument.createNode(2, "xsi:nil", "http://www.w3.org/2001/XMLSchema-instance");&lt;br /&gt;	xmlNil.text = "true";&lt;br /&gt;&lt;br /&gt;	// The order is important.&lt;br /&gt;	xmlNode.text = "";&lt;br /&gt;	xmlNode.setAttributeNode(xmlNil);&lt;br /&gt;}&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;---------------&lt;br /&gt;Matt Faus&lt;br /&gt;InfoPath Dev Texas&lt;br /&gt;</description></item><item><title>Re: Add attribute</title><link>https://www.infopathdev.com:443/forums/thread/14336.aspx</link><pubDate>Fri, 24 Feb 2006 07:50:05 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:14336</guid><dc:creator>Patrick Halstead</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/14336.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=14336</wfw:commentRss><description>Hi Delu,&lt;br /&gt;Check out the jscript code in the samples that ship with InfoPath. They have the same issue and solve it in code.&lt;br /&gt;&lt;br /&gt;Patrick Halstead [InfoPath MVP]&lt;br /&gt;InfoPath Dev Seattle</description></item><item><title>Add attribute</title><link>https://www.infopathdev.com:443/forums/thread/12789.aspx</link><pubDate>Fri, 24 Feb 2006 03:26:25 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:12789</guid><dc:creator>delu</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/12789.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=12789</wfw:commentRss><description>Hi there.&lt;br /&gt;&lt;br /&gt;I want to set a date picker to a date. I read I have to remove the nil attribute in order to do that. This works great, *but* the date picker is then set to can not be blank. &lt;br /&gt;How can I readd the attribute in case the user wants to remove the date?&lt;br /&gt;&lt;br /&gt;Thanks!</description></item></channel></rss>