C# Класс 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)
Наследование: IDomObject, IDomNode
Показать файл Открыть проект Примеры использования класса

Защищенные свойства (Protected)

Свойство Тип Описание
DocInfo DocumentInfo

Private Properties

Свойство Тип Описание
ICloneable object
IDomNode IDomNode
Render void
Render void
SetDocFlags void

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

Метод Описание
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.

Защищенные методы

Метод Описание
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.

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

Метод Описание
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

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

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

Adds the class.
/// Thrown when the requested operation is invalid. ///
public AddClass ( string className ) : bool
className string /// The class name for which to test. ///
Результат bool

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

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. ///
Результат void

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

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. ///
Результат void

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

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. ///
Результат void

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

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. ///
Результат void

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

Clone this element.
public Clone ( ) : IDomObject
Результат IDomObject

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

An enumeration of clones of the chilren of this object
public CloneChildren ( ) : IEnumerable
Результат IEnumerable

CloneImplementation() защищенный абстрактный Метод

The implementation for Clone.
protected abstract CloneImplementation ( ) : IDomObject
Результат IDomObject

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

Compares this IDomObject object to another to determine their relative ordering.
public CompareTo ( IDomObject other ) : int
other IDomObject /// Another instance to compare. ///
Результат int

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

Return the total number of descendants of this element.
public DescendantCount ( ) : int
Результат int

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

Returns the HTML for this element, but ignoring children/innerHTML.
public ElementHtml ( ) : string
Результат string

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

Returns all of the ancestors of the given node, in descending order of their depth from the root node.
public GetAncestors ( ) : IEnumerable
Результат IEnumerable

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

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. ///
Результат string

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

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. ///
Результат string

GetDepth() защищенный Метод

Gets the depth of the current node.
protected GetDepth ( ) : int
Результат int

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

Returns all IDomElement descendents of the given node, in pre-order depth first order.
public GetDescendentElements ( ) : IEnumerable
Результат IEnumerable

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

Returns all of the descendents of the given node, in pre-order depth first order.
public GetDescendents ( ) : IEnumerable
Результат IEnumerable

GetPath() защищенный Метод

Gets the full path to this document.
protected GetPath ( ) : ushort[]
Результат ushort[]

GetPath_UnOptimized() защищенный Метод

Gets the full path to this document.
protected GetPath_UnOptimized ( ) : ushort[]
Результат ushort[]

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

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. ///
Результат bool

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

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. ///
Результат bool

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

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. ///
Результат bool

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

Enumerates index keys in this collection.
/// Thrown when the requested operation is invalid. ///
public IndexKeys ( ) : IEnumerable
Результат IEnumerable

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

Enumerates index keys for this element.
/// Thrown when the requested operation is not valid for this element type ///
public IndexKeysRanged ( ) : IEnumerable
Результат IEnumerable

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

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. ///
Результат void

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

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. ///
Результат void

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

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
Результат void

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

Removes an attribute from the specified element.
/// Thrown when the requested operation is invalid. ///
public RemoveAttribute ( string name ) : bool
name string /// The attribute name. ///
Результат bool

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

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. ///
Результат void

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

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. ///
Результат bool

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

Removes the named style from this element.
/// Thrown when the requested operation is invalid. ///
public RemoveStyle ( string name ) : bool
name string /// The style name. ///
Результат bool

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

Renders the complete HTML for this element, including its children.
public Render ( ) : string
Результат string

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

Renders the complete HTML for this element, including its children.
public Render ( DomRenderingOptions options ) : string
options DomRenderingOptions
Результат string

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

Renders the complete HTML for this element, including its children, using the specified OutputFormatter.
public Render ( IOutputFormatter formatter ) : string
formatter IOutputFormatter /// The formatter. ///
Результат string

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

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. ///
Результат void

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

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. ///
Результат void

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

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. ///
Результат void

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

The ToString() override for an object depends on the type of element.
public ToString ( ) : string
Результат string

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

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. ///
Результат bool

UpdateDocumentFlags() защищенный Метод

Updates the cached Document and property flags.
protected UpdateDocumentFlags ( ) : void
Результат void

UpdateDocumentFlags() защищенный Метод

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. ///
Результат void

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

The child node at the specified index.
public this ( int index ) : IDomObject
index int /// The zero-based index of the child node to access. ///
Результат IDomObject

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

The child node at the specified index.
public this ( string attribute ) : string
attribute string /// The zero-based index of the child node to access. ///
Результат string

Описание свойств

DocInfo защищенное свойство

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
Результат DocumentInfo