-/* $Id: d1_read.c,v 1.8.2.1 2005-01-17 22:12:51 adam Exp $
+/* $Id: d1_read.c,v 1.8.2.2 2005-04-23 16:31:54 adam Exp $
Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002,2003,2004
Index Data Aps
{
data1_xattr *xattr;
- char tag[64];
- char args[256];
+ char tag[256];
int null_tag = 0;
int end_tag = 0;
size_t i = 0;
end_tag = 1;
c = ampr (get_byte, fh, &);
}
+ else if (amp == 0 && c == '?')
+ {
+ int quote_mode = 0;
+ while ((c = ampr(get_byte, fh, &)))
+ {
+ if (amp)
+ continue;
+ if (quote_mode == 0)
+ {
+ if (c == '"')
+ quote_mode = c;
+ else if (c == '\'')
+ quote_mode = c;
+ else if (c == '>')
+ {
+ c = ampr(get_byte, fh, &);
+ break;
+ }
+ }
+ else
+ {
+ if (amp == 0 && c == quote_mode)
+ quote_mode = 0;
+ }
+ }
+ continue;
+ }
else if (amp == 0 && c == '!')
{
int c0, amp0;
}
tag[i] = '\0';
xattr = data1_read_xattr (dh, m, get_byte, fh, wrbuf, &c, &);
- args[0] = '\0';
if (amp == 0 && c == '/')
{ /* <tag attrs/> or <tag/> */
null_tag = 1;
}
continue;
}
- else if (!strcmp(tag, "var"))
+ else if (!strcmp(tag, "var")
+ && xattr && xattr->next && xattr->next->next
+ && xattr->value == 0
+ && xattr->next->value == 0
+ && xattr->next->next->value == 0)
{
- char tclass[DATA1_MAX_SYMBOL], type[DATA1_MAX_SYMBOL];
+ /* <var class type value> */
+ const char *tclass = xattr->name;
+ const char *type = xattr->next->name;
+ const char *value = xattr->next->name;
data1_vartype *tp;
- int val_offset;
-
- if (sscanf(args, "%s %s %n", tclass, type, &val_offset) != 2)
- {
- yaz_log(LOG_WARN, "Malformed variant triple at '%s'", tag);
- continue;
- }
+
if (!(tp =
data1_getvartypebyct(dh,
parent->root->u.root.absyn->varset,
res = data1_mk_node2 (dh, m, DATA1N_variant, parent);
res->u.variant.type = tp;
res->u.variant.value =
- data1_insert_string (dh, res, m, args + val_offset);
+ data1_insert_string (dh, res, m, value);
}
}
else
-/* $Id: d1_varset.c,v 1.2 2002-10-22 13:19:50 adam Exp $
+/* $Id: d1_varset.c,v 1.2.2.1 2005-04-23 16:31:54 adam Exp $
Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002
Index Data Aps
#include <data1.h>
data1_vartype *data1_getvartypebyct (data1_handle dh, data1_varset *set,
- char *zclass, char *type)
+ const char *zclass, const char *type)
{
data1_varclass *c;
data1_vartype *t;
-/* $Id: data1.h,v 1.10 2004-08-04 08:35:23 adam Exp $
+/* $Id: data1.h,v 1.9.2.1 2005-04-23 16:31:55 adam Exp $
Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002,2003,2004
Index Data Aps
#include <yaz/oid.h>
#include <yaz/proto.h>
-#include <zebraver.h>
#include <d1_attset.h>
#include <d1_map.h>
#include <yaz/yaz-util.h>
YAZ_EXPORT data1_varset *data1_read_varset(data1_handle dh, const char *file);
YAZ_EXPORT data1_vartype *data1_getvartypebyct(data1_handle dh,
data1_varset *set,
- char *zclass, char *type);
+ const char *zclass,
+ const char *type);
YAZ_EXPORT Z_Espec1 *data1_read_espec1(data1_handle dh, const char *file);
YAZ_EXPORT int data1_doespec1(data1_handle dh, data1_node *n, Z_Espec1 *e);
YAZ_EXPORT data1_esetname *data1_getesetbyname(data1_handle dh,
YAZ_EXPORT void data1_set_root(data1_handle dh, data1_node *res,
NMEM nmem, const char *name);
-YAZ_EXPORT data1_node *data1_mk_tag_data_zint (data1_handle dh, data1_node *at,
- const char *tag, zint num,
- NMEM nmem);
YAZ_EXPORT data1_node *data1_mk_tag_data_int (data1_handle dh, data1_node *at,
const char *tag, int num,
NMEM nmem);