- if (p_config->xmloutput)
- fprintf(config.outfile,
- "<token id=\%lu\" line=\"%lu\""
- " norm=\"%s\" display=\"%s\"/>\n",
- token_count,
- line_count,
- icu_chain_token_norm(config.chain),
- icu_chain_token_display(config.chain));
+ if (p_config->xmloutput)
+ {
+ fprintf(p_config->outfile,
+ "<token id=\"%lu\" line=\"%lu\"",
+ token_count, line_count);
+
+ wrbuf_rewind(cdata);
+ wrbuf_xmlputs(cdata, icu_chain_token_norm(p_config->chain));
+ fprintf(p_config->outfile, " norm=\"%s\"",
+ wrbuf_cstr(cdata));
+
+ wrbuf_rewind(cdata);
+ wrbuf_xmlputs(cdata, icu_chain_token_display(p_config->chain));
+ fprintf(p_config->outfile, " display=\"%s\"",
+ wrbuf_cstr(cdata));
+
+ if (p_config->sortoutput)
+ {
+ wrbuf_rewind(cdata);
+ wrbuf_xmlputs(cdata, wrbuf_cstr(sw));
+ fprintf(p_config->outfile, " sortkey=\"%s\"",
+ wrbuf_cstr(cdata));
+ }
+ fprintf(p_config->outfile, "/>\n");
+ }