C# Класс Microsoft.Html.Core.Tree.Nodes.ElementNode

Represent HTML element node in the tree
Наследование: TreeNode, ICompositeTextRange, IHtmlTreeVisitorPattern, IPropertyOwner
Показать файл Открыть проект Примеры использования класса

Открытые методы

Метод Описание
Accept ( Func visitor, object parameter ) : bool
Accept ( IHtmlTreeVisitor visitor, object parameter ) : bool
AddOrphanedEndTag ( TagNode tag ) : void
Contains ( ITextRange range, bool inclusiveTagStart, bool inclusiveTagEnd ) : bool
Contains ( int position ) : bool

Determines if element contains given position

ElementEnclosingRange ( ITextRange range, bool inclusiveEnd ) : ElementNode

Finds deepest element node which inner range fully encloses given positions

ElementFromPosition ( int pos ) : ElementNode

Finds deepest element node that contains given position

ElementFromRange ( ITextRange range ) : ElementNode

Finds deepest element node that fully encloses given range

ElementFromRangeAndInclusion ( ITextRange range, bool inclusiveTagStart, bool inclusiveTagEnd ) : ElementNode
ElementNode ( ElementNode parent, int openAngleBracketPosition, NameToken nameToken, int maxEnd ) : System
GetAttribute ( string attributeName ) : AttributeNode

Locates element attribute by name using string comparison as specified by tree the element is in.

GetAttribute ( string attributeName, bool ignoreCase ) : AttributeNode

Locates element attribute by name

GetAttribute ( string prefix, string attributeName, bool ignoreCase ) : AttributeNode

Locates element attribute by prefix and name

GetAttributeIndex ( string attributeName, bool ignoreCase ) : int

Locates element attribute by name

GetChildrenSurroundingRange ( ITextRange range, int &child1, int &child2 ) : void

Given text range locates previous and next child nodes that surround the range

GetCommonAncestor ( ElementNode node1, ElementNode node2 ) : ElementNode

Retrieves node that contains both node1 and node2 ranges. Node1 range must precede node2 in the text buffer

GetPositionElement ( int position, ElementNode &element, AttributeNode &attribute ) : HtmlPositionType

Determines position type and enclosing element node for a given position in the document text.

GetText ( ITextRange range ) : string
HasPrefix ( ) : bool
IsDocType ( ) : bool

Determines if element is a DOCTYPE element

IsScriptBlock ( ) : bool

Determines if element is a script block

IsSelfClosing ( ) : bool

Tells if element is self-closing element like <br>. Does not tell if element is closed by />, use IsShortHand for that.

IsShorthand ( ) : bool

Tells if element is a short-hand element ending in />

IsStyleBlock ( ) : bool

Determines if element is a style block

RemoveChild ( int index ) : void
RemoveChildren ( int start, int count ) : void
Shift ( int offset ) : void

Shifts node start, end and all child elements by the specified offset.

ShiftStartingFrom ( int start, int offset ) : void

Shifts node components that are located at or beyond given start point by the specified range

Приватные методы

Метод Описание
CompleteElement ( ITextRange closingSequence, bool isClosed, ReadOnlyCollection children, ReadOnlyCollection startTagAtributes, ReadOnlyCollection endTagAttributes ) : void

Completes element. Called by tree builder when element is complete: start tag is self-closed or implicitly closed or element is closed by a well-formed end tag or by another tag that is being opened.

FindTopmostParent ( List tagNames, bool ignoreCase ) : ElementNode

Given list of end tag names finds topmost element that matches provided end tags

OpenEndTag ( int position, NameToken nameToken, int maxEnd ) : void

Begins element end tag processing. Called exclusively by tree builder. when it discovers </name sequence.

ToString ( ) : string

Описание методов

Accept() публичный Метод

public Accept ( Func visitor, object parameter ) : bool
visitor Func
parameter object
Результат bool

Accept() публичный Метод

public Accept ( IHtmlTreeVisitor visitor, object parameter ) : bool
visitor IHtmlTreeVisitor
parameter object
Результат bool

AddOrphanedEndTag() публичный Метод

public AddOrphanedEndTag ( TagNode tag ) : void
tag TagNode
Результат void

Contains() публичный Метод

public Contains ( ITextRange range, bool inclusiveTagStart, bool inclusiveTagEnd ) : bool
range ITextRange
inclusiveTagStart bool
inclusiveTagEnd bool
Результат bool

Contains() публичный Метод

Determines if element contains given position
public Contains ( int position ) : bool
position int Position in a text buffer
Результат bool

ElementEnclosingRange() публичный Метод

