+ if (p_config->xmloutput)
+ fprintf(config.outfile,
+ "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
+ "<icu>\n"
+ "<tokens>\n");
+
+ // read input lines for processing
+ while ((line_len = getline(&line, &line_cap, config.infile)) != -1) {
+ success = icu_chain_assign_cstr(config.chain, line, &status);
+ line_count++;
+
+ while (success && icu_chain_next_token(config.chain, &status)){
+ if (U_FAILURE(status))
+ success = 0;
+ else {
+ token_count++;
+ if (p_config->xmloutput)
+ fprintf(config.outfile,
+ "<token id=\%lu\" line=\"%lu\""
+ " norm=\"%s\" display=\"%s\"/>\n",
+ token_count,
+ line_count,
+ icu_chain_get_norm(config.chain),
+ icu_chain_get_display(config.chain));
+ else
+ fprintf(config.outfile, "%lu %lu '%s' '%s'\n",
+ token_count,
+ line_count,
+ icu_chain_get_norm(config.chain),
+ icu_chain_get_display(config.chain));
+ }
+ }
+
+ }
+
+ if (p_config->xmloutput)
+ fprintf(config.outfile,
+ "</tokens>\n"
+ "</icu>\n");
+
+ icu_chain_destroy(config.chain);
+ xmlFreeDoc(doc);
+ if (line)
+ free(line);
+};
+
+
+int main(int argc, char **argv)
+{
+
+ read_params(argc, argv, &config);