javarosa icon indicating copy to clipboard operation
javarosa copied to clipboard

Submission element parsing code smell

Open mdudzinski opened this issue 8 years ago • 0 comments

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:

  1. The code accepts multiple submission elements - if they have different values of the id attribute - but when accessing submission element, it always returns the default one (the one without the id attribute).
  2. There is SubmissionParser class but the most of the parsing logic takes place in the XFormParser#parseSubmission private method. It makes way harder to unit test this piece of code in isolation.

Proposition

  1. 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.
  2. Move most of the XFormParser#parseSubmission logic to SubmissionParser class and add (or adjust if #208 has been merged) unit tests.

mdudzinski avatar Oct 30 '17 15:10 mdudzinski