导入书目记录报错 - DigitalPlatform/dp2 GitHub Wiki

在新下载的单机版上先配置书目库成果管理keys配置文件后,重建检索点-重启服务器-重启内务后,导入书目BDF文件时报错:

“保存书目记录 '成果管理/?' 时出错: 4 WriteXml() 在给'成果管理'库写入记录'0000000001'时出错,原因:这是一个未闭合的字符串。 (重试) 重试操作;(跳过) 跳过本条继续处理后面的书目记录; (中断) 中断处理”

keys文件配置如下:

<?xml version="1.0" encoding="utf-8"?>
<root>
  <nstable>
    <item prefix="marc" url="http://dp2003.com/UNIMARC" />
  </nstable>

  <key>
    <xpath nstable="">//marc:record/marc:datafield[@tag='200']/marc:subfield[@code='a']</xpath>
    <from>title</from>
    <table ref="title" />
  </key>
  <table name="title" id="2" type="title">
    <convert>
      <string style="upper,stopword,simplify" stopwordTable="title" />
    </convert>
    <convertquery>
      <string style="upper,stopword,simplify" stopwordTable="title" />
    </convertquery>
    <caption lang="zh-CN">成果名称</caption>
    <caption lang="en">Title</caption>
  </table>

  <key>
    <xpath nstable="">//marc:record/marc:datafield[@tag='200']/marc:subfield[@code='A' or @code='9']</xpath>
    <from>titlePinyin</from>
    <table ref="titlePinyin" />
  </key>
  <table name="titlePinyin" id="3" type="pinyin_title">
    <convert>
      <string style="upper,pinyinab,stopword" stopwordTable="pinyin"/>
    </convert>
    <convertquery>
      <string style="upper,removeblank" />
    </convertquery>
    <caption lang="zh-CN">成果名称拼音</caption>
    <caption lang="en">Title pinyin</caption>
  </table>

  <key>
    <xpath nstable="">//marc:record/marc:datafield[@tag='200' or @tag='225' or @tag='500' or @tag='501' or @tag='503' or @tag='510' or @tag='512' or @tag='513' or @tag='514' or @tag='515' or @tag='516' or @tag='517' or @tag='518' or @tag='520' or @tag='530' or @tag='531' or @tag='532' or @tag='540' or @tag='541' or @tag='545']/marc:subfield[@code='A' or @code='9']</xpath>
    <from>titlePinyin</from>
    <table name="titlePinyin" id="311">
      <convert>
        <string style="stopword,upper,removeblank" stopwordTable="pinyin"/>
      </convert>
    </table>
  </key>


  <key>
    <xpath nstable="">//marc:record/marc:datafield[@tag='606']/marc:subfield[@code='a' or @code='x' or @code='y' or@code='z'] | /marc:record/marc:datafield[@tag='610']/marc:subfield[@code='a'']</xpath>
    <from>Thesaurus</from>
    <table ref="Thesaurus" />
  </key>
  <table name="Thesaurus" id="4" type="subject">
    <convert>
      <string style="upper,simplify,split" />
    </convert>
    <convertquery>
      <string style="upper,simplify" />
    </convertquery>
    <caption lang="zh-CN">主题标引</caption>
    <caption lang="en">Thesaurus</caption>
  </table>


  <key>
    <xpath nstable="">//marc:record/marc:datafield[@tag='690' or @tag='692' or @tag='694']/marc:subfield[@code='a']</xpath>
    <from>class</from>
    <table ref="class" />
  </key>
  <table name="class" id="6" type="class">
    <convert>
      <string style="upper" />
    </convert>
    <convertquery>
      <string style="upper" />
    </convertquery>
    <caption lang="zh-CN">分类号</caption>
    <caption lang="en">Class number</caption>
  </table>

  <key>
    <xpath nstable="">//marc:record/marc:datafield[@tag='701']/marc:subfield[@code='a'] | >//marc:record/marc:datafield[@tag='200']/marc:subfield[@code='f']</xpath>
    <from>contributor</from>
    <table ref="contributor" />
  </key>
  <table name="contributor" id="7" type="contributor">
    <convert>
      <string style="upper,stopword,simplify" stopwordTable="title" />
    </convert>
    <convertquery>
      <string style="upper,stopword,simplify" stopwordTable="title" />
    </convertquery>
    <caption lang="zh-CN">责任者or作者</caption>
    <caption lang="en">Contributor</caption>
  </table>  
  
  <key>
    <xpath nstable="">//marc:record/marc:datafield[@tag='998']/marc:subfield[@code='a']</xpath>
    <from>batchno</from>
    <table ref="batchno" />
  </key>
  <table name="batchno" id="14" type="batchno">
    <caption lang="zh-CN">批次号</caption>
    <caption lang="en">Batch number</caption>
  </table>
  <key>
    <xpath nstable="">//marc:record/marc:datafield[@tag='998']/marc:subfield[@code='t']</xpath>
    <from>targetrecpath</from>
    <table ref="targetrecpath" />
  </key>
  <table name="targetrecpath" id="15" type="targetrecpath">
    <caption lang="zh-CN">目标记录路径</caption>
    <caption lang="en">Target Record Path</caption>
  </table>
  <key>
    <xpath nstable="">//marc:record/marc:datafield[@tag='998']/marc:subfield[@code='s']</xpath>
    <from>state</from>
    <table ref="state" />
  </key>
  <table name="state" id="16" type="state">
    <convert>
      <string style="upper,split" />
    </convert>
    <convertquery>
      <string style="upper" />
    </convertquery>
    <caption lang="zh-CN">状态</caption>
    <caption lang="en">State</caption>
  </table>
  <key>
    <xpath nstable="">//marc:record/marc:datafield[@tag='998']/marc:subfield[@code='u']</xpath>
    <from>operTime</from>
    <table ref="operTime" />
  </key>
  <table name="operTime" id="17" type="opertime">
    <convert>
      <number style="utime" />
    </convert>
    <convertquery>
      <number style="utime" />
    </convertquery>
    <caption lang="zh-CN">操作时间</caption>
    <caption lang="en">OperTime</caption>
  </table>

  <key>
    <xpath nstable="">/marc:record/marc:datafield[@tag='020' or @tag='040' or @tag='091' or @tag='092' or @tag='313']/marc:subfield[@code='a']</xpath>
    <from>identifier</from>
    <table ref="identifier" />
  </key>
  <table name="identifier" id="18" type="identifier">
    <caption lang="zh-CN">其它标识号</caption>
    <caption lang="en">Identifier</caption>
  </table>
  
  <key>
    <xpath nstable="">//marc:record/marc:datafield[@tag='997']/marc:subfield[@code='a']</xpath>
    <from>ukey</from>
    <table ref="ukey" />
  </key>
  <table name="ukey" id="20" type="ukey">
    <convert>
      <string style="upper" />
    </convert>
    <convertquery>
      <string style="upper" />
    </convertquery>
    <caption lang="zh-CN">查重键</caption>
    <caption lang="en">Uniform Key</caption>
  </table>
  
  <key>
    <xpath nstable="">//marc:record/marc:datafield[@tag='997']/marc:subfield[@code='h']</xpath>
    <from>ucode</from>
    <table ref="ucode" />
  </key>
  <table name="ucode" id="21" type="ucode">
    <caption lang="zh-CN">查重码</caption>
    <caption lang="en">Uniform Code</caption>
  </table>

