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