Search code examples
xmlnullinfopath

trailing null values on infopath xml


I am following the instructions on this site: http://www.bizsupportonline.net/infopath2007/programmatically-create-infopath-form-console-app.htm

I have successfully an XML document that looks like my InfoPath form, except the document has trailing null values at the end of the file. I am still able to open the document in the browser, but I believe this will be an issue in the future. Does anyone have any ideas why this is happening?

Thank you


Solution

  • I found out that I had to use the ToArray Method instead of GetBuffer to eliminate the trailing nulls (https://msdn.microsoft.com/en-us/library/system.io.memorystream.getbuffer(v=vs.110).aspx)

    I tried trimming the 0s at the end of the byte array but the submit rules in the InfoPath form stopped working.