/** * reduce a SelectMultiData to a vector of integers (index mode) or strings (value mode) * @param data * @return */ private ArrayList compactSelectMulti(SelectMultiData data) { ArrayList val = (ArrayList)data.Value; ArrayList choices = new ArrayList(); for (int i = 0; i < val.Count; i++) { choices.Add(extractSelection((Selection)val[i])); } return(choices); }
/** * @param data The AnswerDataObject to be serialized * @return A string containing the xforms compliant format * for a <select> tag, a string containing a list of answers * separated by space characters. */ public Object serializeAnswerData(SelectMultiData data) { ArrayList selections = (ArrayList)data.Value; IEnumerator en = selections.GetEnumerator(); StringBuilder selectString = new StringBuilder(); while (en.MoveNext()) { Selection selection = (Selection)en.Current; if (selectString.Length > 0) { selectString.Append(DELIMITER); } selectString.Append(selection.Value); } //As Crazy, and stupid, as it sounds, this is the XForms specification //for storing multiple selections. return(selectString.ToString()); }