C# Class CsQuery.Implementation.DomObject

Something that appears in the DOM. This is essentially the same as a Node in the browser DOM, but IDomObject represents only things that may appear in the DOM (e.g. not an attribute, document, doctype)
Inheritance: IDomObject, IDomNode
Afficher le fichier Open project: prepare/HTML-Renderer Class Usage Examples

Protected Properties

Свойство Type Description
DocInfo DocumentInfo

Private Properties

Свойство Type Description
ICloneable object
IDomNode IDomNode
Render void
Render void
SetDocFlags void

Méthodes publiques

Méthode Description
AddClass ( string className ) : bool

Adds the class.

AddStyle ( string styleString ) : void

Adds a style descriptor to this element, validating the style name and value against the CSS3 ruleset. The string should be of the form "styleName: styleDef;", e.g. "width: 10px;" The trailing semicolon is optional.

AddStyle ( string styleString, bool strict ) : void

Adds a style descriptor to this element, optionally validating against the CSS3 ruleset. The default method always validates; this overload should be used if validation is not desired.

AppendChild ( IDomObject element ) : void

Adds a node to the end of the list of children of a specified parent node. If the node already exists it is removed from current parent node, then added to new parent node.

AppendChildUnsafe ( IDomObject element ) : void

Appends a child without checking to see if its already a member of the DOM. For use in DOM construction to avoid unneeded overhead.

Clone ( ) : IDomObject

Clone this element.

CloneChildren ( ) : IEnumerable

An enumeration of clones of the chilren of this object

CompareTo ( IDomObject other ) : int

Compares this IDomObject object to another to determine their relative ordering.

DescendantCount ( ) : int

Return the total number of descendants of this element.

ElementHtml ( ) : string

Returns the HTML for this element, but ignoring children/innerHTML.

GetAncestors ( ) : IEnumerable

Returns all of the ancestors of the given node, in descending order of their depth from the root node.

GetAttribute ( string name ) : string

Returns the value of the named attribute on the specified element. If the named attribute does not exist, the value returned will either be null or "" (the empty string)

GetAttribute ( string name, string defaultValue ) : string

Returns the value of the named attribute on the specified element. If the named attribute does not exist, the value returned will either be the provide "defaultValue".

GetDescendentElements ( ) : IEnumerable

Returns all IDomElement descendents of the given node, in pre-order depth first order.

GetDescendents ( ) : IEnumerable

Returns all of the descendents of the given node, in pre-order depth first order.

HasAttribute ( string name ) : bool

Returns a boolean value indicating whether the specified element has the specified attribute or not.

HasClass ( string className ) : bool

Returns a boolean value indicating whether the named class exists on this element.

HasStyle ( string styleName ) : bool

Returns a boolean value indicating whether the named style is defined in the styles for this element.

IndexKeys ( ) : IEnumerable

Enumerates index keys in this collection.

IndexKeysRanged ( ) : IEnumerable

Enumerates index keys for this element.

InsertAfter ( IDomObject newNode, IDomObject referenceNode ) : void

Inserts the specified node after a reference element as a child of the current node.

InsertBefore ( IDomObject newNode, IDomObject referenceNode ) : void

Inserts the specified node before a reference element as a child of the current node.

Remove ( ) : void

Removes this object from it's parent, and consequently the Document, if any, to which it belongs.

RemoveAttribute ( string name ) : bool

Removes an attribute from the specified element.

RemoveChild ( IDomObject element ) : void

Removes a child node from the DOM. Returns removed node.

RemoveClass ( string className ) : bool

Removes the named class from the classes defined for this element.

RemoveStyle ( string name ) : bool

Removes the named style from this element.

Render ( ) : string

Renders the complete HTML for this element, including its children.

Render ( DomRenderingOptions options ) : string

Renders the complete HTML for this element, including its children.

Render ( IOutputFormatter formatter ) : string

Renders the complete HTML for this element, including its children, using the specified OutputFormatter.

Render ( IOutputFormatter formatter, TextWriter writer ) : void

Renders the complete HTML for this element, including its children, using the specified OutputFormatter.

SetAttribute ( string name ) : void

Adds a new boolean attribute or sets its value to true.

SetAttribute ( string name, string value ) : void

Adds a new attribute or changes the value of an existing attribute on the specified element.

ToString ( ) : string

The ToString() override for an object depends on the type of element.

TryGetAttribute ( string name, string &value ) : bool

Try to get a named attribute.

this ( int index ) : IDomObject

The child node at the specified index.

this ( string attribute ) : string

The child node at the specified index.

Méthodes protégées

Méthode Description
CloneImplementation ( ) : IDomObject

The implementation for Clone.

GetDepth ( ) : int

Gets the depth of the current node.

GetPath ( ) : ushort[]

Gets the full path to this document.

GetPath_UnOptimized ( ) : ushort[]

Gets the full path to this document.

UpdateDocumentFlags ( ) : void

