1 /* $Id: xpath2.c,v 1.5 2006-03-31 15:58:10 adam Exp $
2 Copyright (C) 1995-2005
5 This file is part of the Zebra server.
7 Zebra is free software; you can redistribute it and/or modify it under
8 the terms of the GNU General Public License as published by the Free
9 Software Foundation; either version 2, or (at your option) any later
12 Zebra is distributed in the hope that it will be useful, but WITHOUT ANY
13 WARRANTY; without even the implied warranty of MERCHANTABILITY or
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
17 You should have received a copy of the GNU General Public License
18 along with Zebra; see the file LICENSE.zebra. If not, write to the
19 Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
23 #include "../api/testlib.h"
25 /** xpath2.c - index a a bit more complex sgml record and search in it */
27 const char *myrec[] = {
29 " <termId>10</termId> \n"
30 " <termName>Sauropoda</termName> \n"
31 " <termType>PT</termType> \n"
33 " <relationType>BT</relationType> \n"
34 " <termId>5</termId> \n"
35 " <termName>Brontosauria</termName> \n"
36 " <termType>PT</termType> \n"
39 " <relationType>NT</relationType> \n"
40 " <termId>11</termId> \n"
41 " <termName>Eusauropoda</termName> \n"
42 " <termType>PT</termType> \n"
47 " <termId>5</termId> \n"
48 " <termName>Brontosauria</termName> \n"
49 " <termType>PT</termType> \n"
51 " <relationType>BT</relationType> \n"
52 " <termId>4</termId> \n"
53 " <termName>Sauropodomorpha</termName> \n"
54 " <termType>PT</termType> \n"
57 " <relationType>NT</relationType> \n"
58 " <termId>6</termId> \n"
59 " <termName>Plateosauria</termName> \n"
60 " <termType>PT</termType> \n"
63 " <relationType>NT</relationType> \n"
64 " <termId>10</termId> \n"
65 " <termName>Sauropoda</termName> \n"
66 " <termType>PT</termType> \n"
72 static void tst(int argc, char **argv)
74 ZebraService zs = tl_start_up(0, argc, argv);
75 ZebraHandle zh = zebra_open(zs, 0);
76 YAZ_CHECK(tl_init_data(zh, myrec));
78 YAZ_CHECK(tl_query(zh, "@attr 1=/Zthes/termName Sauropoda", 1));
79 YAZ_CHECK(tl_query(zh, "@attr 1=/Zthes/relation/termName Sauropoda", 1));
81 YAZ_CHECK(tl_close_down(zh, zs));