continue;
for (md = ml[imeta]; md; md = md->next)
{
- wrbuf_printf(w, "\n<md-%s>", cmd->name);
+ struct record_metadata_attr *attr = md->attributes;
+ wrbuf_printf(w, "\n<md-%s", cmd->name);
+ for (; attr; attr = attr->next)
+ {
+ wrbuf_printf(w, " %s=\"", attr->name);
+ wrbuf_xmlputs(w, attr->value);
+ wrbuf_puts(w, "\"");
+ }
+ wrbuf_puts(w, ">");
switch (cmd->type)
{
case Metadata_type_generic:
}
static struct record_metadata *record_metadata_init(
- NMEM nmem, const char *value, enum conf_metadata_type type)
+ NMEM nmem, const char *value, enum conf_metadata_type type,
+ struct _xmlAttr *attr)
{
struct record_metadata *rec_md = record_metadata_create(nmem);
+ struct record_metadata_attr **attrp = &rec_md->attributes;
+
+ for (; attr; attr = attr->next)
+ {
+ if (attr->children && attr->children->content)
+ {
+ if (strcmp((const char *) attr->name, "type"))
+ { /* skip the "type" attribute.. Its value is already part of
+ the element in output (md-%s) and so repeating it here
+ is redundant */
+ *attrp = nmem_malloc(nmem, sizeof(**attrp));
+ (*attrp)->name =
+ nmem_strdup(nmem, (const char *) attr->name);
+ (*attrp)->value =
+ nmem_strdup(nmem, (const char *) attr->children->content);
+ attrp = &(*attrp)->next;
+ }
+ }
+ }
+ *attrp = 0;
+
if (type == Metadata_type_generic)
{
char *p = nmem_strdup(nmem, value);
// non-merged metadata
rec_md = record_metadata_init(se->nmem, (const char *) value,
- ser_md->type);
+ ser_md->type, n->properties);
if (!rec_md)
{
yaz_log(YLOG_WARN, "bad metadata data '%s' for element '%s'",
// merged metadata
rec_md = record_metadata_init(se->nmem, (const char *) value,
- ser_md->type);
+ ser_md->type, 0);
wheretoput = &cluster->metadata[md_field_id];
// and polulate with data:
};
+struct record_metadata_attr {
+ char *name;
+ char *value;
+ struct record_metadata_attr *next;
+};
struct record_metadata {
union data_types data;
// next item of this name
struct record_metadata *next;
+ struct record_metadata_attr *attributes;
};
union data_types * data_types_assign(NMEM nmem,