Пример #1
0
 /// <summary>
 /// Read the list of nodes
 /// </summary>
 /// <param name="nodes"></param>
 protected virtual void ReadNodes(WBWebArgs args)
 {
     Parallel.ForEach(args.XmlParser.nodes, (node) =>
     {
         ReadNode(new WBWebArgs()
         {
             urlPage   = args.urlPage,
             XmlParser = new XmlParserWrapper(node)
         });
     });
 }
Пример #2
0
        /// <summary>
        /// Parse individual node and save into result
        /// </summary>
        /// <param name="node"></param>
        protected override void ReadNode(WBWebArgs args)
        {
            var id             = args.XmlParser.GetAttributeInt("id");
            var valueText      = args.XmlParser.GetTextImmutable(".//wb:value/text()");
            var sourceNoteText = args.XmlParser.GetTextImmutable(".//wb:sourceNote/text()");

            batchResultBlock.Post(new TopicsTable
            {
                Id         = id,
                Value      = valueText,
                SourceNote = sourceNoteText,
            });
        }
Пример #3
0
        /// <summary>
        /// Load html and read and parse response
        /// </summary>
        /// <param name="api"></param>
        protected virtual T[] LoadAndRead(WBWebArgs args)
        {
            if (args.XmlParser == null)
            {
                args.XmlParser = RequestXmlResponse(args.urlPage);
                args.XmlParser.Select(config.XPathDataNodes);
            }

            // Read Topics Nodes
            ReadNodes(args);

            return(Result.ToArray());
        }
        /// <summary>
        /// Parse individual node and save into result
        /// </summary>
        /// <param name="node"></param>
        protected override void ReadNode(WBWebArgs args)
        {
            var nameText               = args.XmlParser.GetTextImmutable("./wb:name/text()");
            var sourceText             = args.XmlParser.GetTextImmutable("./wb:source/text()");
            var sourceNoteText         = args.XmlParser.GetTextImmutable(".//wb:sourceNote/text()");
            var sourceOrganizationText = args.XmlParser.GetTextImmutable(".//wb:sourceOrganization/text()");

            var indicatorsData = new IndicatorsTable
            {
                Id                = args.XmlParser.GetAttribute("id"),
                TopicId           = TopicId,
                Name              = nameText,
                SourceId          = args.XmlParser.GetAttributeInt("./wb:source", "id"),
                Source            = sourceText,
                SourceNote        = sourceNoteText,
                SourceOrgaisation = sourceOrganizationText,
            };

            //logger.Info($"Read indicator id '{indicatorsData.Id} for Topic '{TopicId}' on request Uri '{args.urlPage}'");

            batchResultBlock.Post(indicatorsData);
        }
Пример #5
0
 /// <summary>
 /// Override the node
 /// </summary>
 /// <param name="node"></param>
 protected virtual void ReadNode(WBWebArgs args)
 {
 }