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

C# HtmlTreeMode类代码示例

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

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



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

示例1: HtmlDomBuilder

 /// <summary>
 /// Creates a new instance of the HTML parser with the specified
 /// document based on the given source manager.
 /// </summary>
 /// <param name="document">
 /// The document instance to be constructed.
 /// </param>
 internal HtmlDomBuilder(HtmlDocument document)
 {
     _tokenizer = new HtmlTokenizer(document.Source, document.Options.Events);
     _document = document;
     _openElements = new List<Element>();
     _templateModes = new Stack<HtmlTreeMode>();
     _formattingElements = new List<Element>();
     _frameset = true;
     _currentMode = HtmlTreeMode.Initial;
 }
开发者ID:JBTech,项目名称:AngleSharp,代码行数:17,代码来源:HtmlDomBuilder.cs


示例2: HtmlDomBuilder

 /// <summary>
 /// Creates a new instance of the HTML parser with the specified
 /// document based on the given source manager.
 /// </summary>
 /// <param name="document">
 /// The document instance to be constructed.
 /// </param>
 internal HtmlDomBuilder(HtmlDocument document)
 {
     var resolver = document.Options.GetService<IEntityService>() ?? HtmlEntityService.Resolver;
     _tokenizer = new HtmlTokenizer(document.Source, document.Options.Events, resolver);
     _document = document;
     _openElements = new List<Element>();
     _templateModes = new Stack<HtmlTreeMode>();
     _formattingElements = new List<Element>();
     _frameset = true;
     _currentMode = HtmlTreeMode.Initial;
 }
开发者ID:fjwuyongzhi,项目名称:AngleSharp,代码行数:18,代码来源:HtmlDomBuilder.cs


示例3: HtmlDomBuilder

 /// <summary>
 /// Creates a new instance of the HTML parser with the specified
 /// document based on the given source manager.
 /// </summary>
 /// <param name="document">
 /// The document instance to be constructed.
 /// </param>
 public HtmlDomBuilder(HtmlDocument document)
 {
     var options = document.Options;
     var context = document.Context;
     var resolver = options.GetProvider<IEntityProvider>() ?? HtmlEntityService.Resolver;
     _tokenizer = new HtmlTokenizer(document.Source, resolver);
     _tokenizer.Error += (_, error) => context.Fire(error);
     _document = document;
     _openElements = new List<Element>();
     _templateModes = new Stack<HtmlTreeMode>();
     _formattingElements = new List<Element>();
     _frameset = true;
     _currentMode = HtmlTreeMode.Initial;
     _htmlFactory = options.GetFactory<IElementFactory<HtmlElement>>();
     _mathFactory = options.GetFactory<IElementFactory<MathElement>>();
     _svgFactory = options.GetFactory<IElementFactory<SvgElement>>();
 }
开发者ID:Wojdav,项目名称:AngleSharp,代码行数:24,代码来源:HtmlDomBuilder.cs


示例4: InBodyEndTagBody

 /// <summary>
 /// Act as if an body end tag has been found in the InBody state.
 /// </summary>
 /// <param name="token">The actual tag token.</param>
 /// <returns>True if the token was not ignored, otherwise false.</returns>
 Boolean InBodyEndTagBody(HtmlToken token)
 {
     if (IsInScope(TagNames.Body))
     {
         CheckBodyOnClosing(token);
         _currentMode = HtmlTreeMode.AfterBody;
         return true;
     }
     else
     {
         RaiseErrorOccurred(HtmlParseError.BodyNotInScope, token);
         return false;
     }
 }
开发者ID:fjwuyongzhi,项目名称:AngleSharp,代码行数:19,代码来源:HtmlDomBuilder.cs


示例5: RCDataAlgorithm

 /// <summary>
 /// Follows the generic RCData parsing algorithm.
 /// </summary>
 /// <param name="tag">The given tag token.</param>
 void RCDataAlgorithm(HtmlTagToken tag)
 {
     AddElement(tag);
     _previousMode = _currentMode;
     _currentMode = HtmlTreeMode.Text;
     _tokenizer.State = HtmlParseMode.RCData;
 }
