XMLWRITER – Write XSI: NIL = TRUE Properties

I have a question about an InfoPath 2010 form with some code behind it. The purpose of my form is to collect data from users and use the answers provided to automatically fill in many required tasks These tasks are populated in the repeating section of the form. My code behind contains the logic to automatically fill in each entry in the repeating section. I am using the XMLWriter class and the WriteStringElement method to fill each field in the repeating section.

Initially all this logic seems to work as expected, and these parts are filled as expected. But now I realize that there is a problem with the fields written into the XML form.

Using the workflow I am trying to repeat Each item in the section generates a SharePoint task. After completing the task, I write the status and completion date back to the form. The problem I have is that when initially setting up the task in the form, I obviously didn’t populate the CompletedDate field. I assume that The field will be automatically added to the form XML with the xsi: nil = true attribute. On the contrary, it is not in the XML at all, and my workflow throws Object Reference when looking for the node “faCompletedDate” without setting errors. Check The XML of the form, it does not exist.

I think the solution I need is to write an xsi:nil attribute to teh faCompletedDate in the code behind the form, I don’t know how this is done.< /p>

I tried:

writer.WriteStartElement("faCompletedDate", myNs)
writer.WriteAttributeString("xsi", "nil" , xsiNs, "true")
writer.WriteEndElement()

But this will trigger schema validation and find non-data type errors.

Someone can help me solve this problem And suggest the best way to use it.

Okay, I managed to solve this problem. It seems I missed a namespace manager parameter in one of my XMlWriter statements. Updating this allows me to write the complete part as expected.

I have a problem with an InfoPath 2010 form, behind it There is some code. The purpose of my form is to collect data from users and use the answers provided , To automatically fill in many required tasks. These tasks are filled in the repeating section of the form. My code behind contains the logic to automatically fill in each entry in the repeating section. I am using the XMLWriter class and the WriteStringElement method to fill in each of the repeating sections Fields.

Initially all of this logic seemed to work as expected, and these parts were populated as expected. But now I realize there is a problem with the fields written into the XML form.

I think the solution I need is to write an xsi:nil attribute to teh faCompletedDate in the code behind the form, I don’t Know how this is done.

I tried:

writer.WriteStartElement("faCompletedDate", myNs)
writer.WriteAttributeString ("xsi", "nil", xsiNs, "true")
writer.WriteEndElement()

But this will trigger pattern verification and find non-data type errors.

Can someone help me solve this problem and suggest the best way to use it.

Ok, I managed to solve this problem. It seems I missed me Namespace manager parameter in one of the XMlWriter statements. Updating this allows me to write the complete part as expected.

WordPress database error: [Table 'yf99682.wp_s6mz6tyggq_comments' doesn't exist]
SELECT SQL_CALC_FOUND_ROWS wp_s6mz6tyggq_comments.comment_ID FROM wp_s6mz6tyggq_comments WHERE ( comment_approved = '1' ) AND comment_post_ID = 6022 ORDER BY wp_s6mz6tyggq_comments.comment_date_gmt ASC, wp_s6mz6tyggq_comments.comment_ID ASC

Leave a Comment

Your email address will not be published.