Updates the cached Document and property flags.

UpdateDocumentFlags ( IDomDocument document ) : void

Updates the cached Document and property flags.

Private Methods

Méthode Description
ICloneable ( ) : object

Makes a deep copy of this object.

IDomNode ( ) : IDomNode

Makes a deep copy of this object.

Render ( StringBuilder sb ) : void
Render ( StringBuilder sb, DomRenderingOptions options ) : void
SetDocFlags ( ) : void

Method Details

AddClass() public méthode

Adds the class.
/// Thrown when the requested operation is invalid. ///
public AddClass ( string className ) : bool
className string /// The class name for which to test. ///
Résultat bool

AddStyle() public méthode

Adds a style descriptor to this element, validating the style name and value against the CSS3 ruleset. The string should be of the form "styleName: styleDef;", e.g. "width: 10px;" The trailing semicolon is optional.
/// Thrown when the requested operation is invalid. ///
public AddStyle ( string styleString ) : void
styleString string /// The style string. ///
Résultat void

AddStyle() public méthode

Adds a style descriptor to this element, optionally validating against the CSS3 ruleset. The default method always validates; this overload should be used if validation is not desired.
/// Thrown when the requested operation is invalid. ///
public AddStyle ( string styleString, bool strict ) : void
styleString string /// An object encapsulating the Styles associated with this element. ///
strict bool /// true to enforce validation of CSS3 styles. ///
Résultat void

AppendChild() public méthode

Adds a node to the end of the list of children of a specified parent node. If the node already exists it is removed from current parent node, then added to new parent node.
/// Thrown when the requested operation is invalid. ///
public AppendChild ( IDomObject element ) : void
element IDomObject /// The element to append. ///
Résultat void

AppendChildUnsafe() public méthode

Appends a child without checking to see if its already a member of the DOM. For use in DOM construction to avoid unneeded overhead.
/// Thrown when the requested operation is invalid. ///
public AppendChildUnsafe ( IDomObject element ) : void
element IDomObject /// The element to append. ///
Résultat void

Clone() public méthode

Clone this element.
public Clone ( ) : IDomObject
Résultat IDomObject

CloneChildren() public méthode

An enumeration of clones of the chilren of this object
public CloneChildren ( ) : IEnumerable
Résultat IEnumerable

CloneImplementation() protected abstract méthode

The implementation for Clone.
protected abstract CloneImplementation ( ) : IDomObject
Résultat IDomObject

CompareTo() public méthode

Compares this IDomObject object to another to determine their relative ordering.
public CompareTo ( IDomObject other ) : int
other IDomObject /// Another instance to compare. ///
Résultat int

DescendantCount() public méthode

Return the total number of descendants of this element.
public DescendantCount ( ) : int
Résultat int

ElementHtml() public méthode

Returns the HTML for this element, but ignoring children/innerHTML.
public ElementHtml ( ) : string
Résultat string

GetAncestors() public méthode

Returns all of the ancestors of the given node, in descending order of their depth from the root node.
public GetAncestors ( ) : IEnumerable
Résultat IEnumerable

GetAttribute() public méthode

Returns the value of the named attribute on the specified element. If the named attribute does not exist, the value returned will either be null or "" (the empty string)
public GetAttribute ( string name ) : string
name string /// The attribute name. ///
Résultat string

GetAttribute() public méthode

Returns the value of the named attribute on the specified element. If the named attribute does not exist, the value returned will either be the provide "defaultValue".
public GetAttribute ( string name, string defaultValue ) : string
name string /// The attribute name. ///
defaultValue string /// A string to return if the attribute does not exist. ///
Résultat string

GetDepth() protected méthode

Gets the depth of the current node.
protected GetDepth ( ) : int
Résultat int

GetDescendentElements() public méthode

Returns all IDomElement descendents of the given node, in pre-order depth first order.
public GetDescendentElements ( ) : IEnumerable
Résultat IEnumerable

GetDescendents() public méthode

Returns all of the descendents of the given node, in pre-order depth first order.
public GetDescendents ( ) : IEnumerable
Résultat IEnumerable

GetPath() protected méthode

Gets the full path to this document.
protected GetPath ( ) : ushort[]
Résultat ushort[]

GetPath_UnOptimized() protected méthode

Gets the full path to this document.
protected GetPath_UnOptimized ( ) : ushort[]
Résultat ushort[]

HasAttribute() public méthode

Returns a boolean value indicating whether the specified element has the specified attribute or not.
public HasAttribute ( string name ) : bool
name string /// The attribute name. ///
Résultat bool

HasClass() public méthode

Returns a boolean value indicating whether the named class exists on this element.
public HasClass ( string className ) : bool
className string /// The class name for which to test. ///
Résultat bool

HasStyle() public méthode

Returns a boolean value indicating whether the named style is defined in the styles for this element.
public HasStyle ( string styleName ) : bool
styleName string /// Name of the style to test. ///
Résultat bool

