Table of Contents

Class HtmlParser

Namespace
Alternet.Syntax
Assembly
Alternet.Syntax.v9.dll

Represents properties and methods to perform syntax analysis of specified html code text.

[ToolboxBitmap(typeof(XmlParser), "Images.HtmlParser.Icon.bmp")]
public class HtmlParser : XmlParser, IComponent, IDisposable, ISyntaxParser, IParser, ILexer, INotify, IUpdate, IImport
Inheritance
HtmlParser
Implements
Derived

Examples

Here is how to declare a HtmlParser and assign it to the edit control from the C# code:

public partial class Form1 : Form
{
    public Form1()
    {
        InitializeComponent();
    }

    private void Form1_Load(object sender, EventArgs e)
    {
        var parser = new Alternet.Syntax.HtmlParser();
        var edit = new Alternet.Editor.SyntaxEdit();
        edit.Parent = this;
        edit.Lexer = parser;

        string fileName = "myfile.html";
        if (System.IO.File.Exists(fileName))
        {
            parser.FileName = fileName;
            edit.LoadFile(fileName);
        }
    }
}

Here is how to declare a HtmlParser and assign it to the edit control from the Visual Basic code:

Partial Public Class Form1
    Inherits Form

    Public Sub New()
        InitializeComponent()
    End Sub

    Private Sub Form1_Load(ByVal sender As Object, ByVal e As EventArgs)
        Dim parser = New Alternet.Syntax.Parsers.Advanced.SqlParser()
        Dim edit = New Alternet.Editor.SyntaxEdit()
        edit.Parent = Me
        edit.Lexer = parser
        Dim fileName As String = "myfile.txt"

        If System.IO.File.Exists(fileName) Then
            parser.FileName = fileName
            edit.LoadFile(fileName)
        End If
    End Sub
End Class

Remarks

HtmlParser is a non-visual component designed to perform syntax highlighting and provide advanced code editing capabilities for HTML. This parser supports full syntax analysis of the HTML code. When linked to the SyntaxEdit or TextEditor controls, this parser drives additional features such as code outlining, code formatting, and underlying syntax errors and warnings.

Here are some of the important features provided by the HtmlParser:

  • Syntax Highlighting
  • Code Outlining
  • Structure guidelines
  • Formatting a selected block of text or the whole document.

Fields

lexParamColorProc

Properties

CaseSensitive

Gets or sets a boolean value that indicates whether JavaScriptParser should perform case-sensitive analysis of its content.

Methods

GetLexerStyle(int)
InitLanguage()
InitLexer()
InitStyles()
LexParamColor()
ReportXmlError(ISyntaxNode, ISyntaxError)
ResetAutoIndentChars()

Resets AutoIndentChars to it's default value.

ShouldSerializeAutoIndentChars()

Indicates whether the AutoIndentChars property should be persisted.