- /* note that indstr[0] is unused so we use indstr[1..] */
- struct yaz_marc_node *n = yaz_marc_add_datafield_turbo_xml(mt, tag_value);
-
- int rc = yaz_marc_read_turbo_xml_subfields(mt, ptr->children, indstr);
- yaz_marc_datafield_set_indicators(n, indstr+1, strlen(indstr+1));
- if (rc)
+ for (attr = ptr->properties; attr; attr = attr->next)
+ if (strlen((const char *)attr->name) == 2 &&
+ attr->name[0] == 'i')
+ {
+ //extract indicator attribute from i#="Y" pattern
+ int no = atoi((const char *)attr->name + 1);
+ if (attr->children &&
+ attr->children->type == XML_TEXT_NODE &&
+ no <= indicator_length && no > 0 &&
+ attr->children->content[0])
+ {
+ indstr[no - 1] = attr->children->content[0];
+ }
+ else
+ {
+ yaz_marc_cprintf(
+ mt, "Bad attribute '%.80s' for 'd'",attr->name);
+ }
+ }
+ else
+ {
+ yaz_marc_cprintf(
+ mt, "Bad attribute '%.80s' for 'd'", attr->name);
+ }
+ yaz_marc_add_datafield_xml2(mt, tag_value, indstr);
+ if (yaz_marc_read_turbo_xml_subfields(mt, ptr->children /*, indstr */))