/// <summary> /// 将 USMARC 记录从 880 模式转换为 平行模式 /// </summary> /// <param name="record">要处理的记录</param> public static void ToParallel(MarcRecord record) { // 选定全部 880 字段 MarcNodeList fields = record.select("field[@name='880']"); if (fields.count == 0) { return; } foreach (MarcField field in fields) { string content_6 = field.select("subfield[@name='6']").FirstContent; if (string.IsNullOrEmpty(content_6) == true) { continue; } // 拆解 $6 内容 string strFieldName = ""; string strNumber = ""; string strScriptId = ""; string strOrientation = ""; _parseSubfield6(content_6, out strFieldName, out strNumber, out strScriptId, out strOrientation); if (string.IsNullOrEmpty(strScriptId) == true) { // 修正 $6 // 例子 ISBN 9789860139976 strScriptId = "$1"; field.select("subfield[@name='6']").Content = _buildSubfield6(strFieldName, strNumber, strScriptId, strOrientation); } // 找到关联的字段 MarcField main_field = _findField(record, strFieldName, field.Name, strNumber); if (main_field != null) { // 创建一个新的字段,把 880 字段内容复制过去 MarcField new_field = new MarcField(strFieldName, field.Indicator, field.Content); // 新字段插入到关联字段后面 main_field.after(new_field); // 删除 880 字段 field.detach(); main_field.select("subfield[@name='6']").Content = _buildSubfield6(strFieldName, strNumber, "", ""); } else { // 找不到关联的字段,把 880 字段的字段名修改了即可 field.Name = strFieldName; } } }