Finds deepest element node which inner range fully encloses given positions
public ElementEnclosingRange ( ITextRange range, bool inclusiveEnd ) : ElementNode
range ITextRange Range to analyze
inclusiveEnd bool If true, element and range may have same end points
Результат ElementNode

ElementFromPosition() публичный Метод

Finds deepest element node that contains given position
public ElementFromPosition ( int pos ) : ElementNode
pos int Position
Результат ElementNode

ElementFromRange() публичный Метод

Finds deepest element node that fully encloses given range
public ElementFromRange ( ITextRange range ) : ElementNode
range ITextRange
Результат ElementNode

ElementFromRangeAndInclusion() публичный Метод

public ElementFromRangeAndInclusion ( ITextRange range, bool inclusiveTagStart, bool inclusiveTagEnd ) : ElementNode
range ITextRange
inclusiveTagStart bool
inclusiveTagEnd bool
Результат ElementNode

ElementNode() публичный Метод

public ElementNode ( ElementNode parent, int openAngleBracketPosition, NameToken nameToken, int maxEnd ) : System
parent ElementNode
openAngleBracketPosition int
nameToken Microsoft.Html.Core.Parser.Tokens.NameToken
maxEnd int
Результат System

GetAttribute() публичный Метод

Locates element attribute by name using string comparison as specified by tree the element is in.
public GetAttribute ( string attributeName ) : AttributeNode
attributeName string Fully qualified attribute name
Результат AttributeNode

GetAttribute() публичный Метод

Locates element attribute by name
public GetAttribute ( string attributeName, bool ignoreCase ) : AttributeNode
attributeName string Fully qualified attribute name
ignoreCase bool True if comparison should be case-insensitive
Результат AttributeNode

GetAttribute() публичный Метод

Locates element attribute by prefix and name
public GetAttribute ( string prefix, string attributeName, bool ignoreCase ) : AttributeNode
prefix string Namespace prefix
attributeName string Attribute name
ignoreCase bool True if comparison should be case-insensitive
Результат AttributeNode

GetAttributeIndex() публичный Метод

Locates element attribute by name
public GetAttributeIndex ( string attributeName, bool ignoreCase ) : int
attributeName string Fully qualified attribute name
ignoreCase bool True if comparison should be case-insensitive
Результат int

GetChildrenSurroundingRange() публичный Метод

Given text range locates previous and next child nodes that surround the range
public GetChildrenSurroundingRange ( ITextRange range, int &child1, int &child2 ) : void
range ITextRange Text range
child1 int Index of the child node that precedes start of the range
child2 int Index of the child that follows end of the range
Результат void

GetCommonAncestor() публичный Метод

Retrieves node that contains both node1 and node2 ranges. Node1 range must precede node2 in the text buffer
public GetCommonAncestor ( ElementNode node1, ElementNode node2 ) : ElementNode
node1 ElementNode First node
node2 ElementNode Second node
Результат ElementNode

GetPositionElement() публичный Метод

Determines position type and enclosing element node for a given position in the document text.
public GetPositionElement ( int position, ElementNode &element, AttributeNode &attribute ) : HtmlPositionType
position int Position in the document text
element ElementNode Element that contains position
attribute AttributeNode Attribute that contains position (may be null)
Результат HtmlPositionType

GetText() публичный Метод

public GetText ( ITextRange range ) : string
range ITextRange
Результат string

HasPrefix() публичный Метод

public HasPrefix ( ) : bool
Результат bool

IsDocType() публичный Метод

Determines if element is a DOCTYPE element
public IsDocType ( ) : bool
Результат bool

IsScriptBlock() публичный Метод

Determines if element is a script block
public IsScriptBlock ( ) : bool
Результат bool

IsSelfClosing() публичный Метод

Tells if element is self-closing element like <br>. Does not tell if element is closed by />, use IsShortHand for that.
public IsSelfClosing ( ) : bool
Результат bool

IsShorthand() публичный Метод

Tells if element is a short-hand element ending in />
public IsShorthand ( ) : bool
Результат bool

IsStyleBlock() публичный Метод

Determines if element is a style block
public IsStyleBlock ( ) : bool
Результат bool

RemoveChild() публичный Метод

public RemoveChild ( int index ) : void
index int
Результат void

RemoveChildren() публичный Метод

public RemoveChildren ( int start, int count ) : void
start int
count int
Результат void

Shift() публичный Метод

Shifts node start, end and all child elements by the specified offset.
public Shift ( int offset ) : void
offset int
Результат void

ShiftStartingFrom() публичный Метод

Shifts node components that are located at or beyond given start point by the specified range
public ShiftStartingFrom ( int start, int offset ) : void
start int Start point
offset int Offset to shift by
Результат void