-int element_name_append_attribute_value(yaz_marc_t mt, WRBUF buffer, const char *attribute_name, char *code_data, size_t code_len) {
- // TODO Map special codes to something possible for XML ELEMENT names
-
- int encode = 0;
- int index = 0;
- for (index = 0; index < code_len; index++) {
- if (!((code_data[index] >= '0' && code_data[index] <= '9') ||
- (code_data[index] >= 'a' && code_data[index] <= 'z') ||
- (code_data[index] >= 'A' && code_data[index] <= 'Z')))
- encode = 1;
- }
- int success = 0;
- // Add as attribute
- if (encode && attribute_name)
- wrbuf_printf(buffer, " %s=\"", attribute_name);
-
- if (!encode || attribute_name)
- wrbuf_iconv_write_cdata(buffer, mt->iconv_cd, code_data, code_len);
- else
- success = -1;
-
- if (encode && attribute_name)
- wrbuf_printf(buffer, "\""); // return error if we couldn't handle it.
- return success;
+int element_name_append_attribute_value(yaz_marc_t mt, WRBUF buffer, const char *attribute_name, char *code_data, size_t code_len)
+{
+ // TODO Map special codes to something possible for XML ELEMENT names
+
+ int encode = 0;
+ int index = 0;
+ for (index = 0; index < code_len; index++)
+ {
+ if (!((code_data[index] >= '0' && code_data[index] <= '9') ||
+ (code_data[index] >= 'a' && code_data[index] <= 'z') ||
+ (code_data[index] >= 'A' && code_data[index] <= 'Z')))
+ encode = 1;
+ }
+ int success = 0;
+ // Add as attribute
+ if (encode && attribute_name)
+ wrbuf_printf(buffer, " %s=\"", attribute_name);
+
+ if (!encode || attribute_name)
+ wrbuf_iconv_write_cdata(buffer, mt->iconv_cd, code_data, code_len);
+ else
+ success = -1;
+
+ if (encode && attribute_name)
+ wrbuf_printf(buffer, "\""); // return error if we couldn't handle it.
+ return success;