• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# TidyNet.Node类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中TidyNet.Node的典型用法代码示例。如果您正苦于以下问题:C# Node类的具体用法?C# Node怎么用?C# Node使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



Node类属于TidyNet命名空间,在下文中一共展示了Node类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: Check

        public virtual void Check(Lexer lexer, Node node)
        {
            AttVal attval;
            Attribute attribute;
            bool hasAlt = false;
            bool hasHref = false;

            node.CheckUniqueAttributes(lexer);

            for (attval = node.Attributes; attval != null; attval = attval.Next)
            {
                attribute = attval.CheckAttribute(lexer, node);

                if (attribute == AttributeTable.AttrAlt)
                {
                    hasAlt = true;
                }
                else if (attribute == AttributeTable.AttrHref)
                {
                    hasHref = true;
                }
            }

            if (!hasAlt)
            {
                lexer.badAccess |= Report.MISSING_LINK_ALT;
                Report.AttrError(lexer, node, "alt", Report.MISSING_ATTRIBUTE);
            }
            if (!hasHref)
            {
                Report.AttrError(lexer, node, "href", Report.MISSING_ATTRIBUTE);
            }
        }
开发者ID:bgarrels,项目名称:betterpoeditor,代码行数:33,代码来源:AreaCheckTableCheckAttribs.cs


示例2: Check

        public virtual void Check(Lexer lexer, Node node)
        {
            node.CheckUniqueAttributes(lexer);

            AttVal lang = node.GetAttrByName("language");
            AttVal type = node.GetAttrByName("type");
            if (type == null)
            {
                Report.AttrError(lexer, node, "type", Report.MISSING_ATTRIBUTE);

                /* check for javascript */
                if (lang != null)
                {
                    string str = lang.Val;
                    if (str.Length > 10)
                    {
                        str = str.Substring(0, 10);
                    }

                    if ((String.Compare(str, "javascript") == 0) || (String.Compare(str, "jscript") == 0))
                    {
                        node.AddAttribute("type", "text/javascript");
                    }
                }
                else
                {
                    node.AddAttribute("type", "text/javascript");
                }
            }
        }
开发者ID:bgarrels,项目名称:betterpoeditor,代码行数:30,代码来源:ScriptCheckAttribs.cs


示例3: Check

        public virtual void Check(Lexer lexer, Node node)
        {
            AttVal attval;
            string val = null;

            node.CheckUniqueAttributes(lexer);

            for (attval = node.Attributes; attval != null; attval = attval.Next)
            {
                if (String.Compare(attval.Attribute, "align") == 0)
                {
                    val = attval.Val;
                    break;
                }
            }

            if (val != null)
            {
                if (String.Compare(val, "left") == 0 || String.Compare(val, "right") == 0)
                {
                    lexer.versions &= HtmlVersion.Html40Loose | HtmlVersion.Frames;
                }
                else if (String.Compare(val, "top") == 0 || String.Compare(val, "bottom") == 0)
                {
                    lexer.versions &= HtmlVersion.From32;
                }
                else
                {
                    Report.AttrError(lexer, node, val, Report.BAD_ATTRIBUTE_VALUE);
                }
            }
        }
开发者ID:AlfieJ,项目名称:TidyNet,代码行数:32,代码来源:CaptionCheckTableCheckAttribs.cs


示例4: PreTraverse

        protected internal virtual void PreTraverse(Node node)
        {
            if (node == null)
            {
                return;
            }

            if (node.Type == Node.StartTag || node.Type == Node.StartEndTag)
            {
                if (_currIndex <= _maxIndex && (_tagName.Equals("*") || _tagName.Equals(node.Element)))
                {
                    _currIndex += 1;
                    _currNode = node;
                }
            }
            if (_currIndex > _maxIndex)
            {
                return;
            }

            node = node.Content;
            while (node != null)
            {
                PreTraverse(node);
                node = node.Next;
            }
        }
开发者ID:bgarrels,项目名称:betterpoeditor,代码行数:27,代码来源:DomNodeListByTagNameImpl.cs


示例5: Check

 public virtual void Check(Lexer lexer, Node node)
 {
     if (node.GetAttrByName("src") != null)
     {
         Report.AttrError(lexer, node, "src", Report.PROPRIETARY_ATTR_VALUE);
     }
 }
