当前位置: 首页>>代码示例>>C#>>正文


C# SobekCM_Item.Read_From_MARC_XML方法代码示例

本文整理汇总了C#中SobekCM_Item.Read_From_MARC_XML方法的典型用法代码示例。如果您正苦于以下问题:C# SobekCM_Item.Read_From_MARC_XML方法的具体用法?C# SobekCM_Item.Read_From_MARC_XML怎么用?C# SobekCM_Item.Read_From_MARC_XML使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在SobekCM_Item的用法示例。


在下文中一共展示了SobekCM_Item.Read_From_MARC_XML方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Find_UFDC_METS


//.........这里部分代码省略.........
                string author = String.Empty;
                string donor = String.Empty;
                string pubDate = String.Empty;
                string alephNumber = String.Empty;
                string oclcNumber = String.Empty;

                if (itemRow["Publisher"] != DBNull.Value)
                    publisher = itemRow["Publisher"].ToString();
                if (itemRow["Author"] != DBNull.Value)
                    author = itemRow["Author"].ToString();
                if (itemRow["Donor"] != DBNull.Value)
                    donor = itemRow["Donor"].ToString();
                if (itemRow["PubDate"] != DBNull.Value)
                    pubDate = itemRow["PubDate"].ToString();
                if (itemRow["ALEPH_Number"] != DBNull.Value)
                    alephNumber = itemRow["ALEPH_Number"].ToString();
                if (itemRow["OCLC_Number"] != DBNull.Value)
                    oclcNumber = itemRow["OCLC_Number"].ToString();

                // Look for an OCLC record MarcXML file
                if (oclcNumber.Length > 1)
                {
                    oclcNumber = oclcNumber.PadLeft(8, '0');
                    StringBuilder oclcDirBuilder = new StringBuilder(SOBEKCM_DATA_LOCATION + "MARCXML\\OCLC\\");
                    foreach (char thisChar in oclcNumber)
                    {
                        oclcDirBuilder.Append(thisChar + "\\");
                    }
                    if ((Directory.Exists(oclcDirBuilder.ToString())) && (File.Exists(oclcDirBuilder.ToString() + oclcNumber + ".xml")))
                    {
                        // Read this in then
                        bibPackage = new SobekCM_Item();
                        recordCreated = true;
                        bibPackage.Read_From_MARC_XML(oclcDirBuilder.ToString() + oclcNumber + ".xml");
                        bibPackage.Bib_Info.Record.Record_Origin = "Imported from (OCLC)" + oclcNumber;
                    }
                }

                // Look for a local catalog record MarcXML file
                if ((!recordCreated) && (alephNumber.Length > 1))
                {
                    alephNumber = alephNumber.PadLeft(9, '0');
                    StringBuilder alephDirBuilder = new StringBuilder(SOBEKCM_DATA_LOCATION + "MARCXML\\");
                    foreach (char thisChar in alephNumber)
                    {
                        alephDirBuilder.Append(thisChar + "\\");
                    }
                    if ((Directory.Exists(alephDirBuilder.ToString())) && (File.Exists(alephDirBuilder.ToString() + alephNumber + ".xml")))
                    {
                        // Read this in then
                        bibPackage = new SobekCM_Item();
                        recordCreated = true;
                        bibPackage.Read_From_MARC_XML(alephDirBuilder.ToString() + alephNumber + ".xml");
                        bibPackage.Bib_Info.Record.Record_Origin = "Imported from (ALEPH)" + alephNumber;
                    }
                }

                // If not created, make a blank item
                if (!recordCreated)
                {
                    bibPackage = new SobekCM_Item();
                    bibPackage.Bib_Info.Record.Record_Origin = "Derived from the SobekCM databse";
                    bibPackage.Bib_Info.Main_Title.Title = title;
                    if (author.IndexOf("|") > 0)
                    {
                        string[] authors = author.Split("|".ToCharArray());
开发者ID:Elkolt,项目名称:SobekCM-Web-Application,代码行数:67,代码来源:SobekCM_METS_Finder.cs

示例2: read_marc_file

        private static bool read_marc_file(SobekCM_Item BIBPackage, string ThisRecord, string MARCDirectory)
        {
            // Compute the folder name
            string folder = MARCDirectory;
            foreach (char thisChar in ThisRecord)
            {
                folder = folder + thisChar + "\\";
            }

            // Does this folder exist?
            if ((Directory.Exists(folder)) && (File.Exists(folder + ThisRecord + ".xml")))
            {
                try
                {
                    // The date could be rewritten by the load from MARC, so save it
                    string date = BIBPackage.Bib_Info.Origin_Info.Date_Issued;

                    // Read this in then
                    BIBPackage.Read_From_MARC_XML(folder + ThisRecord + ".xml");

                    // Save the date back, if there was one
                    if (date.Length > 0)
                        BIBPackage.Bib_Info.Origin_Info.Date_Issued = date;

                    // Set the flag and break out of this loop
                    return true;
                }
                catch (Exception ee)
                {
                    Error = "Error while reading '" + folder + ThisRecord + ".xml'. This is probably because the XML file indicated is not valid XML. To correct, go to the file and edit it to make it valid.";
                    throw new ApplicationException(Error, ee);
                }
            }
            return false;
        }
开发者ID:Elkolt,项目名称:SobekCM-Web-Application,代码行数:35,代码来源:Bib_Package_Builder.cs


注:本文中的SobekCM_Item.Read_From_MARC_XML方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。