开发者ID:fjwuyongzhi,项目名称:AngleSharp,代码行数:11,代码来源:HtmlDomBuilder.cs


示例6: BeforeHead

        /// <summary>
        /// See 8.2.5.4.3 The "before head" insertion mode.
        /// </summary>
        /// <param name="token">The passed token.</param>
        void BeforeHead(HtmlToken token)
        {
            switch (token.Type)
            {
                case HtmlTokenType.Character:
                {
                    token.TrimStart();

                    if (token.IsEmpty)
                        return;

                    break;
                }
                case HtmlTokenType.StartTag:
                {
                    var tagName = token.Name;

                    if (tagName.Is(TagNames.Html))
                    {
                        InBody(token);
                        return;
                    }
                    else if (tagName.Is(TagNames.Head))
                    {
                        AddElement(new HtmlHeadElement(_document), token.AsTag());
                        _currentMode = HtmlTreeMode.InHead;
                        return;
                    }

                    break;
                }
                case HtmlTokenType.EndTag:
                {
                    if (TagNames.AllBeforeHead.Contains(token.Name))
                        break;

                    RaiseErrorOccurred(HtmlParseError.TagCannotEndHere, token);
                    return;
                }
                case HtmlTokenType.Comment:
                {
                    CurrentNode.AddComment(token);
                    return;
                }
                case HtmlTokenType.Doctype:
                {
                    RaiseErrorOccurred(HtmlParseError.DoctypeTagInappropriate, token);
                    return;
                }
            }

            BeforeHead(HtmlTagToken.Open(TagNames.Head));
            InHead(token);
        }
开发者ID:fjwuyongzhi,项目名称:AngleSharp,代码行数:58,代码来源:HtmlDomBuilder.cs


