It seems like all you need here is `form.xmlns`. You could get this from the `xform_xmlns` property of `case.actions`: https://github.com/dimagi/casexml/blob/master/casexml/apps/case/models.py#L84-84

This would save having to load all the forms from couchdb.