68a90204aa0c40186a1d8886885b949d289fc5ea
[idzebra-moved-to-github.git] / test / api / xpath3.c
1
2 /* $Id: xpath3.c,v 1.2 2004-12-02 11:28:20 adam Exp $
3    Copyright (C) 2003,2004
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 "testlib.h"
25
26
27 /** xpath3.c - attributes, with Danish characters */
28
29 const char *myrec[] = {
30     "<root> \n"
31     "  <!-- Space in attribute --> \n"
32     "  <first attr=\"danish\">content</first> \n"
33     "  <second attr=\"danish lake\">content</second> \n"
34     "  <!-- Oslash in Latin-1 encoded below.. --> \n"
35     "  <third attr=\"dansk sø\">content<third> \n"
36     "</root> \n",
37     0};
38
39
40 int main(int argc, char **argv)
41 {
42     ZebraService zs = start_up("zebraxpath.cfg", argc, argv);
43     ZebraHandle zh = zebra_open(zs);
44     init_data(zh, myrec);
45
46 #define q(qry,hits) do_query(__LINE__,zh,qry,hits)
47
48     q("@attr 1=/root content",1);
49     q("@attr 1=/root/first content",1);
50     q("@attr {1=/root/first[@attr='danish']} content",1);
51     q("@attr {1=/root/second[@attr='danish lake']} content",1);
52     /*q("@attr {1=/root/third[@attr='dansk sø']} content",1); */
53     /* FIXME - This triggers bug200 */
54
55     return close_down(zh, zs, 0);
56 }