Interface
IElement

Definition

Properties

TagName

The name of the element. For example, in:

 <elementExample
id="demo"> ... </elementExample> , 

       <pre><code class="lang-csharp">tagName</code></pre> has 
       the value <pre><code class="lang-csharp">"elementExample"</code></pre>. Note that this is 
       case-preserving in XML, as are all of the operations of the DOM. The 
       HTML DOM returns the <pre><code class="lang-csharp">tagName</code></pre> of an HTML element in the 
       canonical uppercase form, regardless of the case in the source HTML 
       document.

Declaration

cs-api-definition
string TagName { get; }

Property Value

string

Methods

GetAttribute(string)

Retrieves an attribute value by name.

Declaration

cs-api-definition
string GetAttribute(string name)

Parameters

name

string

Returns

string

The

Attr
value as a string, or the empty string if that attribute does not have a specified or default value.

GetAttributeNS(string, string)

Retrieves an attribute value by local name and namespace URI. HTML-only DOM implementations do not need to implement this method.

Declaration

cs-api-definition
string GetAttributeNS(string namespaceUri, string localName)

Parameters

namespaceUri

string

localName

string

Returns

string

The

Attr
value as a string, or the empty string if that attribute does not have a specified or default value.

GetAttributeNode(string)

Declaration

cs-api-definition
IAttr GetAttributeNode(string name)

Parameters

name

string

Returns

IAttr

GetAttributeNodeNS(string, string)

Retrieves an

Attr
node by local name and namespace URI. HTML-only DOM implementations do not need to implement this method.

Declaration

cs-api-definition
IAttr GetAttributeNodeNS(string namespaceUri, string localName)

Parameters

namespaceUri

string

localName

string

Returns

IAttr

The

Attr
node with the specified attribute local name and namespace URI or
null
if there is no such attribute.

GetElementsByTagName(string)

Returns a

NodeList
of all descendant
Elements
with a given tag name, in the order in which they are encountered in a preorder traversal of this
Element
tree.

Declaration

cs-api-definition
INodeList GetElementsByTagName(string name)

Parameters

name

string

Returns

INodeList

A list of matching

Element
nodes.

GetElementsByTagNameNS(string, string)

Returns a

NodeList
of all the descendant
Elements
with a given local name and namespace URI in the order in which they are encountered in a preorder traversal of this
Element
tree.
HTML-only DOM implementations do not need to implement this method.

Declaration

cs-api-definition
INodeList GetElementsByTagNameNS(string namespaceUri, string localName)

Parameters

namespaceUri

string

localName

string

Returns

INodeList

A new

NodeList
object containing all the matched
Elements
.

HasAttribute(string)

Returns

true
when an attribute with a given name is specified on this element or has a default value,
false
otherwise.

Declaration

cs-api-definition
bool HasAttribute(string name)

Parameters

name

string

Returns

bool

true
if an attribute with the given name is
       specified on this element or has a default value, <pre><code class="lang-csharp">false</code></pre>
       otherwise.

HasAttributeNS(string, string)

Returns

true
when an attribute with a given local name and namespace URI is specified on this element or has a default value,
false
otherwise. HTML-only DOM implementations do not need to implement this method.

Declaration

cs-api-definition
bool HasAttributeNS(string namespaceUri, string localName)

Parameters

namespaceUri

string

localName

string

Returns

bool

true
if an attribute with the given local name
       and namespace URI is specified or has a default value on this 
       element, <pre><code class="lang-csharp">false</code></pre> otherwise.

RemoveAttribute(string)

Declaration

cs-api-definition
void RemoveAttribute(string name)

Parameters

name

string

RemoveAttributeNS(string, string)

Declaration

cs-api-definition
void RemoveAttributeNS(string namespaceUri, string localName)

Parameters

namespaceUri

string

localName

string

RemoveAttributeNode(IAttr)

Removes the specified attribute node. If the removed

Attr
has a default value it is immediately replaced. The replacing attribute has the same namespace URI and local name, as well as the original prefix, when applicable.

Declaration

cs-api-definition
[SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Attr")]
IAttr RemoveAttributeNode(IAttr oldAttr)

Parameters

oldAttr

IAttr

Returns

IAttr

The

Attr
node that was removed.

Exceptions

DomException

NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.
NOT_FOUND_ERR: Raised if

oldAttr
is not an attribute of the element.

SetAttribute(string, string)

Declaration

cs-api-definition
void SetAttribute(string name, string value)

Parameters

name

string

value

string

SetAttributeNS(string, string, string)

Declaration

cs-api-definition
void SetAttributeNS(string namespaceUri, string qualifiedName, string value)

Parameters

namespaceUri

string

qualifiedName

string

value

string

SetAttributeNode(IAttr)

Declaration

cs-api-definition
[SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Attr")]
IAttr SetAttributeNode(IAttr newAttr)

Parameters

newAttr

IAttr

Returns

IAttr

SetAttributeNodeNS(IAttr)

Declaration

cs-api-definition
[SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Attr")]
IAttr SetAttributeNodeNS(IAttr newAttr)

Parameters

newAttr

IAttr

Returns

IAttr