开发者ID:AlfieJ,项目名称:TidyNet,代码行数:7,代码来源:HrCheckTableCheckAttribs.cs


示例6: Check

        public virtual void Check(Lexer lexer, Node node, AttVal attval)
        {
            string val = attval.Val;

            if (val == null)
            {
                Report.AttrError(lexer, node, attval.Attribute, Report.MISSING_ATTR_VALUE);
            }
            else if (String.Compare(val, "top") == 0 || String.Compare(val, "middle") == 0 || String.Compare(val, "bottom") == 0 || String.Compare(val, "baseline") == 0)
            {
                /* all is fine */
            }
            else if (String.Compare(val, "left") == 0 || String.Compare(val, "right") == 0)
            {
                if (!(node.Tag != null && ((node.Tag.Model & ContentModel.Img) != 0)))
                {
                    Report.AttrError(lexer, node, val, Report.BAD_ATTRIBUTE_VALUE);
                }
            }
            else if (String.Compare(val, "texttop") == 0 || String.Compare(val, "absmiddle") == 0 || String.Compare(val, "absbottom") == 0 || String.Compare(val, "textbottom") == 0)
            {
                lexer.versions &= HtmlVersion.Proprietary;
                Report.AttrError(lexer, node, val, Report.PROPRIETARY_ATTR_VALUE);
            }
            else
            {
                Report.AttrError(lexer, node, val, Report.BAD_ATTRIBUTE_VALUE);
            }
        }
开发者ID:AlfieJ,项目名称:TidyNet,代码行数:29,代码来源:ValignAttrCheck.cs


示例7: Check

 public virtual void Check(Lexer lexer, Node node, AttVal attval)
 {
     if (attval.Val == null)
     {
         Report.AttrError(lexer, node, attval.Attribute, Report.MISSING_ATTR_VALUE);
     }
     else if (lexer.Options.FixBackslash)
     {
         attval.Val = attval.Val.Replace('\\', '/');
     }
 }
开发者ID:AlfieJ,项目名称:TidyNet,代码行数:11,代码来源:UrlAttrCheck.cs


示例8: Check

        public virtual void Check(Lexer lexer, Node node)
        {
            AttVal type = node.GetAttrByName("type");

            node.CheckUniqueAttributes(lexer);

            if (type == null)
            {
                Report.AttrError(lexer, node, "type", Report.MISSING_ATTRIBUTE);

                node.AddAttribute("type", "text/css");
            }
        }
开发者ID:AlfieJ,项目名称:TidyNet,代码行数:13,代码来源:StyleCheckTableCheckAttribs.cs


示例9: Check

        public virtual void Check(Lexer lexer, Node node)
        {
            node.CheckUniqueAttributes(lexer);

            /*
                HTML4 strict doesn't allow mixed content for
                elements with %block; as their content model
                */
            if (node.GetAttrByName("width") != null || node.GetAttrByName("height") != null)
            {
                lexer.versions &= ~ HtmlVersion.Html40Strict;
            }
        }
开发者ID:bgarrels,项目名称:betterpoeditor,代码行数:13,代码来源:TableCellCheckTableCheckAttribs.cs


示例10: Check

        public virtual void Check(Lexer lexer, Node node)
        {
            AttVal attval;

            node.CheckUniqueAttributes(lexer);

            for (attval = node.Attributes; attval != null; attval = attval.Next)
            {
                Attribute attribute = attval.CheckAttribute(lexer, node);
                if (attribute == AttributeTable.AttrXmlns)
                {
                    lexer.isvoyager = true;
                }
            }
        }
开发者ID:bgarrels,项目名称:betterpoeditor,代码行数:15,代码来源:HtmlCheckAttribs.cs


示例11: Check

        public virtual void Check(Lexer lexer, Node node)
        {
            AttVal rel = node.GetAttrByName("rel");

            node.CheckUniqueAttributes(lexer);

            if (rel != null && rel.Val != null && rel.Val.Equals("stylesheet"))
            {
                AttVal type = node.GetAttrByName("type");

                if (type == null)
                {
                    Report.AttrError(lexer, node, "type", Report.MISSING_ATTRIBUTE);

                    node.AddAttribute("type", "text/css");
                }
            }
        }
