- if (ptr->type == XML_ELEMENT_NODE &&
- !strcmp((const char *) ptr->name, "syntax"))
- {
- int match = 0; // if we match record syntax
- const char *match_type = 0;
- const char *match_error = 0;
- const char *match_marcxml = 0;
- const char *match_stylesheet = 0;
- const char *match_identifier = 0;
- const char *match_backend_type = 0;
- const char *match_backend_charset = 0;
- const char *match_usemarcon_ini_stage1 = 0;
- const char *match_usemarcon_ini_stage2 = 0;
- struct _xmlAttr *attr;
- for (attr = ptr->properties; attr; attr = attr->next)
- {
- if (!strcmp((const char *) attr->name, "type") &&
- attr->children && attr->children->type == XML_TEXT_NODE)
- match_type = (const char *) attr->children->content;
- if (!strcmp((const char *) attr->name, "error") &&
- attr->children && attr->children->type == XML_TEXT_NODE)
- match_error = (const char *) attr->children->content;
- if (!strcmp((const char *) attr->name, "marcxml") &&
- attr->children && attr->children->type == XML_TEXT_NODE)
- match_marcxml = (const char *) attr->children->content;
- if (!strcmp((const char *) attr->name, "stylesheet") &&
- attr->children && attr->children->type == XML_TEXT_NODE)
- match_stylesheet = (const char *) attr->children->content;
- if (!strcmp((const char *) attr->name, "identifier") &&
- attr->children && attr->children->type == XML_TEXT_NODE)
- match_identifier = (const char *) attr->children->content;
- if (!strcmp((const char *) attr->name, "backendtype") &&
- attr->children && attr->children->type == XML_TEXT_NODE)
- match_backend_type = (const char *)
- attr->children->content;
- if (!strcmp((const char *) attr->name, "backendcharset") &&
- attr->children && attr->children->type == XML_TEXT_NODE)
- match_backend_charset = (const char *)
- attr->children->content;
- if (!strcmp((const char *) attr->name, "usemarconstage1") &&
- attr->children && attr->children->type == XML_TEXT_NODE)
- match_usemarcon_ini_stage1 = (const char *)
- attr->children->content;
- if (!strcmp((const char *) attr->name, "usemarconstage2") &&
- attr->children && attr->children->type == XML_TEXT_NODE)
- match_usemarcon_ini_stage2 = (const char *)
- attr->children->content;
- }
- if (match_type)
- {
- if (!strcmp(match_type, "*"))
- match = 1;
- else if (!strcmp(match_type, "none"))
- {
- if (syntax == 0)
- match = 1;
- }
- else if (syntax)
- {
- int match_oid[OID_SIZE];
- oid_name_to_oid(CLASS_RECSYN, match_type, match_oid);
- if (oid_oidcmp(match_oid, syntax) == 0)
- match = 1;
- }
- }
- if (match)
- {
- if (!match_error)
- syntax_has_matched = 1;
- match = m_cp->check_schema(ptr->children, comp,
- match_identifier);
- }
- if (match)
- {
- if (stylesheet && match_stylesheet)
- {
- xfree(*stylesheet);
- *stylesheet = xstrdup(match_stylesheet);
- }
- if (schema && match_identifier)
- {
- xfree(*schema);
- *schema = xstrdup(match_identifier);
- }
- if (backend_type && match_backend_type)
- {
- xfree(*backend_type);
- *backend_type = xstrdup(match_backend_type);
- }
- if (backend_charset && match_backend_charset)
- {
- xfree(*backend_charset);
- *backend_charset = xstrdup(match_backend_charset);
- }
- if (usemarcon_ini_stage1 && match_usemarcon_ini_stage1)
- {
- xfree(*usemarcon_ini_stage1);
- *usemarcon_ini_stage1 = xstrdup(match_usemarcon_ini_stage1);
- }
- if (usemarcon_ini_stage1 && match_usemarcon_ini_stage2)
- {
- xfree(*usemarcon_ini_stage2);
- *usemarcon_ini_stage2 = xstrdup(match_usemarcon_ini_stage2);
- }
- if (match_marcxml)
- {
- return -1;
- }
- if (match_error)
- {
- if (syntax_has_matched) // if syntax OK, bad schema/ESN
- return 25;
- if (syntax)
- {
- char dotoid_str[100];
- oid_to_dotstring(syntax, dotoid_str);
- *addinfo = odr_strdup(odr, dotoid_str);
- }
- return atoi(match_error);
- }
- return 0;
- }
- }
+ if (ptr->type == XML_ELEMENT_NODE &&
+ !strcmp((const char *) ptr->name, "syntax"))
+ {
+ int match = 0; // if we match record syntax
+ const char *match_type = 0;
+ const char *match_error = 0;
+ const char *match_marcxml = 0;
+ const char *match_stylesheet = 0;
+ const char *match_identifier = 0;
+ const char *match_backend_type = 0;
+ const char *match_backend_charset = 0;
+ const char *match_usemarcon_ini_stage1 = 0;
+ const char *match_usemarcon_ini_stage2 = 0;
+ struct _xmlAttr *attr;
+ for (attr = ptr->properties; attr; attr = attr->next)
+ {
+ if (!strcmp((const char *) attr->name, "type") &&
+ attr->children && attr->children->type == XML_TEXT_NODE)
+ match_type = (const char *) attr->children->content;
+ if (!strcmp((const char *) attr->name, "error") &&
+ attr->children && attr->children->type == XML_TEXT_NODE)
+ match_error = (const char *) attr->children->content;
+ if (!strcmp((const char *) attr->name, "marcxml") &&
+ attr->children && attr->children->type == XML_TEXT_NODE)
+ match_marcxml = (const char *) attr->children->content;
+ if (!strcmp((const char *) attr->name, "stylesheet") &&
+ attr->children && attr->children->type == XML_TEXT_NODE)
+ match_stylesheet = (const char *) attr->children->content;
+ if (!strcmp((const char *) attr->name, "identifier") &&
+ attr->children && attr->children->type == XML_TEXT_NODE)
+ match_identifier = (const char *) attr->children->content;
+ if (!strcmp((const char *) attr->name, "backendtype") &&
+ attr->children && attr->children->type == XML_TEXT_NODE)
+ match_backend_type = (const char *)
+ attr->children->content;
+ if (!strcmp((const char *) attr->name, "backendcharset") &&
+ attr->children && attr->children->type == XML_TEXT_NODE)
+ match_backend_charset = (const char *)
+ attr->children->content;
+ if (!strcmp((const char *) attr->name, "usemarconstage1") &&
+ attr->children && attr->children->type == XML_TEXT_NODE)
+ match_usemarcon_ini_stage1 = (const char *)
+ attr->children->content;
+ if (!strcmp((const char *) attr->name, "usemarconstage2") &&
+ attr->children && attr->children->type == XML_TEXT_NODE)
+ match_usemarcon_ini_stage2 = (const char *)
+ attr->children->content;
+ }
+ if (match_type)
+ {
+ if (!strcmp(match_type, "*"))
+ match = 1;
+ else if (!strcmp(match_type, "none"))
+ {
+ if (syntax == 0)
+ match = 1;
+ }
+ else if (syntax)
+ {
+ int match_oid[OID_SIZE];
+ oid_name_to_oid(CLASS_RECSYN, match_type, match_oid);
+ if (oid_oidcmp(match_oid, syntax) == 0)
+ match = 1;
+ }
+ }
+ if (match)
+ {
+ if (!match_error)
+ syntax_has_matched = 1;
+ match = m_cp->check_schema(ptr->children, comp,
+ match_identifier);
+ }
+ if (match)
+ {
+ if (stylesheet && match_stylesheet)
+ {
+ xfree(*stylesheet);
+ *stylesheet = xstrdup(match_stylesheet);
+ }
+ if (schema && match_identifier)
+ {
+ xfree(*schema);
+ *schema = xstrdup(match_identifier);
+ }
+ if (backend_type && match_backend_type)
+ {
+ xfree(*backend_type);
+ *backend_type = xstrdup(match_backend_type);
+ }
+ if (backend_charset && match_backend_charset)
+ {
+ xfree(*backend_charset);
+ *backend_charset = xstrdup(match_backend_charset);
+ }
+ if (usemarcon_ini_stage1 && match_usemarcon_ini_stage1)
+ {
+ xfree(*usemarcon_ini_stage1);
+ *usemarcon_ini_stage1 = xstrdup(match_usemarcon_ini_stage1);
+ }
+ if (usemarcon_ini_stage1 && match_usemarcon_ini_stage2)
+ {
+ xfree(*usemarcon_ini_stage2);
+ *usemarcon_ini_stage2 = xstrdup(match_usemarcon_ini_stage2);
+ }
+ if (match_marcxml)
+ {
+ return -1;
+ }
+ if (match_error)
+ {
+ if (syntax_has_matched) // if syntax OK, bad schema/ESN
+ return 25;
+ if (syntax)
+ {
+ char dotoid_str[100];
+ oid_to_dotstring(syntax, dotoid_str);
+ *addinfo = odr_strdup(odr, dotoid_str);
+ }
+ return atoi(match_error);
+ }
+ return 0;
+ }
+ }