Table of Contents

Class XmlParser

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

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

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

Examples

Here is how to declare a XmlParser 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.XmlParser();
        var edit = new Alternet.Editor.SyntaxEdit();
        edit.Parent = this;
        edit.Lexer = parser;

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

Here is how to declare a XmlParser 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.XmlParser()
        Dim edit = New Alternet.Editor.SyntaxEdit()
        edit.Parent = Me
        edit.Lexer = parser
        Dim fileName As String = "myfile.xml"

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

Remarks

XmlParser is a non-visual component designed to perform syntax highlighting for the XML language. This parser supports full syntax analysis of the XML code. When linked to the SyntaxEdit or TextEditor controls, this parser drives additional features such as code outlining, formatting, and underlying syntax errors.

Here are some of the essential features provided by the XmlParser:

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

Constructors

XmlParser()

Initializes a new instance of the XmlParser class with default settings.

Fields

StateCDATA
StateComment
StateNormal
StateParam
StateString
StateTag
lexBodyProc
lexCDATAEndProc
lexCDATAProc
lexCommentEndProc
lexCommentProc
lexEqualProc
lexNameProc
lexParamNumberProc
lexParamProc
lexStringEndProc
lexStringParamProc
lexStringProc
lexSymbolProc
lexTagProc
lexWhitespaceProc
prevPosition

Properties

CaseSensitive

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

Methods

AddNode(ISyntaxNode)
CheckParamValue(ISyntaxNode)
GetCompletionType(char)

Obtains type of code completion window from specifies char parameter.

GetLexerStyle(int)
GetMultiLineComment(out string, out string)

Gets the start and symbols multi-line comment.

GetSmartIndent(ISyntaxNodes, int, bool)
InitLanguage()
InitLexer()
InitStyles()
IsComment(int)
IsValidToken(int)
LexBody()
LexCDATA()
LexCDATAEnd()
LexComment()
LexCommentEnd()
LexEqual()
LexIdent()
LexName()
LexParam()
LexParamNumber()
LexString()
LexStringEnd()
LexStringEnd(char)
LexStringParam()
LexSymbol()
LexTag()
LexWhitespace()
MoveNext()
ParseBody()
ParseComment()
ParseOpenTag()
ParseParams()
ParseParams(ISyntaxNode)
ParseTag(ISyntaxNode)
ParseTagBody()
ParseUnit()
ReparseText()

Reparses entire text.

ReportXmlError(ISyntaxNode, ISyntaxError)
ResetOptions()

Resets Options to the default value.

ShouldSerializeOptions()

Indicates whether the Options property should be persisted.

SkipTagBody()