Test on all text nodes of a document. @param file file to be parsed @throws Exception exception
(final String file)
| 76 | * @throws Exception exception |
| 77 | */ |
| 78 | private static void texts(final String file) throws Exception { |
| 79 | final String query = "let $doc := doc('" + file + "')" + |
| 80 | "for $i in $doc//(@hohoho | text()) return data($i)"; |
| 81 | |
| 82 | final TokenList tl = new TokenList(); |
| 83 | final TokenBuilder tb = new TokenBuilder(); |
| 84 | try(QueryProcessor qp = new QueryProcessor(query, context)) { |
| 85 | final Iter iter = qp.iter(); |
| 86 | for(Item item; (item = iter.next()) != null;) { |
| 87 | final byte[] token = item.string(null); |
| 88 | tl.add(token); |
| 89 | tb.add(token).add(' '); |
| 90 | } |
| 91 | } |
| 92 | |
| 93 | run(tl.finish()); |
| 94 | run(tb.finish()); |
| 95 | } |
| 96 | |
| 97 | /** |
| 98 | * Tests the correctness of the compressed tokens. |