ropensci / ruODK

ruODK: An R Client for the ODK Central API
https://docs.ropensci.org/ruODK/
GNU General Public License v3.0
42 stars 13 forks source link

How to retrieve XForm elements like field labels and hints #75

Closed dmenne closed 4 years ago

dmenne commented 4 years ago

To recreate the form as as pdf-report, I need access to the labels and hints.

Where to find these?

dmenne commented 4 years ago
cat(paste(form_xml(FALSE), collapse = "\n"), file = "a.xml")

Or is there an easier way?

florianm commented 4 years ago

Form field labels and hints are contained in the form definition. In contrast, the form_schema only contains database names of form fields and their path in the form, but not presentation elements like labels and hints.

ruODK gets mainly form data against the database names of fields. If you need other parts of the form definition, you can export the form definition both as XForm and as XLSForm - the latter only works if you have created the ODK Central form from an XLSform.

ruODK isn't doing anything nice with the XForm XML apart from representing it as a nested list.

I see three ways to re-create the form:

florianm commented 4 years ago

Closing and continuing discussion at #77