<key>
    <xpath nstable="">//marc:record/marc:datafield[@tag='905']/marc:subfield[@code='b']</xpath>
    <from>chengguono</from>
    <table ref="chengguono" />
  </key>
  <table name="chengguono" id="22" type="chengguono">
    <caption lang="zh-CN">成果编号</caption>
    <caption lang="en">Chengguo No</caption>
  </table>


<key>
    <xpath nstable="">//marc:record/marc:datafield[@tag='313']/marc:subfield[@code='a']</xpath>
    <from>huojqk</from>
    <table ref="huojqk" />
  </key>
  <table name="huojqk" id="23" type="huojqk">
    <caption lang="zh-CN">获奖情况</caption>
    <caption lang="en">huojqk</caption>
  </table>

<key>
    <xpath nstable="">//marc:record/marc:datafield[@tag='541']/marc:subfield[@code='a']</xpath>
    <from>chengguono</from>
    <table ref="huojdjno" />
  </key>
  <table name="huojdjno" id="24" type="huojdjno">
    <caption lang="zh-CN">获奖等级</caption>
    <caption lang="en">huojdj No</caption>
  </table>

<key>
    <xpath nstable="">//marc:record/marc:datafield[@tag='540']/marc:subfield[@code='a']</xpath>
    <from>huojnf</from>
    <table ref="huojnf" />
  </key>
  <table name="huojnf" id="25" type="huojnf">
    <caption lang="zh-CN">获奖年份</caption>
    <caption lang="en">huojnf</caption>
  </table>

