convert_xml_string_to_value (struct ccase *c, const struct variable *var,
const xmlChar *xv)
{
- char *text;
int n_bytes = 0;
union value *v = case_data_rw (c, var);
- text = recode_string (CONV_UTF8_TO_PSPP, (const char *) xv, -1);
+ const char *text = (const char *) xv;
if ( text)
n_bytes = MIN (var_get_width (var), strlen (text));
if ( errno != 0 || endptr == text)
v->f = SYSMIS;
}
-
- free (text);
}
struct var_spec
if ( idx >= n_var_specs )
{
n_var_specs = idx + 1 ;
- var_spec = realloc (var_spec, sizeof (*var_spec) * n_var_specs);
+ var_spec = xrealloc (var_spec, sizeof (*var_spec) * n_var_specs);
var_spec [idx].name = NULL;
var_spec [idx].width = -1;
var_spec [idx].first_value = NULL;
if ( r->node_type == XML_READER_TYPE_TEXT )
{
- char *text ;
xmlChar *value = xmlTextReaderValue (r->xtr);
-
- text = recode_string (CONV_UTF8_TO_PSPP, (const char *) value, -1);
+ const char *text = (const char *) value;
if ( r->row < r->start_row)
{
if ( gri->read_names )
{
- var_spec [idx].name = strdup (text);
+ var_spec [idx].name = xstrdup (text);
}
}
else
}
free (value);
- free (text);
}
else if ( r->node_type == XML_READER_TYPE_ELEMENT
&& r->state == STATE_CELL)
/* Create the dictionary and populate it */
*dict = r->dict = dict_create ();
+ dict_set_encoding (r->dict, (const char *) xmlTextReaderConstEncoding (r->xtr));
+
r->value_cnt = 0;
for (i = 0 ; i < n_var_specs ; ++i )