March 9, 2010

InfoPath: Element is not defined in the DTD/Schema

I had imported data from an Excel document to SQL Server and was performing queries against this data from an InfoPath Form.

On some records the query worked fine but in others received this error:

The query method on the Document object failed.
InfoPath cannot run the specified query. The attribute '{http://www.w3.org/XML/1998/namespace}space' on the element 'DocumentTitle' is not defined in the DTD/Schema.

Looking at the data, I could not find special characters or anything that would cause this error.
I opened the WebService project and placed a breakpoint in the code right after the DataSet was being filled. In the immediate window I typed

? ds.GetXml()









Upon inspecting the XML being sent to the form, I noticed some tags contained

<DocumentTitle xml:space="retain"> <\DocumentTitle>


To make a long story short, you can solve the problem by running the following query:

UPDATE [Table_Name] SET [FieldName]= ''
WHERE [FieldName] = '' ;


Hope this helps!

- Radamés

December 30, 2009

Infopath: Deleted row information cannot be accessed through the row

I had cleared the contents of my repeating table using code then I received this message after submitting the dataset to a webservice:

"InfoPath cannot submit the form. An error occurred while the form was being submitted.The SOAP response indicates that an error occurred on the server:System.Web.Services.Protocols.SoapException: Server was unable to process request. ---> System.Data.DeletedRowInaccessibleException: Deleted row information cannot be accessed through the row. at System.Data.DataRow.GetDefaultRecord()"

Solution:

Go to Tools > Data Connections.

Select your main query connection and click Modify. Uncheck the 'Include change information when submitting data' option.

The code used to clear the repeating table can be found at http://www.bizsupportonline.net/blog/2009/08/clear-reset-fields-infopath-3-lines-code/

Hope this helps!