Interface
IDocument

Definition

Properties

Doctype

The Document Type Declaration (see

DocumentType
) associated with this document. For HTML documents as well as XML documents without a document type declaration this returns
null
. The DOM Level 2 does not support editing the Document Type Declaration.
docType
cannot be altered in any way, including through the use of methods inherited from the
Node
interface, such as
insertNode
or
removeNode
.

Declaration

cs-api-definition
[SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Doctype")]
IDocumentType Doctype { get; }

Property Value

IDocumentType

DocumentElement

This is a convenience attribute that allows direct access to the child node that is the root element of the document. For HTML documents, this is the element with the tagName "HTML".

Declaration

cs-api-definition
IElement DocumentElement { get; }

Property Value

IElement

Implementation

The

DOMImplementation
object that handles this document. A DOM application may use objects from multiple implementations.

Declaration

cs-api-definition
IDomImplementation Implementation { get; }

Property Value

IDomImplementation

Methods

CreateAttribute(string)

Declaration

cs-api-definition
IAttr CreateAttribute(string name)

Parameters

name

string

Returns

IAttr

CreateAttributeNS(string, string)

Creates an attribute of the given qualified name and namespace URI. HTML-only DOM implementations do not need to implement this method.

Declaration

cs-api-definition
IAttr CreateAttributeNS(string namespaceUri, string qualifiedName)

Parameters

namespaceUri

string

qualifiedName

string

Returns

IAttr

A new

Attr
object with the following attributes: AttributeValue
Node.nodeName
qualifiedName
Node.namespaceURI
namespaceURI

       <pre><code class="lang-csharp">Node.prefix</code></pre>prefix, extracted from 
       <pre><code class="lang-csharp">qualifiedName</code></pre>, or <pre><code class="lang-csharp">null</code></pre> if there is no 
       prefix<pre><code class="lang-csharp">Node.localName</code></pre>local name, extracted from 
       <pre><code class="lang-csharp">qualifiedName</code></pre><pre><code class="lang-csharp">Attr.name</code></pre>

       <pre><code class="lang-csharp">qualifiedName</code></pre><pre><code class="lang-csharp">Node.nodeValue</code></pre>the empty 
       string

Exceptions

DomException

INVALID_CHARACTER_ERR: Raised if the specified qualified name contains an illegal character.
NAMESPACE_ERR: Raised if the

qualifiedName
is malformed, if the
qualifiedName
has a prefix and the

namespaceURI
is
null
, if the
qualifiedName
has a prefix that is "xml" and the
namespaceURI
is different from "

http://www.w3.org/XML/1998/namespace", or if the

qualifiedName
is "xmlns" and the
namespaceURI
is different from "

http://www.w3.org/2000/xmlns/".

CreateCdataSection(string)

Creates a

CDATASection
node whose value is the specified string.

Declaration

cs-api-definition
[SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Cdata")]
ICdataSection CreateCdataSection(string data)

Parameters

data

string

Returns

ICdataSection

The new

CDATASection
object.

Exceptions

DomException

NOT_SUPPORTED_ERR: Raised if this document is an HTML document.

CreateComment(string)

Creates a

Comment
node given the specified string.

Declaration

cs-api-definition
IComment CreateComment(string data)

Parameters

data

string

Returns

IComment

The new

Comment
object.

CreateDocumentFragment()

Creates an empty

DocumentFragment
object.

Declaration

cs-api-definition
IDocumentFragment CreateDocumentFragment()

Returns

IDocumentFragment

A new

DocumentFragment
.

CreateElement(string)

Declaration

cs-api-definition
IElement CreateElement(string tagName)

Parameters

tagName

string

Returns

IElement

CreateElementNS(string, string)

Declaration

cs-api-definition
IElement CreateElementNS(string namespaceUri, string qualifiedName)

Parameters

namespaceUri

string

qualifiedName

string

Returns

IElement

CreateEntityReference(string)

Creates an

EntityReference
object. In addition, if the referenced entity is known, the child list of the
EntityReference
node is made the same as that of the corresponding
Entity
node.If any descendant of the
Entity
node has an unbound namespace prefix, the corresponding descendant of the created
EntityReference
node is also unbound; (its
namespaceURI
is
null
). The DOM Level 2 does not support any mechanism to resolve namespace prefixes.

Declaration

cs-api-definition
IEntityReference CreateEntityReference(string name)

Parameters

name

string

Returns

IEntityReference

The new

EntityReference
object.

Exceptions

DomException

INVALID_CHARACTER_ERR: Raised if the specified name contains an illegal character.
NOT_SUPPORTED_ERR: Raised if this document is an HTML document.

CreateProcessingInstruction(string, string)

Creates a

ProcessingInstruction
node given the specified name and data strings.

Declaration

cs-api-definition
IProcessingInstruction CreateProcessingInstruction(string target, string data)

Parameters

target

string

data

string

Returns

IProcessingInstruction

The new

ProcessingInstruction
object.

Exceptions

DomException

INVALID_CHARACTER_ERR: Raised if the specified target contains an illegal character.
NOT_SUPPORTED_ERR: Raised if this document is an HTML document.

CreateTextNode(string)

Creates a

Text
node given the specified string.

Declaration

cs-api-definition
IText CreateTextNode(string data)

Parameters

data

string

Returns

IText

The new

Text
object.

GetElementById(string)

Returns the

Element
whose
ID
is given by
elementId
. If no such element exists, returns
null
. Behavior is not defined if more than one element has this
ID
. The DOM implementation must have information that says which attributes are of type ID. Attributes with the name "ID" are not of type ID unless so defined. Implementations that do not know whether attributes are of type ID or not are expected to return
null
.

Declaration

cs-api-definition
IElement GetElementById(string elementId)

Parameters

elementId

string

Returns

IElement

The matching element.

GetElementsByTagName(string)

Returns a

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

Declaration

cs-api-definition
INodeList GetElementsByTagName(string tagName)

Parameters

tagName

string

Returns

INodeList

A new

NodeList
object containing all the matched
Elements
.

GetElementsByTagNameNS(string, string)

Returns a

NodeList
of all the
Elements
with a given local name and namespace URI in the order in which they are encountered in a preorder traversal of the
Document
tree.

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
.

ImportNode(INode, bool)

Declaration

cs-api-definition
INode ImportNode(INode importedNode, bool deep)

Parameters

importedNode

INode

deep

bool

Returns

INode