Ejemplo n.º 1
0
 public ufMeSpider()
 {
     m_oHCardDescriber = m_ufBuilder.BuildhCard();
     m_oHCardXfnDescriber  = m_ufBuilder.BuildhCardXFN();
     m_oXfnDescriber = m_ufBuilder.BuildXfn();
     m_oMeDescriber = m_ufBuilder.BuildMe();
 }
Ejemplo n.º 2
0
 public string Convert(ufDateNode node, 
     ufFormatDescriber ufFormat,
     bool multiplesFormats,
     Urls urls)
 {
     m_oUrls = urls;
     return Convert(node, ufFormat, multiplesFormats);
 }
Ejemplo n.º 3
0
 public string Convert(ufDateNode node, 
     ufFormatDescriber ufFormat,
     bool multiplesFormats,
     string callBack)
 {
     m_sCallBack = callBack;
     m_sCallBack = m_sCallBack.Replace("(", "").Replace(")", "").Trim();
     return Convert(node, ufFormat, multiplesFormats);
 }
Ejemplo n.º 4
0
 public string Convert(ufDateNode node, 
     ufFormatDescriber ufFormat,
     bool multiplesFormats,
     string callBack,
     Urls urls,
     Errors errors)
 {
     m_oErrors = errors;
     m_sCallBack = callBack;
     m_sCallBack = m_sCallBack.Replace("(", "").Replace(")", "").Trim();
     m_oUrls = urls;
     return Convert(node, ufFormat, multiplesFormats);
 }
Ejemplo n.º 5
0
 // Parse uf
 private void ParseUf(HtmlDocument htmlDoc, string url, ufFormatDescriber format )
 {
     ufParse ufparse = new ufParse();
     ufparse.Load(htmlDoc, url, format);
     this.Data = ufparse.Data;
 }
Ejemplo n.º 6
0
        private void LoadPage(string url, ufFormatDescriber format)
        {
            if (url != string.Empty)
            {
                Url urlReport = new Url();
                urlReport.Address = url;
                //m_oFormatDescriber = format;

                UrlModule urlModule = new UrlModule();
                Uri uri = new Uri(url);
                urlModule.DocumentContentType = UrlModule.ContentType.Html;
                urlModule.DocumentRequestType = UrlModule.RequestType.Get;
                urlModule.Load(uri);

                urlReport.Status = urlModule.StatusCode;
                DateTime started = DateTime.Now;
                m_AllParsedUrls.Add(urlReport);

                if (urlModule.StatusCode == 200 && urlModule.Html != null)
                    ParseUf(urlModule.Html, uri.ToString(), format);

                //----------------------
                Urls newUrls = new Urls();
                m_oMe.Nodes.Add(m_oData);

                foreach(ufDateNode node in m_oData.Nodes)
                {
                    if (node.Nodes["link"] != null)
                    {
                        string link = node.Nodes["link"].Value;
                        if (ShouldParseUrl(link))
                            newUrls.Add(new Url(link));
                    }
                }
                foreach (Url newUrl in newUrls)
                {
                    LoadPage(newUrl.Address, m_oMeDescriber);
                }
                //----------------------

                DateTime ended = DateTime.Now;
                urlReport.LoadTime = ended.Subtract(started);
            }
        }
Ejemplo n.º 7
0
        public string Convert(ufDateNode node, ufFormatDescriber ufFormat, bool multiplesFormats)
        {
            m_bMultiplesFormats = multiplesFormats;
            foreach (ufDateNode childNode in node.Nodes)
            {
                if (childNode.Name == ufFormat.BaseElement.Name)
                {
                    ufDateNode xChild = xTree.Nodes.Append(childNode.Name, childNode.Value, childNode.SourceUrl, childNode.RepresentativeNode);
                    if (childNode.Nodes.Count > 0)
                        AddChildNodes(xChild, childNode, ufFormat.BaseElement);

                }
            }

            string output = "// ufXtract \n";
            if( m_sCallBack != string.Empty)
                output += m_sCallBack + "( ";

            output += "{";

            foreach (ufDateNode childNode in xTree.Nodes)
                output += BuildDataString(childNode, true, false);

            if (xTree.Nodes.Count > 0)
                output = output.Substring(0, output.Length - 2);

            output += AddErrors();
            output += AddReporting( node );

            // End whole block
            output += "}";

            if (m_sCallBack != string.Empty)
                output += " )";

            return  output;
        }