You can use Celery for that, I've done something similar, just with a CSV instead of a XML, check this
http://docs.celeryproject.org/en/latest/django/first-steps-with-django.html
once installed and configured, its as simple as:
from celery import task
if (the xml format is ERROR) == True:
return HttpResponse(<html><body>ERROR FORMAT</body></html>")
else:
do_something.delay(the_xml_file)
return HttpResponse(<html><body>RIGHT FORMAT</body></html>")
#I must give a response first, And do other thing. Because the spend time of do_something() may be long.
@task(ignore_result=True)
def do_something(xml):
#do something time consuming
and the do_something function will be called in second plane, and the user will get an instant response, even if the parsing file process takes half an hour