+void test_icu_iter2(void)
+{
+ UErrorCode status = U_ZERO_ERROR;
+ struct icu_chain * chain = 0;
+ xmlNode *xml_node;
+ struct icu_iter *iter;
+ struct icu_buf_utf8 *token;
+
+ const char * xml_str = "<icu locale=\"en\">"
+ "<transform rule=\"[:Control:] Any-Remove\"/>"
+ "<tokenize rule=\"l\"/>"
+ "<tokenize rule=\"w\"/>"
+ "<transform rule=\"[[:WhiteSpace:][:Punctuation:]] Remove\"/>"
+ "<display/>"
+ "<casemap rule=\"l\"/>"
+ "</icu>";
+
+ xmlDoc *doc = xmlParseMemory(xml_str, strlen(xml_str));
+ YAZ_CHECK(doc);
+ if (!doc)
+ return;
+ xml_node = xmlDocGetRootElement(doc);
+ YAZ_CHECK(xml_node);
+ if (!xml_node)
+ return ;
+
+ chain = icu_chain_xml_config(xml_node, 0, &status);
+
+ xmlFreeDoc(doc);
+ YAZ_CHECK(chain);
+
+ iter = icu_iter_create(chain, "Adobe Acrobat Reader, 1991-1999.");
+ YAZ_CHECK(iter);
+ if (!iter)
+ return;
+ token = icu_buf_utf8_create(0);
+ while (icu_iter_next(iter, token))
+ {
+ printf("[%.*s]", (int) token->utf8_len, token->utf8);
+ }
+ icu_buf_utf8_destroy(token);
+
+ icu_iter_destroy(iter);
+ icu_chain_destroy(chain);
+}
+
+#endif /* YAZ_HAVE_ICU */