IndexKeys() public méthode

Enumerates index keys in this collection.
/// Thrown when the requested operation is invalid. ///
public IndexKeys ( ) : IEnumerable
Résultat IEnumerable

IndexKeysRanged() public méthode

Enumerates index keys for this element.
/// Thrown when the requested operation is not valid for this element type ///
public IndexKeysRanged ( ) : IEnumerable
Résultat IEnumerable

InsertAfter() public méthode

Inserts the specified node after a reference element as a child of the current node.
/// Thrown when the requested operation is invalid. ///
public InsertAfter ( IDomObject newNode, IDomObject referenceNode ) : void
newNode IDomObject /// The new node to be inserted. ///
referenceNode IDomObject /// The node after which the new node will be inserted. ///
Résultat void

InsertBefore() public méthode

Inserts the specified node before a reference element as a child of the current node.
/// Thrown when the requested operation is invalid. ///
public InsertBefore ( IDomObject newNode, IDomObject referenceNode ) : void
newNode IDomObject /// The node to insert. ///
referenceNode IDomObject /// The node before which the new node will be inserted. ///
Résultat void

Remove() public méthode

Removes this object from it's parent, and consequently the Document, if any, to which it belongs.
/// Thrown when the the node has no parent. ///
public Remove ( ) : void
Résultat void

RemoveAttribute() public méthode

Removes an attribute from the specified element.
/// Thrown when the requested operation is invalid. ///
public RemoveAttribute ( string name ) : bool
name string /// The attribute name. ///
Résultat bool

RemoveChild() public méthode

Removes a child node from the DOM. Returns removed node.
/// Thrown when the requested operation is invalid. ///
public RemoveChild ( IDomObject element ) : void
element IDomObject /// The element to remove. ///
Résultat void

RemoveClass() public méthode

Removes the named class from the classes defined for this element.
/// Thrown when the requested operation is invalid. ///
public RemoveClass ( string className ) : bool
className string /// The class name to remove. ///
Résultat bool

RemoveStyle() public méthode

Removes the named style from this element.
/// Thrown when the requested operation is invalid. ///
public RemoveStyle ( string name ) : bool
name string /// The style name. ///
Résultat bool

Render() public méthode

Renders the complete HTML for this element, including its children.
public Render ( ) : string
Résultat string

Render() public méthode

Renders the complete HTML for this element, including its children.
public Render ( DomRenderingOptions options ) : string
options DomRenderingOptions
Résultat string

Render() public méthode

Renders the complete HTML for this element, including its children, using the specified OutputFormatter.
public Render ( IOutputFormatter formatter ) : string
formatter IOutputFormatter /// The formatter. ///
Résultat string

Render() public méthode

Renders the complete HTML for this element, including its children, using the specified OutputFormatter.
public Render ( IOutputFormatter formatter, TextWriter writer ) : void
formatter IOutputFormatter /// The formatter that controls how the ouput is rendered. ///
writer System.IO.TextWriter /// The writer to which output should be written. ///
Résultat void

SetAttribute() public méthode

Adds a new boolean attribute or sets its value to true.
/// Thrown when the object type does not support attributes ///
public SetAttribute ( string name ) : void
name string /// The attribute name. ///
Résultat void

SetAttribute() public méthode

Adds a new attribute or changes the value of an existing attribute on the specified element.
/// Thrown when the object type does not support attributes ///
public SetAttribute ( string name, string value ) : void
name string /// The attribute name. ///
value string /// For input elements, the "value" property of this element. Returns null for other element /// types. ///
Résultat void

ToString() public méthode

The ToString() override for an object depends on the type of element.
public ToString ( ) : string
Résultat string

TryGetAttribute() public méthode

Try to get a named attribute.
public TryGetAttribute ( string name, string &value ) : bool
name string /// The attribute name. ///
value string /// The attribute value, or null if the named attribute does not exist. ///
Résultat bool

UpdateDocumentFlags() protected méthode

Updates the cached Document and property flags.
protected UpdateDocumentFlags ( ) : void
Résultat void

UpdateDocumentFlags() protected méthode

Updates the cached Document and property flags.
protected UpdateDocumentFlags ( IDomDocument document ) : void
document IDomDocument /// A reference to the owning document. This is also the topmost node in the tree. ///
Résultat void

this() public méthode

The child node at the specified index.
public this ( int index ) : IDomObject
index int /// The zero-based index of the child node to access. ///
Résultat IDomObject

this() public méthode

The child node at the specified index.
public this ( string attribute ) : string
attribute string /// The zero-based index of the child node to access. ///
Résultat string

Property Details

DocInfo protected_oe property

Information describing metadata about the element's owning document. This is essentially a cache, it prevents us from having to check to see if there's an owning document and access it directly. This is an optimizaton as this happens often.
protected DocumentInfo DocInfo
Résultat DocumentInfo