示例#1
0
        /// <summary>
        /// Get from BHL the scientific names associated with the specified page.
        /// </summary>
        /// <param name="pageID"></param>
        static void GetOriginalNames(int pageID)
        {
            string outputFile   = string.Format("{0}\\{1}_names.xml", Config.OriginalFolder, pageID.ToString());
            string pageMetadata = BHLApi3.GetPageMetadata(pageID, false, true, BHLApi3.ResponseFormat.Xml, Config.BhlApiKey);

            File.WriteAllText(outputFile, pageMetadata, Encoding.UTF8);
        }
示例#2
0
        /// <summary>
        /// Get the BHL page identifiers for the specified BHL Item identifier.
        /// </summary>
        private static List <int> GetPageIDs(int itemID)
        {
            List <int> pageIDs = new List <int>();

            // Get the item metadata from the BHL API
            string itemMetadataResponse =
                BHLApi3.GetItemMetadata(itemID, true, false, false, BHLApi3.ResponseFormat.Xml, Config.BhlApiKey);

            // Extract the page identifiers from the API response
            XDocument xml = XDocument.Parse(itemMetadataResponse);

            foreach (XElement page in xml.Root
                     .Elements("Result")
                     .Elements("Item")
                     .Elements("Pages")
                     .Elements("Page"))
            {
                string pageID = page.Element("PageID").Value;
                pageIDs.Add(Convert.ToInt32(pageID));
            }

            return(pageIDs);
        }