javarosa
javarosa copied to clipboard
Submission element parsing code smell
Software versions
All JavaRosa versions so far (v2.6.0).
Problem description
The code responsible for parsing the submission element (XFormParser#parseSubmission & SubmissionParser) does not look good because of:
- The code accepts multiple submission elements - if they have different values of the
idattribute - but when accessing submission element, it always returns the default one (the one without theidattribute). - There is
SubmissionParserclass but the most of the parsing logic takes place in theXFormParser#parseSubmissionprivate method. It makes way harder to unit test this piece of code in isolation.
Proposition
- If support for the multiple submission element is not the case, we should remove related code. Otherwise, methods for accessing other submission elements should be added.
- Move most of the
XFormParser#parseSubmissionlogic toSubmissionParserclass and add (or adjust if #208 has been merged) unit tests.