Logo Search packages:      
Sourcecode: beagle version File versions  Download package

HtmlAgilityPack::HtmlNode Class Reference

Inheritance diagram for HtmlAgilityPack::HtmlNode:

HtmlAgilityPack::HtmlCommentNode HtmlAgilityPack::HtmlTextNode

List of all members.


Detailed Description

Represents an HTML node.

Definition at line 92 of file HtmlNode.cs.


Public Member Functions

HtmlNode AppendChild (HtmlNode newChild)
 Adds the specified node to the end of the list of children of this node.
void AppendChildren (HtmlNodeCollection newChildren)
 Adds the specified node to the end of the list of children of this node.
HtmlNode Clone ()
 Creates a duplicate of the node.
HtmlNode CloneNode (bool deep)
 Creates a duplicate of the node.
HtmlNode CloneNode (string newName, bool deep)
 Creates a duplicate of the node and changes its name at the same time.
HtmlNode CloneNode (string newName)
 Creates a duplicate of the node and changes its name at the same time.
void CopyFrom (HtmlNode node, bool deep)
 Creates a duplicate of the node.
void CopyFrom (HtmlNode node)
 Creates a duplicate of the node and the subtree under it.
XPathNavigator CreateNavigator ()
 Creates a new XPathNavigator object for navigating this HTML node.
bool GetAttributeValue (string name, bool def)
 Helper method to get the value of an attribute of this node. If the attribute is not found, the default value will be returned.
int GetAttributeValue (string name, int def)
 Helper method to get the value of an attribute of this node. If the attribute is not found, the default value will be returned.
string GetAttributeValue (string name, string def)
 Helper method to get the value of an attribute of this node. If the attribute is not found, the default value will be returned.
HtmlNode InsertAfter (HtmlNode newChild, HtmlNode refChild)
 Inserts the specified node immediately after the specified reference node.
HtmlNode InsertBefore (HtmlNode newChild, HtmlNode refChild)
 Inserts the specified node immediately before the specified reference node.
HtmlNode PrependChild (HtmlNode newChild)
 Adds the specified node to the beginning of the list of children of this node.
void PrependChildren (HtmlNodeCollection newChildren)
 Adds the specified node list to the beginning of the list of children of this node.
void RemoveAll ()
 Removes all the children and/or attributes of the current node.
void RemoveAllChildren ()
 Removes all the children of the current node.
HtmlNode RemoveChild (HtmlNode oldChild, bool keepGrandChildren)
 Removes the specified child node.
HtmlNode RemoveChild (HtmlNode oldChild)
 Removes the specified child node.
HtmlNode ReplaceChild (HtmlNode newChild, HtmlNode oldChild)
 Replaces the child node oldChild with newChild node.
HtmlNodeCollection SelectNodes (string xpath)
 Selects a list of nodes matching the XPath expression.
HtmlNode SelectSingleNode (string xpath)
 Selects the first XmlNode that matches the XPath expression.
HtmlAttribute SetAttributeValue (string name, string value)
 Helper method to set the value of an attribute of this node. If the attribute is not found, it will be created automatically.
string WriteContentTo ()
 Saves all the children of the node to a string.
void WriteContentTo (TextWriter outText)
 Saves all the children of the node to the specified TextWriter.
string WriteTo ()
 Saves the current node to a string.
void WriteTo (XmlWriter writer)
 Saves the current node to the specified XmlWriter.
void WriteTo (TextWriter outText)
 Saves the current node to the specified TextWriter.

Static Public Member Functions

static bool CanOverlapElement (string name)
 Determines if an element node can be kept overlapped.
static HtmlNode CreateNode (string html)
 Creates an HTML node from a string representing literal HTML.
static bool IsCDataElement (string name)
 Determines if an element node is a CDATA element node.
static bool IsClosedElement (string name)
 Determines if an element node is closed.
static bool IsEmptyElement (string name)
 Determines if an element node is defined as empty.
