Question about "xsn:nil" - InfoPath Dev
in

InfoPath Dev

Question about "xsn:nil"

Last post 02-15-2006 11:53 AM by rohan. 1 replies.
Page 1 of 1 (2 items)
Sort Posts: Previous Next
  • 02-13-2006 11:44 PM

    Question about "xsn:nil"

    I have an InfoPath form that contain 2 text box type Integer.
    I have a button that click on me operate this code (in c#):

    public void CTRL17_5_OnClick(DocActionEvent e)
    {
    IXMLDOMNode node1 =this.thisXDocument.DOM.selectSingleNode("//my:myFields/my:field1");
    IXMLDOMNode node2 =this.thisXDocument.DOM.selectSingleNode("//my:myFields/my:field2");
    int num1;

    num1=Int32.Parse(node1.text);
    num1=num1+5;
    node2.text=num1.ToString();

    }




    If I change field2 to be type String (and not Integer) and It's work well.
    But if I change back field2 to by type Integer I get an Error about "nil" ,After I added this line to the code:

    node2.attributes.removeNamedItem("xsi:nil");

    It's work well.
    What is this line mean? and why I need itwhen I operate assignation on a field type Integer
  • 02-15-2006 11:53 AM In reply to

    • rohan
    • Not Ranked
    • Joined on 12-08-2005
    • India
    • Posts 2

    Re: Question about "xsn:nil"

    Hi,

    "xsi:nil" specifies that the node can accept null values. But XML node of integer type cannot accept null.

    Because of this behaviour before assigning an integer value we need to check whether the node as "xsi:nill" attribute set to true and remove it.


    Rohan Reddy
Page 1 of 1 (2 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.