开发者ID:bgarrels,项目名称:betterpoeditor,代码行数:18,代码来源:LinkCheckTableCheckAttribs.cs


示例12: Check

        public virtual void Check(Lexer lexer, Node node, AttVal attval)
        {
            string val;

            /* IMG, OBJECT, APPLET and EMBED use align for vertical position */
            if (node.Tag != null && ((node.Tag.Model & ContentModel.Img) != 0))
            {
                TidyNet.AttrCheckImpl.CheckValign.Check(lexer, node, attval);
                return;
            }

            val = attval.Val;

            if (val == null)
            {
                Report.AttrError(lexer, node, attval.Attribute, Report.MISSING_ATTR_VALUE);
            }
            else if (!(String.Compare(val, "left") == 0 || String.Compare(val, "center") == 0 || String.Compare(val, "right") == 0 || String.Compare(val, "justify") == 0))
            {
                Report.AttrError(lexer, node, attval.Val, Report.BAD_ATTRIBUTE_VALUE);
            }
        }
开发者ID:bgarrels,项目名称:betterpoeditor,代码行数:22,代码来源:AlignAttrCheck.cs


示例13: Check

        public virtual void Check(Lexer lexer, Node node)
        {
            AttVal attval;
            Attribute attribute;
            bool hasSummary = false;

            node.CheckUniqueAttributes(lexer);

            for (attval = node.Attributes; attval != null; attval = attval.Next)
            {
                attribute = attval.CheckAttribute(lexer, node);

                if (attribute == AttributeTable.AttrSummary)
                {
                    hasSummary = true;
                }
            }

            /* suppress warning for missing summary for HTML 2.0 and HTML 3.2 */
            if (!hasSummary && lexer.doctype != HtmlVersion.Html20 && lexer.doctype != HtmlVersion.Html32)
            {
                lexer.badAccess |= Report.MISSING_SUMMARY;
                Report.AttrError(lexer, node, "summary", Report.MISSING_ATTRIBUTE);
            }

            /* convert <table border> to <table border="1"> */
            if (lexer.Options.XmlOut)
            {
                attval = node.GetAttrByName("border");
                if (attval != null)
                {
                    if (attval.Val == null)
                    {
                        attval.Val = "1";
                    }
                }
            }
        }
开发者ID:bgarrels,项目名称:betterpoeditor,代码行数:38,代码来源:TableCheckAttribs.cs


示例14: FindParser

        public IParser FindParser(Node node)
        {
            Dict np;

            if (node.Element != null)
            {
                np = Lookup(node.Element);
                if (np != null)
                {
                    return np.Parser;
                }
            }

            return null;
        }
开发者ID:bgarrels,项目名称:betterpoeditor,代码行数:15,代码来源:TagTable.cs


示例15: DomNodeImpl

 protected internal DomNodeImpl(Node adaptee)
 {
     _adaptee = adaptee;
 }
开发者ID:bgarrels,项目名称:betterpoeditor,代码行数:4,代码来源:DomNodeImpl.cs


示例16: FindTag

        /* public method for finding tag by name */
        public bool FindTag(Node node)
        {
            Dict np;

            if (Options != null && Options.XmlTags)
            {
                node.Tag = XmlTags;
                return true;
            }

            if (node.Element != null)
            {
                np = Lookup(node.Element);
                if (np != null)
                {
                    node.Tag = np;
                    return true;
                }
            }

            return false;
        }
开发者ID:bgarrels,项目名称:betterpoeditor,代码行数:23,代码来源:TagTable.cs


示例17: Error

        public static void Error(Lexer lexer, Node element, Node node, short code)
        {
            /* keep quiet after 6 errors */
            if (lexer.messages.Errors > 6)
            {
                return;
            }

            if (code == SUSPECTED_MISSING_QUOTE)
            {
                AddMessage(lexer, GetMessage("suspected_missing_quote"), MessageLevel.Error);
            }
            else if (code == DUPLICATE_FRAMESET)
            {
                AddMessage(lexer, GetMessage("duplicate_frameset"), MessageLevel.Error);
            }
            else if (code == UNKNOWN_ELEMENT)
            {
                AddMessage(lexer, String.Format(GetMessage("unknown_element"), Tag(lexer, node)), MessageLevel.Error);
            }
            else if (code == UNEXPECTED_ENDTAG)
            {
                string message;
                if (element != null)
                {
                    message = String.Format(GetMessage("unexpected_endtag_suffix"), element.Element);
                }
                else
                {
                    message = String.Format(GetMessage("unexpected_endtag"), node.Element, element.Element);
                }

                AddMessage(lexer, message, MessageLevel.Error);
            }
        }
