Updated footer comment
[idzebra-moved-to-github.git] / test / xpath / xpath2.c
1 /* This file is part of the Zebra server.
2    Copyright (C) 1994-2009 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 /** xpath2.c - index a a bit more complex sgml record and search in it */
23
24 const char *myrec[] = {
25     "<Zthes> \n"
26     " <termId>10</termId> \n"
27     " <termName>Sauropoda</termName> \n"
28     " <termType>PT</termType> \n"
29     " <relation> \n"
30     "  <relationType>BT</relationType> \n"
31     "  <termId>5</termId> \n"
32     "  <termName>Brontosauria</termName> \n"
33     "  <termType>PT</termType> \n"
34     " </relation> \n"
35     " <relation> \n"
36     "  <relationType>NT</relationType> \n"
37     "  <termId>11</termId> \n"
38     "  <termName>Eusauropoda</termName> \n"
39     "  <termType>PT</termType> \n"
40     " </relation> \n"
41     "</Zthes> \n",
42
43     "<Zthes> \n"
44     " <termId>5</termId> \n"
45     " <termName>Brontosauria</termName> \n"
46     " <termType>PT</termType> \n"
47     " <relation> \n"
48     "  <relationType>BT</relationType> \n"
49     "  <termId>4</termId> \n"
50     "  <termName>Sauropodomorpha</termName> \n"
51     "  <termType>PT</termType> \n"
52     " </relation> \n"
53     " <relation> \n"
54     "  <relationType>NT</relationType> \n"
55     "  <termId>6</termId> \n"
56     "  <termName>Plateosauria</termName> \n"
57     "  <termType>PT</termType> \n"
58     " </relation> \n"
59     " <relation> \n"
60     "  <relationType>NT</relationType> \n"
61     "  <termId>10</termId> \n"
62     "  <termName>Sauropoda</termName> \n"
63     "  <termType>PT</termType> \n"
64     " </relation> \n"
65     "</Zthes> \n",
66     0};
67
68
69 static void tst(int argc, char **argv)
70 {
71     ZebraService zs = tl_start_up(0, argc, argv);
72     ZebraHandle zh = zebra_open(zs, 0);
73     YAZ_CHECK(tl_init_data(zh, myrec));
74
75     YAZ_CHECK(tl_query(zh, "@attr 1=/Zthes/termName Sauropoda", 1));
76     YAZ_CHECK(tl_query(zh, "@attr 1=/Zthes/relation/termName Sauropoda", 1));
77
78     YAZ_CHECK(tl_close_down(zh, zs));
79 }
80
81 TL_MAIN
82
83 /*
84  * Local variables:
85  * c-basic-offset: 4
86  * c-file-style: "Stroustrup"
87  * indent-tabs-mode: nil
88  * End:
89  * vim: shiftwidth=4 tabstop=8 expandtab
90  */
91