Solvberget.Domain.DTO.Book.FillPropertiesLight C# (CSharp) Method

FillPropertiesLight() protected method

protected FillPropertiesLight ( string xml ) : void
xml string
return void
        protected override void FillPropertiesLight(string xml)
        {
            base.FillPropertiesLight(xml);
            var xmlDoc = XDocument.Parse(xml);
            if (xmlDoc.Root != null)
            {
                var nodes = xmlDoc.Root.Descendants("oai_marc");

                Isbn = GetVarfield(nodes, "020", "a");

                //Author, check BSMARC field 100 for author
                var nationality = GetVarfield(nodes, "100", "j");
                string nationalityLookupValue = null;
                if (nationality != null)
                    NationalityDictionary.TryGetValue(nationality, out nationalityLookupValue);
                Author = new Person
                {
                    Name = GetVarfield(nodes, "100", "a"),
                    LivingYears = GetVarfield(nodes, "100", "d"),
                    Nationality = nationalityLookupValue ?? nationality,
                    Role = "Author"
                };

                //If N/A, check BSMARC field 110 for author
                if (Author.Name == null)
                {

                    Author.Name = GetVarfield(nodes, "110", "a");

                    //Organization (110abq)
                    Organization = GenerateOrganizationsFromXml(nodes, "110").FirstOrDefault();

                }

                //If still N/A, check BSMARC field 130 for title when title is main scheme word
                if (Author.Name == null)
                    StandarizedTitle = GetVarfield(nodes, "130", "a");

                if (Author.Name != null)
                    Author.InvertName(Author.Name);
                MainResponsible = Author;

                PartTitle = GetVarfield(nodes, "245", "p");

                if (Title != null && PartTitle != null)
                {
                    Title = Title + " : " + PartTitle;
                }

            }
        }

Usage Example

コード例 #1
0
ファイル: Book.cs プロジェクト: digbib/Solvberget
 public static new Book GetObjectFromFindDocXmlBsMarcLight(string xml)
 {
     var book = new Book();
     book.FillPropertiesLight(xml);
     return book;
 }