+
+ mp::odr odr_en(ODR_ENCODE);
+
+ const char *backend_schema = 0;
+ const Odr_oid *backend_syntax = 0;
+
+ if (input_schema && !strcmp(input_schema, "bibframe") &&
+ (!input_syntax || !oid_oidcmp(input_syntax, yaz_oid_recsyn_xml)))
+ {
+ backend_schema = "marcxml";
+ backend_syntax = yaz_oid_recsyn_xml;
+ }
+ else
+ {
+ package.move();
+ return;
+ }
+
+ if (sr_req)
+ {
+ if (backend_syntax)
+ sr_req->preferredRecordSyntax = odr_oiddup(odr_en, backend_syntax);
+ else
+ sr_req->preferredRecordSyntax = 0;
+ if (backend_schema)
+ {
+ sr_req->smallSetElementSetNames
+ = (Z_ElementSetNames *)
+ odr_malloc(odr_en, sizeof(Z_ElementSetNames));
+ sr_req->smallSetElementSetNames->which = Z_ElementSetNames_generic;
+ sr_req->smallSetElementSetNames->u.generic
+ = odr_strdup(odr_en, backend_schema);
+ sr_req->mediumSetElementSetNames = sr_req->smallSetElementSetNames;
+ }
+ else
+ {
+ sr_req->smallSetElementSetNames = 0;
+ sr_req->mediumSetElementSetNames = 0;
+ }
+ }
+ else if (pr_req)
+ {
+ if (backend_syntax)
+ pr_req->preferredRecordSyntax = odr_oiddup(odr_en, backend_syntax);
+ else
+ pr_req->preferredRecordSyntax = 0;
+
+ if (backend_schema)
+ {
+ pr_req->recordComposition
+ = (Z_RecordComposition *)
+ odr_malloc(odr_en, sizeof(Z_RecordComposition));
+ pr_req->recordComposition->which
+ = Z_RecordComp_simple;
+ pr_req->recordComposition->u.simple
+ = (Z_ElementSetNames *)
+ odr_malloc(odr_en, sizeof(Z_ElementSetNames));
+ pr_req->recordComposition->u.simple->which = Z_ElementSetNames_generic;
+ pr_req->recordComposition->u.simple->u.generic
+ = odr_strdup(odr_en, backend_schema);
+ }
+ else
+ pr_req->recordComposition = 0;
+ }