示例7: InTable

        /// <summary>
        /// See 8.2.5.4.9 The "in table" insertion mode.
        /// </summary>
        /// <param name="token">The passed token.</param>
        void InTable(HtmlToken token)
        {
            switch (token.Type)
            {
                case HtmlTokenType.Comment:
                {
                    CurrentNode.AddComment(token);
                    return;
                }
                case HtmlTokenType.Doctype:
                {
                    RaiseErrorOccurred(HtmlParseError.DoctypeTagInappropriate, token);
                    return;
                }
                case HtmlTokenType.StartTag:
                {
                    var tagName = token.Name;

                    if (tagName.Is(TagNames.Caption))
                    {
                        ClearStackBackTo(TagNames.Table);
                        _formattingElements.AddScopeMarker();
                        AddElement(new HtmlTableCaptionElement(_document), token.AsTag());
                        _currentMode = HtmlTreeMode.InCaption;
                    }
                    else if (tagName.Is(TagNames.Colgroup))
                    {
                        ClearStackBackTo(TagNames.Table);
                        AddElement(new HtmlTableColgroupElement(_document), token.AsTag());
                        _currentMode = HtmlTreeMode.InColumnGroup;
                    }
                    else if (tagName.Is(TagNames.Col))
                    {
                        InTable(HtmlTagToken.Open(TagNames.Colgroup));
                        InColumnGroup(token);
                    }
                    else if (TagNames.AllTableSections.Contains(tagName))
                    {
                        ClearStackBackTo(TagNames.Table);
                        AddElement(new HtmlTableSectionElement(_document, tagName), token.AsTag());
                        _currentMode = HtmlTreeMode.InTableBody;
                    }
                    else if (TagNames.AllTableCellsRows.Contains(tagName))
                    {
                        InTable(HtmlTagToken.Open(TagNames.Tbody));
                        InTableBody(token);
                    }
                    else if (tagName.Is(TagNames.Table))
                    {
                        RaiseErrorOccurred(HtmlParseError.TableNesting, token);

                        if (InTableEndTagTable(token))
                            Home(token);
                    }
                    else if (tagName.Is(TagNames.Input))
                    {
                        var tag = token.AsTag();

                        if (tag.GetAttribute(AttributeNames.Type).Isi(AttributeNames.Hidden))
                        {
                            RaiseErrorOccurred(HtmlParseError.InputUnexpected, token);
                            AddElement(new HtmlInputElement(_document), tag, true);
                            CloseCurrentNode();
                        }
                        else
                        {
                            RaiseErrorOccurred(HtmlParseError.TokenNotPossible, token);
                            InBodyWithFoster(token);
                        }
                    }
                    else if (tagName.Is(TagNames.Form))
                    {
                        RaiseErrorOccurred(HtmlParseError.FormInappropriate, token);

                        if (_currentFormElement == null)
                        {
                            _currentFormElement = new HtmlFormElement(_document);
                            AddElement(_currentFormElement, token.AsTag());
                            CloseCurrentNode();
                        }
                    }
                    else if (TagNames.AllTableHead.Contains(tagName))
                    {
                        InHead(token);
                    }
                    else
                    {
                        RaiseErrorOccurred(HtmlParseError.IllegalElementInTableDetected, token);
                        InBodyWithFoster(token);
                    }

                    return;
                }
                case HtmlTokenType.EndTag:
                {
                    var tagName = token.Name;
//.........这里部分代码省略.........
开发者ID:fjwuyongzhi,项目名称:AngleSharp,代码行数:101,代码来源:HtmlDomBuilder.cs


示例8: InCellEndTagCell

        /// <summary>
        /// Act as if an td or th end tag has been found in the InCell state.
        /// </summary>
        /// <param name="token">The actual tag token.</param>
        /// <returns>True if the token was not ignored, otherwise false.</returns>
        Boolean InCellEndTagCell(HtmlToken token)
        {
            if (IsInTableScope(TagNames.AllTableCells))
            {
                GenerateImpliedEndTags();

                if (!TagNames.AllTableCells.Contains(CurrentNode.LocalName))
                    RaiseErrorOccurred(HtmlParseError.TagDoesNotMatchCurrentNode, token);

                ClearStackBackTo(TagNames.AllTableCells);
                CloseCurrentNode();
                _formattingElements.ClearFormatting();
                _currentMode = HtmlTreeMode.InRow;
                return true;
            }
            else
            {
                RaiseErrorOccurred(HtmlParseError.TableCellNotInScope, token);
                return false;
            }
        }
开发者ID:fjwuyongzhi,项目名称:AngleSharp,代码行数:26,代码来源:HtmlDomBuilder.cs


示例9: Initial

        /// <summary>
        /// See 8.2.5.4.1 The "initial" insertion mode.
        /// </summary>
        /// <param name="token">The passed token.</param>
        void Initial(HtmlToken token)
        {
            switch (token.Type)
            {
                case HtmlTokenType.Doctype:
                {
                    var doctype = (HtmlDoctypeToken)token;

                    if (!doctype.IsValid)
                        RaiseErrorOccurred(HtmlParseError.DoctypeInvalid, token);

                    _document.AddNode(new DocumentType(_document, doctype.Name ?? String.Empty)
                    {
                        SystemIdentifier = doctype.SystemIdentifier,
                        PublicIdentifier = doctype.PublicIdentifier
                    });

                    if (doctype.IsFullQuirks)
                        _document.QuirksMode = QuirksMode.On;
                    else if (doctype.IsLimitedQuirks)
                        _document.QuirksMode = QuirksMode.Limited;

                    _currentMode = HtmlTreeMode.BeforeHtml;
                    return;
                }
                case HtmlTokenType.Character:
                {
                    token.TrimStart();

                    if (token.IsEmpty)
                        return;

                    break;
                }
                case HtmlTokenType.Comment:
                {
                    _document.AddComment(token);
                    return;
                }
            }

            if (_options.IsEmbedded == false)
            {
                RaiseErrorOccurred(HtmlParseError.DoctypeMissing, token);
                _document.QuirksMode = QuirksMode.On;
            }

            _currentMode = HtmlTreeMode.BeforeHtml;
            BeforeHtml(token);
        }
开发者ID:fjwuyongzhi,项目名称:AngleSharp,代码行数:54,代码来源:HtmlDomBuilder.cs


示例10: AfterFrameset

        /// <summary>
        /// See 8.2.5.4.21 The "after frameset" insertion mode.
        /// </summary>
        /// <param name="token">The passed token.</param>
        void AfterFrameset(HtmlToken token)
        {
            switch (token.Type)
            {
                case HtmlTokenType.Character:
                {
                    var str = token.TrimStart();
                    AddCharacters(str);

                    if (token.IsEmpty)
                        return;

                    break;
                }
                case HtmlTokenType.Comment:
                {
                    CurrentNode.AddComment(token);
                    return;
                }
                case HtmlTokenType.Doctype:
                {
                    RaiseErrorOccurred(HtmlParseError.DoctypeTagInappropriate, token);
                    return;
                }
                case HtmlTokenType.StartTag:
                {
                    var tagName = token.Name;

                    if (tagName.Is(TagNames.Html))
                        InBody(token);
                    else if (tagName.Is(TagNames.NoFrames))
                        InHead(token);
                    else
                        break;

                    return;
                }
                case HtmlTokenType.EndTag:
                {
                    if (!token.Name.Is(TagNames.Html))
                        break;

                    _currentMode = HtmlTreeMode.AfterAfterFrameset;
                    return;
                }
                case HtmlTokenType.EndOfFile:
                {
                    End();
                    return;
                }
            }

            RaiseErrorOccurred(HtmlParseError.TokenNotPossible, token);
        }
开发者ID:fjwuyongzhi,项目名称:AngleSharp,代码行数:58,代码来源:HtmlDomBuilder.cs


示例11: Reset

        /// <summary>
        /// Resets the current insertation mode to the rules according to the
        /// algorithm specified in 8.2.3.1 The insertion mode.
        /// http://www.w3.org/html/wg/drafts/html/master/syntax.html#the-insertion-mode
        /// </summary>
        void Reset(Element context = null)
        {
            var last = false;
            var node = default(Element);

            for (var i = _openElements.Count - 1; i >= 0; i--)
            {
                node = _openElements[i];

                if (i == 0)
                {
                    last = true;
                    node = context ?? node;
                }

                var tagName = node.LocalName;

                if (tagName.Is(TagNames.Select))
                    _currentMode = HtmlTreeMode.InSelect;
                else if (TagNames.AllTableCells.Contains(tagName))
                    _currentMode = last ? HtmlTreeMode.InBody : HtmlTreeMode.InCell;
                else if (tagName.Is(TagNames.Tr))
                    _currentMode = HtmlTreeMode.InRow;
                else if (TagNames.AllTableSections.Contains(tagName))
                    _currentMode = HtmlTreeMode.InTableBody;
                else if (tagName.Is(TagNames.Body))
                    _currentMode = HtmlTreeMode.InBody;
                else if (tagName.Is(TagNames.Table))
                    _currentMode = HtmlTreeMode.InTable;
                else if (tagName.Is(TagNames.Caption))
                    _currentMode = HtmlTreeMode.InCaption;
                else if (tagName.Is(TagNames.Colgroup))
                    _currentMode = HtmlTreeMode.InColumnGroup;
                else if (tagName.Is(TagNames.Template))
                    _currentMode = _templateModes.Peek();
                else if (tagName.Is(TagNames.Html))
                    _currentMode = HtmlTreeMode.BeforeHead;
                else if (tagName.Is(TagNames.Head))
                    _currentMode = last ? HtmlTreeMode.InBody : HtmlTreeMode.InHead;
                else if (tagName.Is(TagNames.Frameset))
                    _currentMode = HtmlTreeMode.InFrameset;
                else if (last)
                    _currentMode = HtmlTreeMode.InBody;
                else
                    continue;

                break;
            }
        }
开发者ID:fjwuyongzhi,项目名称:AngleSharp,代码行数:54,代码来源:HtmlDomBuilder.cs


示例12: Restart

 /// <summary>
 /// Restarts the parser by resetting the internal state.
 /// </summary>
 void Restart()
 {
     _currentMode = HtmlTreeMode.Initial;
     _tokenizer.State = HtmlParseMode.PCData;
     _document.ReplaceAll(null, true);
     _frameset = true;
     _openElements.Clear();
     _formattingElements.Clear();
     _templateModes.Clear();
 }
开发者ID:fjwuyongzhi,项目名称:AngleSharp,代码行数:13,代码来源:HtmlDomBuilder.cs


示例13: InFrameset

        /// <summary>
        /// See 8.2.5.4.20 The "in frameset" insertion mode.
        /// </summary>
        /// <param name="token">The passed token.</param>
        void InFrameset(HtmlToken token)
        {
            switch (token.Type)
            {
                case HtmlTokenType.Character:
                {
                    var str = token.TrimStart();
                    AddCharacters(str);

                    if (token.IsEmpty)
                        return;

                    break;
                }
                case HtmlTokenType.Comment:
                {
                    CurrentNode.AddComment(token);
                    return;
                }
                case HtmlTokenType.Doctype:
                {
                    RaiseErrorOccurred(HtmlParseError.DoctypeTagInappropriate, token);
                    return;
                }
                case HtmlTokenType.StartTag:
                {
                    var tagName = token.Name;

                    if (tagName.Is(TagNames.Html))
                        InBody(token);
                    else if (tagName.Is(TagNames.Frameset))
                        AddElement(new HtmlFrameSetElement(_document), token.AsTag());
                    else if (tagName.Is(TagNames.Frame))
                    {
                        AddElement(new HtmlFrameElement(_document), token.AsTag(), true);
                        CloseCurrentNode();
                    }
                    else if (tagName.Is(TagNames.NoFrames))
                        InHead(token);
                    else
                        break;

                    return;
                }
                case HtmlTokenType.EndTag:
                {
                    if (!token.Name.Is(TagNames.Frameset))
                        break;

                    if (CurrentNode != _openElements[0])
                    {
                        CloseCurrentNode();

                        if (!IsFragmentCase && !CurrentNode.LocalName.Is(TagNames.Frameset))
                            _currentMode = HtmlTreeMode.AfterFrameset;
                    }
                    else
                        RaiseErrorOccurred(HtmlParseError.CurrentNodeIsRoot, token);

                    return;
                }
                case HtmlTokenType.EndOfFile:
                {
                    if (CurrentNode != _document.DocumentElement)
                        RaiseErrorOccurred(HtmlParseError.CurrentNodeIsNotRoot, token);

                    End();
                    return;
                }
            }

            RaiseErrorOccurred(HtmlParseError.TokenNotPossible, token);
        }
开发者ID:fjwuyongzhi,项目名称:AngleSharp,代码行数:77,代码来源:HtmlDomBuilder.cs


示例14: AfterBody

        /// <summary>
        /// See 8.2.5.4.19 The "after body" insertion mode.
        /// </summary>
        /// <param name="token">The passed token.</param>
        void AfterBody(HtmlToken token)
        {
            switch (token.Type)
            {
                case HtmlTokenType.Character:
                {
                    var str = token.TrimStart();
                    ReconstructFormatting();
                    AddCharacters(str);

                    if (token.IsEmpty)
                        return;
                    
                    break;
                }
                case HtmlTokenType.Comment:
                {
                    _openElements[0].AddComment(token);
                    return;
                }
                case HtmlTokenType.Doctype:
                {
                    RaiseErrorOccurred(HtmlParseError.DoctypeTagInappropriate, token);
                    return;
                }
                case HtmlTokenType.StartTag:
                {
                    if (token.Name.Is(TagNames.Html))
                    {
                        InBody(token);
                        return;
                    }

                    break;
                }
                case HtmlTokenType.EndTag:
                {
                    if (token.Name.Is(TagNames.Html))
                    {
                        if (IsFragmentCase)
                            RaiseErrorOccurred(HtmlParseError.TagInvalidInFragmentMode, token);
                        else
                            _currentMode = HtmlTreeMode.AfterAfterBody;

                        return;
                    }

                    break;
                }
                case HtmlTokenType.EndOfFile:
                {
                    End();
                    return;
                }
            }

            RaiseErrorOccurred(HtmlParseError.TokenNotPossible, token);
            _currentMode = HtmlTreeMode.InBody;
            InBody(token);
        }
开发者ID:fjwuyongzhi,项目名称:AngleSharp,代码行数:64,代码来源:HtmlDomBuilder.cs


示例15: InRow

        /// <summary>
        /// See 8.2.5.4.14 The "in row" insertion mode.
        /// </summary>
        /// <param name="token">The passed token.</param>
        void InRow(HtmlToken token)
        {
            switch (token.Type)
            {
                case HtmlTokenType.StartTag:
                {
                    var tagName = token.Name;

                    if (TagNames.AllTableCells.Contains(tagName))
                    {
                        ClearStackBackTo(TagNames.Tr);
                        AddElement(token.AsTag());
                        _currentMode = HtmlTreeMode.InCell;
                        _formattingElements.AddScopeMarker();
                    }
                    else if (tagName.Is(TagNames.Tr) || TagNames.AllTableGeneral.Contains(tagName))
                    {
                        if (InRowEndTagTablerow(token))
                            InTableBody(token);
                    }
                    else
                    {
                        break;
                    }

                    return;
                }
                case HtmlTokenType.EndTag:
                {
                    var tagName = token.Name;

                    if (tagName.Is(TagNames.Tr))
                    {
                        InRowEndTagTablerow(token);
                    }
                    else if (tagName.Is(TagNames.Table))
                    {
                        if (InRowEndTagTablerow(token))
                            InTableBody(token);
                    }
                    else if (TagNames.AllTableSections.Contains(tagName))
                    {
                        if (IsInTableScope(tagName))
                        {
                            InRowEndTagTablerow(token);
                            InTableBody(token);
                        }
                        else
                            RaiseErrorOccurred(HtmlParseError.TableSectionNotInScope, token);
                    }
                    else if (TagNames.AllTableSpecial.Contains(tagName))
                    {
                        RaiseErrorOccurred(HtmlParseError.TagCannotEndHere, token);
                    }
                    else
                    {
                        break;
                    }

                    return;
                }
            }

            InTable(token);
        }
开发者ID:fjwuyongzhi,项目名称:AngleSharp,代码行数:69,代码来源:HtmlDomBuilder.cs


示例16: InTableBody

        /// <summary>
        /// See 8.2.5.4.13 The "in table body" insertion mode.
        /// </summary>
        /// <param name="token">The passed token.</param>
        void InTableBody(HtmlToken token)
        {
            switch (token.Type)
            {
                case HtmlTokenType.StartTag:
                {
                    var tagName = token.Name;

                    if (tagName.Is(TagNames.Tr))
                    {
                        ClearStackBackTo(TagNames.AllTableSections);
                        AddElement(new HtmlTableRowElement(_document), token.AsTag());
                        _currentMode = HtmlTreeMode.InRow;
                    }
                    else if (TagNames.AllTableCells.Contains(tagName))
                    {
                        InTableBody(HtmlTagToken.Open(TagNames.Tr));
                        InRow(token);
                    }
                    else if (TagNames.AllTableGeneral.Contains(tagName))
                        InTableBodyCloseTable(token.AsTag());
                    else
                        break;

                    return;
                }
                case HtmlTokenType.EndTag:
                {
                    var tagName = token.Name;

                    if (TagNames.AllTableSections.Contains(tagName))
                    {
                        if (IsInTableScope(tagName))
                        {
                            ClearStackBackTo(TagNames.AllTableSections);
                            CloseCurrentNode();
                            _currentMode = HtmlTreeMode.InTable;
                        }
                        else
                            RaiseErrorOccurred(HtmlParseError.TableSectionNotInScope, token);
                    }
                    else if (tagName.Is(TagNames.Tr) || TagNames.AllTableSpecial.Contains(tagName))
                        RaiseErrorOccurred(HtmlParseError.TagCannotEndHere, token);
                    else if (tagName.Is(TagNames.Table))
                        InTableBodyCloseTable(token.AsTag());
                    else
                        break;

                    return;
                }
            }

            InTable(token);
        }
开发者ID:fjwuyongzhi,项目名称:AngleSharp,代码行数:58,代码来源:HtmlDomBuilder.cs


示例17: InRowEndTagTablerow

 /// <summary>
 /// Act as if an tr end tag has been found in the InRow state.
 /// </summary>
 /// <param name="token">The actual tag token.</param>
 /// <returns>True if the token was not ignored, otherwise false.</returns>
 Boolean InRowEndTagTablerow(HtmlToken token)
 {
     if (IsInTableScope(TagNames.Tr))
     {
         ClearStackBackTo(TagNames.Tr);
         CloseCurrentNode();
         _currentMode = HtmlTreeMode.InTableBody;
         return true;
     }
     else
     {
         RaiseErrorOccurred(HtmlParseError.TableRowNotInScope, token);
         return false;
     }
 }
开发者ID:fjwuyongzhi,项目名称:AngleSharp,代码行数:20,代码来源:HtmlDomBuilder.cs


示例18: AfterAfterBody

        /// <summary>
        /// See 8.2.5.4.22 The "after after body" insertion mode.
        /// </summary>
        /// <param name="token">The passed token.</param>
        void AfterAfterBody(HtmlToken token)
        {
            switch (token.Type)
            {
                case HtmlTokenType.Character:
                {
                    var str = token.TrimStart();
                    ReconstructFormatting();
                    AddCharacters(str);

                    if (token.IsEmpty)
                        return;

                    break;
                }
                case HtmlTokenType.EndOfFile:
                {
                    End();
                    return;
                }
                case HtmlTokenType.Comment:
                {
                    _document.AddComment(token);
                    return;
                }
                case HtmlTokenType.Doctype:
                {
                    InBody(token);
                    return;
                }
                case HtmlTokenType.StartTag:
                {
                    if (!token.Name.Is(TagNames.Html))
                        break;

                    InBody(token);
                    return;
                }
            }

            RaiseErrorOccurred(HtmlParseError.TokenNotPossible, token);
            _currentMode = HtmlTreeMode.InBody;
            InBody(token);
        }
开发者ID:fjwuyongzhi,项目名称:AngleSharp,代码行数:48,代码来源:HtmlDomBuilder.cs


示例19: InCaptionEndTagCaption

        /// <summary>
        /// Act as if an caption end tag has been found in the InCaption state.
        /// </summary>
        /// <param name="token">The actual tag token.</param>
        /// <returns>True if the token was not ignored, otherwise false.</returns>
        Boolean InCaptionEndTagCaption(HtmlToken token)
        {
            if (IsInTableScope(TagNames.Caption))
            {
                GenerateImpliedEndTags();

                if (!CurrentNode.LocalName.Is(TagNames.Caption))
                    RaiseErrorOccurred(HtmlParseError.TagDoesNotMatchCurrentNode, token);

                ClearStackBackTo(TagNames.Caption);
                CloseCurrentNode();
                _formattingElements.ClearFormatting();
                _currentMode = HtmlTreeMode.InTable;
                return true;
            }
            else
            {
                RaiseErrorOccurred(HtmlParseError.CaptionNotInScope, token);
                return false;
            }
        }
开发者ID:fjwuyongzhi,项目名称:AngleSharp,代码行数:26,代码来源:HtmlDomBuilder.cs


示例20: TemplateStep

 /// <summary>
 /// Inserting something in the template.
 /// </summary>
 /// <param name="token">The token to insert.</param>
 /// <param name="mode">The mode to push.</param>
 void TemplateStep(HtmlToken token, HtmlTreeMode mode)
 {
     _templateModes.Pop();
     _templateModes.Push(mode);
     _currentMode = mode;
     Home(token);
 }
开发者ID:fjwuyongzhi,项目名称:AngleSharp,代码行数:12,代码来源:HtmlDomBuilder.cs



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C# HttpActionDescriptor类代码示例发布时间:2022-05-24
下一篇:
C# HtmlTokenizerState类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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