-SUBDIRS=codec api gils malxml config usmarc dmoz xpath sort sort2 xelm cddb \
+SUBDIRS=codec api gils malxml config usmarc dmoz sort sort2 xelm cddb \
rusmarc zsh marcxml charmap
-# $Id: Makefile.am,v 1.22 2004-10-29 13:02:39 heikki Exp $
+# $Id: Makefile.am,v 1.23 2004-10-29 14:16:22 heikki Exp $
noinst_PROGRAMS = testclient
testclient_SOURCES = testclient.c
simpletests = t1 t2 t3 t4 t5 t6 t7 t8 t9 t10
-xpathtests= xpath1
+xpathtests= xpath1 xpath2 xpath3 xpath4
#check_PROGRAMS = t1 t2 t3 t4 t5 t6 t7 t8 t9 t10 xpath1
check_PROGRAMS = ${simpletests} ${xpathtests}
TESTS = $(check_PROGRAMS)
t10_SOURCES = t10.c testlib.c testlib.h rankingrecords.h
xpath1_SOURCES = xpath1.c testlib.c testlib.h
+xpath2_SOURCES = xpath2.c testlib.c testlib.h
+xpath3_SOURCES = xpath3.c testlib.c testlib.h
+xpath4_SOURCES = xpath4.c testlib.c testlib.h
AM_CPPFLAGS = -I$(top_srcdir)/include $(YAZINC)
--- /dev/null
+/* $Id: xpath2.c,v 1.1 2004-10-29 14:16:22 heikki Exp $
+ Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002,2003,2004
+ Index Data Aps
+
+This file is part of the Zebra server.
+
+Zebra is free software; you can redistribute it and/or modify it under
+the terms of the GNU General Public License as published by the Free
+Software Foundation; either version 2, or (at your option) any later
+version.
+
+Zebra is distributed in the hope that it will be useful, but WITHOUT ANY
+WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with Zebra; see the file LICENSE.zebra. If not, write to the
+Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+02111-1307, USA.
+*/
+
+#include "testlib.h"
+
+
+/** xpath2.c - index a a bit more complex sgml record and search in it */
+
+const char *myrec[] = {
+ "<Zthes> \n"
+ " <termId>10</termId> \n"
+ " <termName>Sauropoda</termName> \n"
+ " <termType>PT</termType> \n"
+ " <relation> \n"
+ " <relationType>BT</relationType> \n"
+ " <termId>5</termId> \n"
+ " <termName>Brontosauria</termName> \n"
+ " <termType>PT</termType> \n"
+ " </relation> \n"
+ " <relation> \n"
+ " <relationType>NT</relationType> \n"
+ " <termId>11</termId> \n"
+ " <termName>Eusauropoda</termName> \n"
+ " <termType>PT</termType> \n"
+ " </relation> \n"
+ "</Zthes> \n",
+
+ "<Zthes> \n"
+ " <termId>5</termId> \n"
+ " <termName>Brontosauria</termName> \n"
+ " <termType>PT</termType> \n"
+ " <relation> \n"
+ " <relationType>BT</relationType> \n"
+ " <termId>4</termId> \n"
+ " <termName>Sauropodomorpha</termName> \n"
+ " <termType>PT</termType> \n"
+ " </relation> \n"
+ " <relation> \n"
+ " <relationType>NT</relationType> \n"
+ " <termId>6</termId> \n"
+ " <termName>Plateosauria</termName> \n"
+ " <termType>PT</termType> \n"
+ " </relation> \n"
+ " <relation> \n"
+ " <relationType>NT</relationType> \n"
+ " <termId>10</termId> \n"
+ " <termName>Sauropoda</termName> \n"
+ " <termType>PT</termType> \n"
+ " </relation> \n"
+ "</Zthes> \n",
+ 0};
+
+
+int main(int argc, char **argv)
+{
+ ZebraService zs = start_up("zebraxpath.cfg", argc, argv);
+ ZebraHandle zh = zebra_open (zs);
+ init_data(zh,myrec);
+
+ do_query(__LINE__,zh, "@attr 1=/Zthes/termName Sauropoda", 1);
+ do_query(__LINE__,zh, "@attr 1=/Zthes/relation/termName Sauropoda",1);
+
+ return close_down(zh, zs, 0);
+}
--- /dev/null
+
+/* $Id: xpath3.c,v 1.1 2004-10-29 14:16:22 heikki Exp $
+ Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002,2003,2004
+ Index Data Aps
+
+This file is part of the Zebra server.
+
+Zebra is free software; you can redistribute it and/or modify it under
+the terms of the GNU General Public License as published by the Free
+Software Foundation; either version 2, or (at your option) any later
+version.
+
+Zebra is distributed in the hope that it will be useful, but WITHOUT ANY
+WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with Zebra; see the file LICENSE.zebra. If not, write to the
+Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+02111-1307, USA.
+*/
+
+#include "testlib.h"
+
+
+/** xpath3.c - attributes, with Danish characters */
+
+const char *myrec[] = {
+ "<root> \n"
+ " <!-- Space in attribute --> \n"
+ " <first attr=\"danish\">content</first> \n"
+ " <second attr=\"danish lake\">content</second> \n"
+ " <!-- Oslash in Latin-1 encoded below.. --> \n"
+ " <third attr=\"dansk sø\">content<third> \n"
+ "</root> \n",
+ 0};
+
+
+int main(int argc, char **argv)
+{
+ ZebraService zs = start_up("zebraxpath.cfg", argc, argv);
+ ZebraHandle zh = zebra_open (zs);
+ init_data(zh,myrec);
+
+#define q(qry,hits) do_query(__LINE__,zh,qry,hits)
+
+ q("@attr 1=/root content",1);
+ q("@attr 1=/root/first content",1);
+ q("@attr {1=/root/first[@attr='danish']} content",1);
+ q("@attr {1=/root/second[@attr='danish lake']} content",1);
+ /*q("@attr {1=/root/third[@attr='dansk sø']} content",1); */
+ /* FIXME - This triggers bug200 */
+
+ return close_down(zh, zs, 0);
+}
--- /dev/null
+
+
+/* $Id: xpath4.c,v 1.1 2004-10-29 14:16:22 heikki Exp $
+ Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002,2003,2004
+ Index Data Aps
+
+This file is part of the Zebra server.
+
+Zebra is free software; you can redistribute it and/or modify it under
+the terms of the GNU General Public License as published by the Free
+Software Foundation; either version 2, or (at your option) any later
+version.
+
+Zebra is distributed in the hope that it will be useful, but WITHOUT ANY
+WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with Zebra; see the file LICENSE.zebra. If not, write to the
+Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+02111-1307, USA.
+*/
+
+#include "testlib.h"
+
+
+/** xpath4.c - Attributes */
+
+const char *myrec[] = {
+ "<record> \n"
+ " <title>foo</title> \n"
+ " <title>bar</title> \n"
+ " <author>gryf</author> \n"
+ "</record> \n",
+
+ "<record> \n"
+ " <title>foo bar</title> \n"
+ " <author>gryf</author> \n"
+ "</record> \n",
+
+ "<record> \n"
+ " <title lang=en>foo gryf</title> \n"
+ " <author>grunt</author> \n"
+ "</record> \n",
+
+ "<record> \n"
+ " <title lang=da>foo grunt</title> \n"
+ " <value>bar</value> \n"
+ "</record> \n",
+
+ "<record> \n"
+ " <title>hamlet</title> \n"
+ " <author>foo bar grunt</author> \n"
+ "</record> \n",
+
+ 0};
+
+
+int main(int argc, char **argv)
+{
+ ZebraService zs = start_up("zebraxpath.cfg", argc, argv);
+ ZebraHandle zh = zebra_open (zs);
+ init_data(zh,myrec);
+
+#define q(qry,hits) do_query(__LINE__,zh,qry,hits)
+
+ q("@attr 1=/record/title foo",4);
+ q("@attr 1=/record/title bar",2);
+ q("@attr 1=/record/title[@lang='da'] foo",1);
+ q("@attr 1=/record/title[@lang='en'] foo",1);
+ q("@attr 1=/record/title @and foo bar",2);
+ /* The last one returns two hits, as the and applies to the whole
+ record, so it matches <title>foo</title><title>bar</title>
+ This might not have to be like that, but currently that is what
+ zebra does. */
+ q("@and @attr 1=/record/title foo @attr 1=/record/title bar ",2);
+ return close_down(zh, zs, 0);
+}
--- /dev/null
+# $Id: zebraxpath.cfg,v 1.1 2004-10-29 14:16:22 heikki Exp $
+profilePath: ${srcdir:-.}/../../tab
+recordType: grs.sgml
+attset: bib1.att
+
+isam:b
+
+
+
+
--- /dev/null
+
+the xpath tests have been moved into test/api/xpath*.c
+This directory is not used any more, and should be deleted
+