C# Class HtmlAgilityPack.HtmlNode

Inheritance: IXPathNavigable
Afficher le fichier Open project: o2platform/O2.Platform.Projects Class Usage Examples

Méthodes publiques

Свойство Type Description
ElementsFlags System.Collections.Hashtable
HtmlNodeTypeNameComment string
HtmlNodeTypeNameDocument string
HtmlNodeTypeNameText string

Private Properties

Свойство Type Description
CloseNode void
GetId string
GetXmlComment string
HtmlNode System
HtmlNode System
SetId void
WriteAttribute void
WriteAttributes void
WriteAttributes void

Méthodes publiques

Méthode Description
AppendChild ( HtmlNode newChild ) : HtmlNode

Adds the specified node to the end of the list of children of this node.

AppendChildren ( HtmlAgilityPack.HtmlNodeCollection newChildren ) : void

Adds the specified node to the end of the list of children of this node.

CanOverlapElement ( string name ) : bool

Determines if an element node can be kept overlapped.

Clone ( ) : HtmlNode

Creates a duplicate of the node

CloneNode ( bool deep ) : HtmlNode

Creates a duplicate of the node.

CloneNode ( string newName ) : HtmlNode

Creates a duplicate of the node and changes its name at the same time.

CloneNode ( string newName, bool deep ) : HtmlNode

Creates a duplicate of the node and changes its name at the same time.

CopyFrom ( HtmlNode node ) : void

Creates a duplicate of the node and the subtree under it.

CopyFrom ( HtmlNode node, bool deep ) : void

Creates a duplicate of the node.

CreateNavigator ( ) : XPathNavigator

Creates a new XPathNavigator object for navigating this HTML node.

CreateNode ( string html ) : HtmlNode

Creates an HTML node from a string representing literal HTML.

GetAttributeValue ( string name, bool def ) : bool

Helper method to get the value of an attribute of this node. If the attribute is not found, the default value will be returned.

GetAttributeValue ( string name, int def ) : int

Helper method to get the value of an attribute of this node. If the attribute is not found, the default value will be returned.

GetAttributeValue ( string name, string def ) : string

Helper method to get the value of an attribute of this node. If the attribute is not found, the default value will be returned.

InsertAfter ( HtmlNode newChild, HtmlNode refChild ) : HtmlNode

Inserts the specified node immediately after the specified reference node.

InsertBefore ( HtmlNode newChild, HtmlNode refChild ) : HtmlNode

Inserts the specified node immediately before the specified reference node.

IsCDataElement ( string name ) : bool

Determines if an element node is a CDATA element node.

IsClosedElement ( string name ) : bool

Determines if an element node is closed.

IsEmptyElement ( string name ) : bool

Determines if an element node is defined as empty.

IsOverlappedClosingElement ( string text ) : bool

Determines if a text corresponds to the closing tag of an node that can be kept overlapped.

PrependChild ( HtmlNode newChild ) : HtmlNode

Adds the specified node to the beginning of the list of children of this node.

PrependChildren ( HtmlAgilityPack.HtmlNodeCollection newChildren ) : void

Adds the specified node list to the beginning of the list of children of this node.

RemoveAll ( ) : void

Removes all the children and/or attributes of the current node.

RemoveAllChildren ( ) : void

Removes all the children of the current node.

RemoveChild ( HtmlNode oldChild ) : HtmlNode

Removes the specified child node.

RemoveChild ( HtmlNode oldChild, bool keepGrandChildren ) : HtmlNode

Removes the specified child node.

ReplaceChild ( HtmlNode newChild, HtmlNode oldChild ) : HtmlNode

Replaces the child node oldChild with newChild node.

SelectNodes ( string xpath ) : HtmlAgilityPack.HtmlNodeCollection

Selects a list of nodes matching the XPath expression.

SelectSingleNode ( string xpath ) : HtmlNode

Selects the first XmlNode that matches the XPath expression.

SetAttributeValue ( string name, string value ) : HtmlAgilityPack.HtmlAttribute

Helper method to set the value of an attribute of this node. If the attribute is not found, it will be created automatically.

WriteContentTo ( ) : string

Saves all the children of the node to a string.

WriteContentTo ( TextWriter outText ) : void

Saves all the children of the node to the specified TextWriter.

WriteTo ( ) : string

Saves the current node to a string.

WriteTo ( TextWriter outText ) : void

Saves the current node to the specified TextWriter.

WriteTo ( XmlWriter writer ) : void

Saves the current node to the specified XmlWriter.

Private Methods