<key>
    <xpath nstable="">//marc:record/marc:datafield[@tag='517']/marc:subfield[@code='a']</xpath>
    <from>huojlb</from>
    <table ref="huojlb" />
  </key>
  <table name="huojlb" id="26" type="huojlb">
    <caption lang="zh-CN">获奖类别</caption>
    <caption lang="en">huojlb</caption>
  </table>

<key>
    <xpath nstable="">//marc:record/marc:datafield[@tag='330']/marc:subfield[@code='a']</xpath>
    <from>chengguono</from>
    <table ref="zhaiyao" />
  </key>
  <table name="zhaiyao" id="27" type="zhaiyao">
    <caption lang="zh-CN">摘要</caption>
    <caption lang="en">zhaiyao</caption>
  </table>

  
  <!-- ******************配置非用字**************************************** -->
  <stopword>
    <stopwordTable name="title">
      <separator>
        <t>,</t>
        <t>_</t>
        <t>
        </t>
        <t>·</t>
        <t>&amp;</t>
        <t>.</t>
        <t>:</t>
        <t>;</t>
        <t>!</t>
        <t>"</t>
        <t>'</t>
        <t>-</t>
        <t>&lt;</t>
        <t>&gt;</t>
        <t>-</t>
        <t>,</t>
        <t>。</t>
        <t>‘</t>
        <t>’</t>
        <t>“</t>
        <t>”</t>
        <t>—</t>
        <t>《</t>
        <t>》</t>
        <t>、</t>
      </separator>
      <word>
        <t>the</t>
        <t>a</t>
      </word>
    </stopwordTable>
    <stopwordTable name="pinyin">
      <separator>
        <t>,</t>
        <t>_</t>
        <t>
        </t>
        <t>·</t>
        <t>&amp;</t>
        <t>.</t>
        <t>:</t>
        <t>;</t>
        <t>!</t>
        <t>"</t>
        <t>'</t>
        <t>-</t>
        <t>&lt;</t>
        <t>&gt;</t>
        <t>-</t>
        <t>,</t>
        <t>。</t>
        <t>‘</t>
        <t>’</t>
        <t>“</t>
        <t>”</t>
        <t>—</t>
        <t>《</t>
        <t>》</t>
        <t>、</t>
      </separator>
      <word>
      </word>
    </stopwordTable>
  </stopword>
  <script>
    <![CDATA[

using System;
using System.Xml;
using DigitalPlatform.rms;
using DigitalPlatform.IO;

public class MyKeysHost : KeysHost
{

  public void convertISBN()
  {
       string isbn = this.InputString.Trim(); // 2017/6/26 增加 Trim()
       isbn = isbn.Replace("-", "");   //去除ISBN中的"-"连接符号
       isbn = isbn.Replace("—", ""); //为稳妥,去除ISBN中的全角"—"连接符号
 
            if (isbn.Length < 3)
            {
                this.ResultString = isbn; //如果ISBN不足3位,原样输出
                return;
            }

            string head = isbn.Substring(0, 3);       //获得新旧ISBN号的判断依据

            if (head == "978")
            {
                isbn = isbn.Substring(3, isbn.Length - 3);
 
                if (isbn.Length >= 10)
                {
                    isbn = isbn.Substring(0, 9);
                }
            }
           else
           {
                if (isbn.Length >= 10)
                {
                           isbn = isbn.Substring(0, 9);                        
                }
           }

       this.ResultString = isbn;
//     this.ResultStrings.Add(isbn);        //如果同时构造出多索引,采用添加函数
  }

  public void convertISSN()
  {
       string issn = this.InputString.Trim();
       issn = issn.Replace("-", "");   //去除ISSN中的"-"连接符号
       issn = issn.Replace("—", ""); //为稳妥,去除ISSN中的全角"—"连接符号
 
            if (issn.Length < 3)
            {
                this.ResultString = issn; //如果ISSN不足3位,原样输出
                return;
            }

            string head = issn.Substring(0, 3);       //获得新旧ISSN号的判断依据

            if (head == "977")
                issn = issn.Substring(3, issn.Length - 3);


            if (issn.Length >= 8)
                issn = issn.Substring(0, 7);                       

       this.ResultString = issn;
  }

}

]]><refs>
      <ref>system.dll</ref>
      <ref>system.xml.dll</ref>
      <ref>%bindir%\digitalplatform.xml.dll</ref>
      <ref>%bindir%\digitalplatform.io.dll</ref>
    </refs>
  </script>
</root>



⚠️ **GitHub.com Fallback** ⚠️