Table of Contents

Class XmlParserWithSchema

Namespace
Alternet.Syntax.Parsers.Advanced
Assembly
Alternet.Syntax.Parsers.Advanced.v9.dll
public class XmlParserWithSchema : XmlParser, IComponent, IDisposable, ISyntaxParser, IParser, ILexer, INotify, IUpdate, IImport
Inheritance
XmlParserWithSchema
Implements

Examples

Here is how to declare a XmlParserWithSchema 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.Parsers.Advanced.XmlParserWithSchema();
        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 XmlParserWithSchema 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.XmlParserWithSchema()
        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

XmlParserWithSchema is a non-visual component designed to perform syntax and semantic(via .xsd schema) highlighting for the XML language. This parser supports complete syntax analysis of the XML code. When linked to the SyntaxEdit or TextEditor controls, this parser drives additional features such as code completion, code outlining, code formatting, and underlying syntax and semantic errors and warnings.

XmlParserWithSchema loads XML Schema either from the Schema URL defined in the XML document or from the SchemaName property and uses it for validation and code completion.

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

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

Constructors

XmlParserWithSchema()

Properties

Repository

Gets an IXmlRepository that holds methods for code completion purposes.

Schema
SchemaName
SchemaURL
Settings

Methods

AssignParser(ISyntaxParser)
CodeCompletion(string, StringItemInfo[], Point, CodeCompletionArgs)

Performs code completion for the specified text representing language element.

CreateRepository()

Creates ICodeCompletionRepository to perform code completion functionality for this parser.

FinishParsing(ISyntaxParser)
GetCompletionType(char)

Obtains type of code completion window from specifies char parameter.

GetSyntaxErrors(IList<ISyntaxError>)

Retrieves all syntax errors found while analyzing the text.

GetXmlOpenTagNode(ISyntaxNode)
InitSettings()
IsWebUrl(string)
LoadSchemaFromName()
LoadSchemaFromXmlAttribute(out string)
LoadSchemaFromXmlModel(out string)
OnLoadSchema()
ReparseBlock(ISyntaxNode, Point)
ReparseBlock(Point)

Reparses syntax block at specified position.

ReparseText()

Reparses entire text.

ResetCodeCompletionChars()

Resets CodeCompletionChars to the default value.

ResetOptions()

Resets Options to the default value.

ShouldSerializeCodeCompletionChars()

Indicates whether the CodeCompletionChars property should be persisted.

ShouldSerializeOptions()

Indicates whether the Options property should be persisted.

TryLoadSchemaFromURL()
UpdateSchemaURL()
Validate()
ValidationHandler(object, ValidationEventArgs)
XmlParser_LoadSchema(object, LoadSchemaEventArgs)

Events

LoadSchema