Méthode Description
CloseNode ( HtmlNode endnode ) : void
GetId ( ) : string
GetXmlComment ( HtmlAgilityPack.HtmlCommentNode comment ) : string
HtmlNode ( ) : System
HtmlNode ( HtmlNodeType type, HtmlAgilityPack.HtmlDocument ownerdocument, int index ) : System
SetId ( string id ) : void
WriteAttribute ( TextWriter outText, HtmlAgilityPack.HtmlAttribute att ) : void
WriteAttributes ( TextWriter outText, bool closing ) : void
WriteAttributes ( XmlWriter writer, HtmlNode node ) : void

Method Details

AppendChild() public méthode

Adds the specified node to the end of the list of children of this node.
public AppendChild ( HtmlNode newChild ) : HtmlNode
newChild HtmlNode The node to add. May not be null.
Résultat HtmlNode

AppendChildren() public méthode

Adds the specified node to the end of the list of children of this node.
public AppendChildren ( HtmlAgilityPack.HtmlNodeCollection newChildren ) : void
newChildren HtmlAgilityPack.HtmlNodeCollection The node list to add. May not be null.
Résultat void

CanOverlapElement() public static méthode

Determines if an element node can be kept overlapped.
public static CanOverlapElement ( string name ) : bool
name string The name of the element node to check. May not be null.
Résultat bool

Clone() public méthode

Creates a duplicate of the node
public Clone ( ) : HtmlNode
Résultat HtmlNode

CloneNode() public méthode

Creates a duplicate of the node.
public CloneNode ( bool deep ) : HtmlNode
deep bool true to recursively clone the subtree under the specified node; false to clone only the node itself.
Résultat HtmlNode

CloneNode() public méthode

Creates a duplicate of the node and changes its name at the same time.
public CloneNode ( string newName ) : HtmlNode
newName string The new name of the cloned node. May not be null.
Résultat HtmlNode

CloneNode() public méthode

Creates a duplicate of the node and changes its name at the same time.
public CloneNode ( string newName, bool deep ) : HtmlNode
newName string The new name of the cloned node. May not be null.
deep bool true to recursively clone the subtree under the specified node; false to clone only the node itself.
Résultat HtmlNode

CopyFrom() public méthode

Creates a duplicate of the node and the subtree under it.
public CopyFrom ( HtmlNode node ) : void
node HtmlNode The node to duplicate. May not be null.
Résultat void

CopyFrom() public méthode

Creates a duplicate of the node.
public CopyFrom ( HtmlNode node, bool deep ) : void
node HtmlNode The node to duplicate. May not be null.
deep bool true to recursively clone the subtree under the specified node, false to clone only the node itself.
Résultat void

CreateNavigator() public méthode

Creates a new XPathNavigator object for navigating this HTML node.
public CreateNavigator ( ) : XPathNavigator
Résultat System.Xml.XPath.XPathNavigator

CreateNode() public static méthode

Creates an HTML node from a string representing literal HTML.
public static CreateNode ( string html ) : HtmlNode
html string The HTML text.
Résultat HtmlNode

GetAttributeValue() public méthode

Helper method to get the value of an attribute of this node. If the attribute is not found, the default value will be returned.
public GetAttributeValue ( string name, bool def ) : bool
name string The name of the attribute to get. May not be null.
def bool The default value to return if not found.
Résultat bool

GetAttributeValue() public méthode

Helper method to get the value of an attribute of this node. If the attribute is not found, the default value will be returned.
public GetAttributeValue ( string name, int def ) : int
name string The name of the attribute to get. May not be null.
def int The default value to return if not found.
Résultat int

GetAttributeValue() public méthode

Helper method to get the value of an attribute of this node. If the attribute is not found, the default value will be returned.
public GetAttributeValue ( string name, string def ) : string
name string The name of the attribute to get. May not be null.
def string The default value to return if not found.
Résultat string

InsertAfter() public méthode

Inserts the specified node immediately after the specified reference node.
public InsertAfter ( HtmlNode newChild, HtmlNode refChild ) : HtmlNode
newChild HtmlNode The node to insert. May not be null.
refChild HtmlNode The node that is the reference node. The newNode is placed after the refNode.
Résultat HtmlNode

InsertBefore() public méthode

Inserts the specified node immediately before the specified reference node.
public InsertBefore ( HtmlNode newChild, HtmlNode refChild ) : HtmlNode
newChild HtmlNode The node to insert. May not be null.
refChild HtmlNode The node that is the reference node. The newChild is placed before this node.
Résultat HtmlNode

IsCDataElement() public static méthode

Determines if an element node is a CDATA element node.
public static IsCDataElement ( string name ) : bool
name string The name of the element node to check. May not be null.
Résultat bool

IsClosedElement() public static méthode

Determines if an element node is closed.
public static IsClosedElement ( string name ) : bool
name string The name of the element node to check. May not be null.
Résultat bool

IsEmptyElement() public static méthode

Determines if an element node is defined as empty.
public static IsEmptyElement ( string name ) : bool
name string The name of the element node to check. May not be null.
Résultat bool

IsOverlappedClosingElement() public static méthode

Determines if a text corresponds to the closing tag of an node that can be kept overlapped.
public static IsOverlappedClosingElement ( string text ) : bool
text string The text to check. May not be null.
Résultat bool

PrependChild() public méthode

Adds the specified node to the beginning of the list of children of this node.
public PrependChild ( HtmlNode newChild ) : HtmlNode
newChild HtmlNode The node to add. May not be null.
Résultat HtmlNode

PrependChildren() public méthode

Adds the specified node list to the beginning of the list of children of this node.
public PrependChildren ( HtmlAgilityPack.HtmlNodeCollection newChildren ) : void
newChildren HtmlAgilityPack.HtmlNodeCollection The node list to add. May not be null.
Résultat void

RemoveAll() public méthode

Removes all the children and/or attributes of the current node.
public RemoveAll ( ) : void
Résultat void

RemoveAllChildren() public méthode

Removes all the children of the current node.
public RemoveAllChildren ( ) : void
Résultat void

RemoveChild() public méthode

Removes the specified child node.
public RemoveChild ( HtmlNode oldChild ) : HtmlNode
oldChild HtmlNode The node being removed. May not be null.
Résultat HtmlNode

RemoveChild() public méthode

Removes the specified child node.
public RemoveChild ( HtmlNode oldChild, bool keepGrandChildren ) : HtmlNode
oldChild HtmlNode The node being removed. May not be null.
keepGrandChildren bool true to keep grand children of the node, false otherwise.
Résultat HtmlNode

ReplaceChild() public méthode

Replaces the child node oldChild with newChild node.
public ReplaceChild ( HtmlNode newChild, HtmlNode oldChild ) : HtmlNode
newChild HtmlNode The new node to put in the child list.
oldChild HtmlNode The node being replaced in the list.
Résultat HtmlNode

SelectNodes() public méthode

Selects a list of nodes matching the XPath expression.
public SelectNodes ( string xpath ) : HtmlAgilityPack.HtmlNodeCollection
xpath string The XPath expression.
Résultat HtmlAgilityPack.HtmlNodeCollection

SelectSingleNode() public méthode

Selects the first XmlNode that matches the XPath expression.
public SelectSingleNode ( string xpath ) : HtmlNode
xpath string The XPath expression. May not be null.
Résultat HtmlNode

SetAttributeValue() public méthode

Helper method to set the value of an attribute of this node. If the attribute is not found, it will be created automatically.
public SetAttributeValue ( string name, string value ) : HtmlAgilityPack.HtmlAttribute
name string The name of the attribute to set. May not be null.
value string The value for the attribute.
Résultat HtmlAgilityPack.HtmlAttribute

WriteContentTo() public méthode

Saves all the children of the node to a string.
public WriteContentTo ( ) : string
Résultat string

WriteContentTo() public méthode

Saves all the children of the node to the specified TextWriter.
public WriteContentTo ( TextWriter outText ) : void
outText System.IO.TextWriter The TextWriter to which you want to save.
Résultat void

WriteTo() public méthode

Saves the current node to a string.
public WriteTo ( ) : string
Résultat string

WriteTo() public méthode

Saves the current node to the specified TextWriter.
public WriteTo ( TextWriter outText ) : void
outText System.IO.TextWriter The TextWriter to which you want to save.
Résultat void

WriteTo() public méthode

Saves the current node to the specified XmlWriter.
public WriteTo ( XmlWriter writer ) : void
writer System.Xml.XmlWriter The XmlWriter to which you want to save.
Résultat void

Property Details

ElementsFlags public_oe static_oe property

Gets a collection of flags that define specific behaviors for specific element nodes. The table contains a DictionaryEntry list with the lowercase tag name as the Key, and a combination of HtmlElementFlags as the Value.
public static Hashtable,System.Collections ElementsFlags
Résultat System.Collections.Hashtable

HtmlNodeTypeNameComment public_oe static_oe property

Gets the name of a comment node. It is actually defined as '#comment'.
public static string HtmlNodeTypeNameComment
Résultat string

HtmlNodeTypeNameDocument public_oe static_oe property

Gets the name of the document node. It is actually defined as '#document'.
public static string HtmlNodeTypeNameDocument
Résultat string

HtmlNodeTypeNameText public_oe static_oe property

Gets the name of a text node. It is actually defined as '#text'.
public static string HtmlNodeTypeNameText
Résultat string