handling of key value lists
key value lists are typically used in conjunction with select controls to provide dynamic options to choose from.
In XForms these are represented in XML which either creates additional effort to write and bind them as well as runtime overhead:
- they need to be kept in form-session
- they need to be converted to JSON
- they bloat the model markup with essentially readonly data
- key/values can be encoded in XML in a myriad of ways which makes it necessary to map them for consumption of a control. This is certainly possible but creates additional runtime and implementation overhead.
As key/value list are static by nature (set aside filtering, sorting or subselections).
Long story short - in the eXist-db context pure JSON key/value list might be a much more elegant solution.
The demo '07_select_autocomplete.html' uses this approach. In a server-side context it would be very easy to provide a URL that returns those key/value list in a fixed format like:
[ {"label":"LightGreen","value":"lightgreen"} ]