static bool IsOverlappedClosingElement (string text)
 Determines if a text corresponds to the closing tag of an node that can be kept overlapped.

Static Public Attributes

static Hashtable ElementsFlags
 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.
static readonly string HtmlNodeTypeNameComment = "#comment"
 Gets the name of a comment node. It is actually defined as 'comment'.
static readonly string HtmlNodeTypeNameDocument = "#document"
 Gets the name of the document node. It is actually defined as 'document'.
static readonly string HtmlNodeTypeNameText = "#text"
 Gets the name of a text node. It is actually defined as 'text'.

Properties

HtmlAttributeCollection Attributes [get]
 Gets the collection of HTML attributes for this node. May not be null.
HtmlNodeCollection ChildNodes [get]
 Gets all the children of the node.
bool Closed [get]
 Gets a value indicating if this node has been closed or not.
HtmlAttributeCollection ClosingAttributes [get]
 Gets the collection of HTML attributes for the closing tag. May not be null.
internal HtmlNode EndNode [get]
HtmlNode FirstChild [get]
 Gets the first child of the node.
bool HasAttributes [get]
 Gets a value indicating whether the current node has any attributes.
bool HasChildNodes [get]
 Gets a value indicating whether this node has any child nodes.
bool HasClosingAttributes [get]
 Gets a value indicating whether the current node has any attributes on the closing tag.
string Id [get, set]
 Gets or sets the value of the 'id' HTML attribute. The document must have been parsed using the OptionUseIdAttribute set to true.
virtual string InnerHtml [get, set]
 Gets or Sets the HTML between the start and end tags of the object.
virtual string InnerText [get]
 Gets or Sets the text between the start and end tags of the object.
HtmlNode LastChild [get]
 Gets the last child of the node.
int Line [get]
 Gets the line number of this node in the document.
int LinePosition [get]
 Gets the column number of this node in the document.
string Name [get, set]
 Gets or sets this node's name.
HtmlNode NextSibling [get]
 Gets the HTML node immediately following this element.
HtmlNodeType NodeType [get]
 Gets the type of this node.
virtual string OuterHtml [get]
 Gets or Sets the object and its content in HTML.
HtmlDocument OwnerDocument [get]
 Gets the HtmlDocument to which this node belongs.
HtmlNode ParentNode [get]
 Gets the parent of this node (for nodes that can have parents).
HtmlNode PreviousSibling [get]
 Gets the node immediately preceding this node.
bool StartTag [get]
int StreamPosition [get]
 Gets the stream position of this node in the document, relative to the start of the document.

Private Member Functions

internal void CloseNode (HtmlNode endnode)
internal string GetId ()
internal HtmlNode (HtmlNodeType type, HtmlDocument ownerdocument, int index)
internal void SetId (string id)
internal void WriteAttribute (TextWriter outText, HtmlAttribute att)
internal void WriteAttributes (TextWriter outText, bool closing)

Static Private Member Functions

static internal string GetXmlComment (HtmlCommentNode comment)
static internal void WriteAttributes (XmlWriter writer, HtmlNode node)

Private Attributes

internal HtmlAttributeCollection _attributes
internal HtmlNodeCollection _childnodes
internal HtmlNode _endnode
internal bool _innerchanged = false
internal string _innerhtml
internal int _innerlength = 0
internal int _innerstartindex = 0
internal int _line = 0
internal int _lineposition = 0
internal string _name
internal int _namelength = 0
internal int _namestartindex = 0
internal HtmlNode _nextnode
internal HtmlNodeType _nodetype
internal bool _outerchanged = false
internal string _outerhtml
internal int _outerlength = 0
internal int _outerstartindex = 0
internal HtmlDocument _ownerdocument
internal HtmlNode _parentnode
internal HtmlNode _prevnode
internal HtmlNode _prevwithsamename = null
internal bool _starttag = false
internal int _streamposition = 0

The documentation for this class was generated from the following file:

Generated by  Doxygen 1.6.0   Back to index