开发者ID:bgarrels,项目名称:betterpoeditor,代码行数:35,代码来源:Report.cs


示例18: CheckUniqueAttribute

        /*
        the same attribute name can't be used
        more than once in each element
        */
        public virtual void CheckUniqueAttribute(Lexer lexer, Node node)
        {
            AttVal attr;
            int count = 0;

            for (attr = Next; attr != null; attr = attr.Next)
            {
                if (Attribute != null && attr.Attribute != null && attr.Asp == null && attr.Php == null && String.Compare(Attribute, attr.Attribute) == 0)
                {
                    ++count;
                }
            }

            if (count > 0)
            {
                Report.AttrError(lexer, node, Attribute, Report.REPEATED_ATTRIBUTE);
            }
        }
开发者ID:bgarrels,项目名称:betterpoeditor,代码行数:22,代码来源:AttVal.cs


示例19: CheckAttribute

        /* ignore unknown attributes for proprietary elements */
        public virtual Attribute CheckAttribute(Lexer lexer, Node node)
        {
            TagTable tt = lexer.Options.tt;

            if (Asp == null && Php == null)
            {
                CheckUniqueAttribute(lexer, node);
            }

            Attribute attribute = Dict;
            if (attribute != null)
            {
                /* title is vers 2.0 for A and LINK otherwise vers 4.0 */
                if (attribute == AttributeTable.AttrTitle && (node.Tag == tt.TagA || node.Tag == tt.TagLink))
                {
                    lexer.versions &= HtmlVersion.All;
                }
                else if ((attribute.Versions & HtmlVersion.Xml) != 0)
                {
                    if (!(lexer.Options.XmlTags || lexer.Options.XmlOut))
                    {
                        Report.AttrError(lexer, node, Attribute, Report.XML_ATTRIBUTE_VALUE);
                    }
                }
                else
                {
                    lexer.versions &= attribute.Versions;
                }

                if (attribute.AttrCheck != null)
                {
                    attribute.AttrCheck.Check(lexer, node, this);
                }
            }
            else if (!lexer.Options.XmlTags && !(node.Tag == null) && _asp == null && !(node.Tag != null && ((node.Tag.Versions & HtmlVersion.Proprietary) != HtmlVersion.Unknown)))
            {
                Report.AttrError(lexer, node, Attribute, Report.UNKNOWN_ATTRIBUTE);
            }

            return attribute;
        }
开发者ID:bgarrels,项目名称:betterpoeditor,代码行数:42,代码来源:AttVal.cs


示例20: BQ2Div

        /*
        Replace implicit blockquote by div with an indent
        taking care to reduce nested blockquotes to a single
        div with the indent set to match the nesting depth
        */
        public virtual void BQ2Div(Node node)
        {
            int indent;
            string indent_buf;

            while (node != null)
            {
                if (node.Tag == _tt.TagBlockquote && node.Isimplicit)
                {
                    indent = 1;

                    while (node.HasOneChild() && node.Content.Tag == _tt.TagBlockquote && node.Isimplicit)
                    {
                        ++indent;
                        StripOnlyChild(node);
                    }

                    if (node.Content != null)
                    {
                        BQ2Div(node.Content);
                    }

                    indent_buf = "margin-left: " + (2 * indent).ToString() + "em";

                    node.Element = _tt.TagDiv.Name;
                    node.Tag = _tt.TagDiv;
                    node.AddAttribute("style", indent_buf);
                }
                else if (node.Content != null)
                {
                    BQ2Div(node.Content);
                }

                node = node.Next;
            }
        }
开发者ID:AlfieJ,项目名称:TidyNet,代码行数:41,代码来源:Clean.cs



注:本文中的TidyNet.Node类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Models.FormContext类代码示例发布时间:2022-05-26
下一篇:
C# TidyNet.Lexer类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap