2e1c4de179a9c47650951760468710a0146eab7f
[idzebra-moved-to-github.git] / test / xpath / xpath3.c
1 /* This file is part of the Zebra server.
2    Copyright (C) 1994-2010 Index Data
3
4 Zebra is free software; you can redistribute it and/or modify it under
5 the terms of the GNU General Public License as published by the Free
6 Software Foundation; either version 2, or (at your option) any later
7 version.
8
9 Zebra is distributed in the hope that it will be useful, but WITHOUT ANY
10 WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
12 for more details.
13
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
17
18 */
19
20 #include "../api/testlib.h"
21
22 /** xpath3.c - attributes, with Danish characters */
23
24 const char *myrec[] = {
25     "<root> \n"
26     "  <!-- Space in attribute --> \n"
27     "  <first attr=\"danish\">content</first> \n"
28     "  <second attr=\"danish lake\">content</second> \n"
29     "  <!-- Oslash in Latin-1 encoded below.. --> \n"
30     "  <third attr=\"dansk sø\">content<third> \n"
31     "</root> \n",
32     0};
33
34
35 static void tst(int argc, char **argv)
36 {
37     ZebraService zs = tl_start_up(0, argc, argv);
38     ZebraHandle zh = zebra_open(zs, 0);
39     YAZ_CHECK(tl_init_data(zh, myrec));
40
41     YAZ_CHECK(tl_query(zh, "@attr 1=/root content",1));
42     YAZ_CHECK(tl_query(zh, "@attr 1=/root/first content",1));
43     YAZ_CHECK(tl_query(zh, "@attr {1=/root/first[@attr='danish']} content",1));
44     YAZ_CHECK(tl_query(zh, "@attr {1=/root/second[@attr='danish lake']} content",1));
45     YAZ_CHECK(tl_query(zh, "@attr {1=/root/third[@attr='dansk s\xc3\xb8']} content",1)); 
46     /* FIXME - This triggers bug200 */
47
48     YAZ_CHECK(tl_close_down(zh, zs));
49 }
50
51 TL_MAIN
52 /*
53  * Local variables:
54  * c-basic-offset: 4
55  * c-file-style: "Stroustrup"
56  * indent-tabs-mode: nil
57  * End:
58  * vim: shiftwidth=4 tabstop=8 expandtab
59  */
60