コード例 #1
0
        private void CheckImageAlt(CHtmlDocument doc, CHtmlNodeCollection nodes)
        {
            foreach (CHtmlNode node in nodes)
            {
                if (node is CHtmlElement)
                {
                    CHtmlElement element = node as CHtmlElement;
                    if ("img".Equals(element.Name.ToLower(), StringComparison.OrdinalIgnoreCase))
                    {
                        if (element.Attributes.HasAttribute("alt") == false)
                        {
                            // 리포터 모듈 작성 할것
                            AddReportItem(doc.HRef, element.HTML, "["+1001+"] img태그에 Alt가 없습니다.");
                        }

                        if(element.Attributes.HasAttribute("height") == false)
                        {
                            AddReportItem(doc.HRef, element.HTML, "["+1002+"] img태그에 Height속성이 없습니다.");
                        }

                        if(element.Attributes.HasAttribute("width") == false)
                        {
                            AddReportItem(doc.HRef, element.HTML, "[" + 1003 + "] img태그에 Width속성이 없습니다.");
                        }
                    }

                    if (element.Nodes.Count > 0)
                        CheckImageAlt(doc, element.Nodes);
                }
            }
        }
コード例 #2
0
        public void Start(CHtmlDocument doc)
        {
            string[] files = Directory.GetFiles(@"c:\temp\log\");
            foreach(string file in files)
            {
                File.Delete(file);
            }

            foreach(IChecker checker in checkerList)
            {
                checker.Perform(doc);
            }
        }
コード例 #3
0
        /////////////////////////////////////////////////////////////////////////////
        /// <summary>
        ///
        /// </summary>
        /// <returns></returns>
        public object Clone()
        {
            CHtmlDocument newDoc = new CHtmlDocument();

            newDoc.m_charset = m_charset;

            int count = m_nodeList.Count;

            newDoc.m_nodeList.Capacity = count;
            for (int index = 0; index < count; ++index)
            {
                newDoc.m_nodeList.Add((CHtmlNode)m_nodeList[index].Clone());
            }

            return(newDoc);
        }
コード例 #4
0
        private void StartScan()
        {
            string pageData = "";
            HttpStatusCode status = AppUtil.GetPageData(m_startUrl, false, out pageData);
            if (status == HttpStatusCode.OK)
            {
                frmCenterMain.lstList.Items.Add(m_startUrl);

                CHtmlDocument doc = new CHtmlDocument(pageData);
                doc.HRef = m_startUrl;
                RoleChecker.getInstance().Start(doc);
            }

            PrintReport();
        }
コード例 #5
0
        /////////////////////////////////////////////////////////////////////////////
        /// <summary>
        /// 
        /// </summary>
        /// <returns></returns>
        public object Clone()
        {
            CHtmlDocument newDoc = new CHtmlDocument();
            newDoc.m_charset = m_charset;

            int count = m_nodeList.Count;
            newDoc.m_nodeList.Capacity = count;
            for(int index = 0; index < count; ++index)
                newDoc.m_nodeList.Add((CHtmlNode)m_nodeList[index].Clone());

               return newDoc;
        }
コード例 #6
0
 public override bool Perform(CHtmlDocument doc)
 {
     CheckImageAlt(doc, doc.Nodes);
     return true;
 }
コード例 #7
0
 public abstract bool Perform(CHtmlDocument doc);