ODK Collect XML Syntax Error Getting a Blank Form from Aggregate Server

Hello,

I have just managed to set up an ODK Aggregate server (v2.0.5) and have created some example forms using "ODK Build" (https://build.getodk.org/) and also using "ODK XLSForm Online" (https://getodk.org/xlsform/). In both cases, I was able to create a form (XML file) and successfully import it on the Aggregate server. I have also just set up "ODK Collect" on an Android device and when I click "Get Blank Form", I can see all of my forms that are available on the ODK Aggregate server. My problem is, that when I choose one of these forms (e.g. "form_test") to get, ODK Collect throws an error with the title "Download Results" and message "form_test (ID: form_test) - XML Syntax Error at Line: 1, Column: 3!". I get the same error on all of the forms.

The XML file contents for the form named "form_test" is as follows:

<?xml version="1.0"?><h:html xmlns="http://www.w3.org/2002/xforms" xmlns:ev="http://www.w3.org/2001/xml-events" xmlns:h="http://www.w3.org/1999/xhtml" xmlns:jr="http://openrosa.org/javarosa" xmlns:odk="http://www.opendatakit.org/xforms" xmlns:orx="http://openrosa.org/xforms" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><h:head><h:title>form_test</h:title><model odk:xforms-version="1.0.0"><instance><data id="form_test"><gender/><meta><instanceID/></meta></data></instance><bind nodeset="/data/gender" type="string"/><bind jr:preload="uid" nodeset="/data/meta/instanceID" readonly="true()" type="string"/></model></h:head><h:body><select1 ref="/data/gender"><label>Respondent's gender</label><item><label>Transgender</label><value>transgender</value></item><item><label>Female</label><value>female</value></item><item><label>Male</label><value>male</value></item><item><label>Other</label><value>othe</value></item></select1></h:body></h:html>

Any help would be greatly appreciated :slight_smile:

Thanks in advance,

Dan

Hi @dan_p could you attach the whole form?

Hi Grzegorz,

sorry about that, it looks like the line of XML code was truncated in my original post. I have edited the post to include it as a code block in markdown. Unfortunately, the form I created using xlsform was all on one line and looks quite ugly. Let me know if that still doesn't help and I will try again. I appreciate you looking at it!
Thanks,

Dan

This form looks fine... what version of ODK Collect are you using?

Thanks for the reply, it appears to be ODK Collect 1.27.3 and is installed on a Samsung tablet

Interestingly, I just downloaded one of the sample forms, specifically:

I received the exact same error in ODK Collect (Basic (ID: basic) - XML Syntax Error at Line: 1, Column: 3!). If the syntax is correct, can you suggest what else might be causing this problem?

I received the exact same error in ODK Collect (Basic (ID: basic) - XML Syntax Error at Line: 1, Column: 3!). If the syntax is correct, can you suggest what else might be causing this problem?

in both cases using your own server? If so have you tried any other server like the demo one for example?

Yes, that's correct, in both cases the error occurred with my own server. Thanks for the suggestion to try the demo server. I managed to successfully connect my ODK Collect to the demo server that you suggested and was able to download a blank form without an error. I guess this means that the problem is with the way my ODK Aggregate server is sending the form to the ODK Collect app? Do you have any suggestions of where I should look on my server (e.g. error logs) to try and work out where things might be going wrong?

Thank you again for the help so far.

I've never heard about a similar issue so that's strange. Could you maybe send me your credentials in private so that I can take a look? (I can't promise I will be able to solve the issue but I can't tell anything just looking at the error message).
BTW. Have you heard about ODK Central which replaced ODK Aggregate? Why didn you decide to use ODK Aggregate instead?

Thank you again, yes I will send you through the details in a private message shortly. If you are able to take a look at it that would be really fantastic!

I did read about ODK Central as well, but unfortunately was not able to find a set of instructions that allowed me to successfully set it up on AWS. I managed to get ODK Aggregate working and so decided to stick with that, but unfortunately then hit this snag with ODK Collect :frowning:

Hi Grzegorz, it looks as though I have solved this issue. The problem was that I hadn't set up the ODK Aggregate server to have the right hostname. The solution was to put the correct hostname in /root/aggregate-config.json on the ODK Aggregate server and top then reinstall ODK Aggregate on the server using

sudo aggregate-cli -f -i -y -c /root/aggregate-config.json
sudo service nginx restart

Everything is working perfectly now. I can download the forms, fill them out and see that the data has uploaded successfully to the Aggregate server.

Thank you very much for your help, I don't think I would have got to a solution without your suggestions. These made me realise that the issue was with my server and not the XML file.

Great you figured it out!
When it comes to central here you can find the documentation https://docs.getodk.org/central-install/
so yeah I recommend trying it out.