Class Document
Namespace: Aspose.Html.Dom
Assembly: Aspose.HTML.dll (25.7.0)
The Document represents the entire HTML, XML or SVG document. Conceptually, it is the root of the document tree, and provides the primary access to the document’s data.
[DOMObject]
[ComVisible(true)]
[DOMName("Document")]
public class Document : Node, INotifyPropertyChanged, IEventTarget, IDisposable, IXPathNSResolver, IDocumentTraversal, IXPathEvaluator, IDocumentEvent, IParentNode, IElementTraversal, INonElementParentNode, IDocumentStyle, IGlobalEventHandlersInheritance
object ← DOMObject ← EventTarget ← Node ← Document
Derived
Implements
INotifyPropertyChanged , IEventTarget , IDisposable , IXPathNSResolver , IDocumentTraversal , IXPathEvaluator , IDocumentEvent , IParentNode , IElementTraversal , INonElementParentNode , IDocumentStyle , IGlobalEventHandlers
Inherited Members
Node.ELEMENT_NODE , Node.ATTRIBUTE_NODE , Node.TEXT_NODE , Node.CDATA_SECTION_NODE , Node.ENTITY_REFERENCE_NODE , Node.ENTITY_NODE , Node.PROCESSING_INSTRUCTION_NODE , Node.COMMENT_NODE , Node.DOCUMENT_NODE , Node.DOCUMENT_TYPE_NODE , Node.DOCUMENT_FRAGMENT_NODE , Node.NOTATION_NODE , Node.HasChildNodes() , Node.Normalize() , Node.CloneNode() , Node.CloneNode(bool) , Node.IsEqualNode(Node) , Node.IsSameNode(Node) , Node.LookupPrefix(string) , Node.LookupNamespaceURI(string) , Node.IsDefaultNamespace(string) , Node.InsertBefore(Node, Node) , Node.ReplaceChild(Node, Node) , Node.RemoveChild(Node) , Node.AppendChild(Node) , Node.Dispose(bool) , Node.ToString() , Node.NodeType , Node.LocalName , Node.NamespaceURI , Node.Prefix , Node.NodeName , Node.BaseURI , Node.OwnerDocument , Node.ParentNode , Node.ParentElement , Node.ChildNodes , Node.FirstChild , Node.LastChild , Node.PreviousSibling , Node.NextSibling , Node.NodeValue , Node.TextContent , EventTarget.AddEventListener(string, DOMEventHandler, bool) , EventTarget.AddEventListener(string, IEventListener) , EventTarget.AddEventListener(string, IEventListener, bool) , EventTarget.RemoveEventListener(string, DOMEventHandler, bool) , EventTarget.RemoveEventListener(string, IEventListener) , EventTarget.RemoveEventListener(string, IEventListener, bool) , EventTarget.DispatchEvent(Event) , EventTarget.Dispose() , EventTarget.Dispose(bool) , DOMObject.GetPlatformType() , object.GetType() , object.MemberwiseClone() , object.ToString() , object.Equals(object?) , object.Equals(object?, object?) , object.ReferenceEquals(object?, object?) , object.GetHashCode()
Constructors
Document(IBrowsingContext, int)
Initializes a new instance of the Aspose.Html.Dom.Document class.
protected Document(IBrowsingContext context, int implementation)Parameters
context IBrowsingContext
The Aspose.Html.Dom.IBrowsingContext that will be associated with current document.
implementation int
The document implementation type, such as HTML and SVG.
Properties
BaseURI
The absolute base URI of this node or null if the implementation wasn’t able to obtain an absolute URI.
public override string BaseURI { get; }Property Value
CharacterSet
Gets the document’s encoding.
[DOMName("characterSet")]
public string CharacterSet { get; }Property Value
Charset
Gets the document’s encoding.
[DOMName("charset")]
public string Charset { get; }Property Value
ChildElementCount
Returns the current number of element nodes that are children of this element. 0 if this element has no child nodes that are of nodeType 1.
public int ChildElementCount { get; }Property Value
Children
Returns the child elements.
public HTMLCollection Children { get; }Property Value
ContentType
Gets the document content type.
[DOMName("contentType")]
public string ContentType { get; }Property Value
Context
Gets the current browsing context.
public IBrowsingContext Context { get; }Property Value
DefaultView
The defaultView IDL attribute of the Document interface, on getting, must return this Document’s browsing context’s WindowProxy object, if this Document has an associated browsing context, or null otherwise.
[DOMName("defaultView")]
public IWindow DefaultView { get; }Property Value
Doctype
The Document Type Declaration associated with this document.
[DOMName("doctype")]
[DOMNullable]
public DocumentType Doctype { get; }Property Value
DocumentElement
This is a convenience attribute that allows direct access to the child node that is the document element of the document.
[DOMName("documentElement")]
public Element DocumentElement { get; }Property Value
DocumentURI
The location of the document or null if undefined or if the Document was created using DOMImplementation.createDocument.
[DOMName("documentURI")]
public string DocumentURI { get; }Property Value
FirstElementChild
Returns the first child element node of this element. null if this element has no child elements.
public Element FirstElementChild { get; }Property Value
Implementation
The DOMImplementation object that handles this document.
[DOMName("implementation")]
public IDOMImplementation Implementation { get; }Property Value
InputEncoding
Gets the document’s encoding.
[DOMName("inputEncoding")]
public string InputEncoding { get; }Property Value
LastElementChild
Returns the last child element node of this element. null if this element has no child elements.
public Element LastElementChild { get; }Property Value
Location
The location of the document.
[DOMName("location")]
public Location Location { get; }Property Value
NextElementSibling
Returns the next sibling element node of this element. null if this element has no element sibling nodes that come after this one in the document tree.
public Element NextElementSibling { get; }Property Value
NodeName
The name of this node, depending on its type.
public override string NodeName { get; }Property Value
NodeType
A code representing the type of the underlying object.
public override ushort NodeType { get; }Property Value
Origin
Gets the document origin.
[DOMName("origin")]
public string Origin { get; }Property Value
OwnerDocument
Gets the owner document.
public override Document OwnerDocument { get; }Property Value
PreviousElementSibling
Returns the previous sibling element node of this element. null if this element has no element sibling nodes that come before this one in the document tree.
public Element PreviousElementSibling { get; }Property Value
ReadyState
Returns the document readiness. The “loading” while the Document is loading, “interactive” once it is finished parsing but still loading sub-resources, and “complete” once it has loaded.
[DOMName("readyState")]
public string ReadyState { get; }Property Value
StrictErrorChecking
An attribute specifying whether error checking is enforced or not. When set to false, the implementation is free to not test every possible error case normally defined on DOM operations, and not raise any DOMException on DOM operations or report errors while using Document.normalizeDocument(). In case of error, the behavior is undefined. This attribute is true by default.
[DOMName("strictErrorChecking")]
public bool StrictErrorChecking { get; set; }Property Value
StyleSheets
A list containing all the style sheets explicitly linked into or embedded in a document. For HTML documents, this includes external style sheets, included via the HTML LINK element, and inline STYLE elements.
public IStyleSheetList StyleSheets { get; }Property Value
XmlStandalone
An attribute specifying, as part of the XML declaration, whether this document is standalone. This is false when unspecified.
[DOMName("xmlStandalone")]
public bool XmlStandalone { get; set; }Property Value
XmlVersion
An attribute specifying, as part of the XML declaration, the version number of this document. If there is no declaration and if this document supports the “XML” feature, the value is “1.0”. If this document does not support the “XML” feature, the value is always null.
[DOMName("xmlVersion")]
public string XmlVersion { get; set; }Property Value
Methods
CreateAttribute(string)
This method creates a new attribute node, and returns it. The object created is a node implementing the Aspose.Html.Dom.Attr class. The DOM does not enforce what sort of attributes can be added to a particular element in this manner.
[DOMName("createAttribute")]
public Attr CreateAttribute(string localName)Parameters
localName string
localName is a string containing the name of the attribute.
Returns
A Aspose.Html.Dom.Attr node.
CreateAttributeNS(string, string)
This method creates a new attribute node, and returns it. The object created is a node implementing the Aspose.Html.Dom.Attr class. The DOM does not enforce what sort of attributes can be added to a particular element in this manner.
[DOMName("createAttributeNS")]
public Attr CreateAttributeNS(string namespaceURI, string qualifiedName)Parameters
namespaceURI string
The namespace URI of the attribute.
qualifiedName string
is a string containing the name of the attribute.
Returns
The Aspose.Html.Dom.Attr.
CreateCDATASection(string)
Creates a CDATASection node whose value is the specified string.
[DOMName("createCDATASection")]
public CDATASection CreateCDATASection(string data)Parameters
data string
The CDATA data.
Returns
The Aspose.Html.Dom.CDATASection.
CreateComment(string)
Creates a Comment node given the specified string.
[DOMName("createComment")]
public Comment CreateComment(string data)Parameters
data string
The comment data.
Returns
The Aspose.Html.Dom.Comment.
CreateDocumentFragment()
Creates a new empty Aspose.Html.Dom.DocumentFragment into which DOM nodes can be added to build an offscreen DOM tree.
[DOMName("createDocumentFragment")]
public DocumentFragment CreateDocumentFragment()Returns
The Aspose.Html.Dom.DocumentFragment.
CreateDocumentType(string, string, string, string)
The method returns a Aspose.Html.Dom.DocumentType object which can either be used with Aspose.Html.Dom.IDOMImplementation.CreateDocument(System.String,System.String,Aspose.Html.Dom.DocumentType) upon document creation or can be put into the document via methods like Aspose.Html.Dom.Node.InsertBefore(Aspose.Html.Dom.Node,Aspose.Html.Dom.Node) or Aspose.Html.Dom.Node.ReplaceChild(Aspose.Html.Dom.Node,Aspose.Html.Dom.Node).
[DOMName("createDocumentType")]
public DocumentType CreateDocumentType(string name, string publicId, string systemId, string internalSubset)Parameters
name string
Is a DOMString containing the qualified name, like svg:svg.
publicId string
Is a DOMString containing the PUBLIC identifier.
systemId string
Is a DOMString containing the SYSTEM identifier.
internalSubset string
The internal subset.
Returns
The Aspose.Html.Dom.DocumentType.
CreateElement(string)
Creates the HTML element specified by localName, or an HTMLUnknownElement if localName isn't recognized.
[DOMName("createElement")]
public Element CreateElement(string localName)Parameters
localName string
A string that specifies the type of element to be created. The nodeName of the created element is initialized with the value of localName. Don't use qualified names (like "html:a") with this method. When called on an HTML document, createElement() converts localName to lower case before creating the element.
Returns
The new Aspose.Html.Dom.Element?text=Element.
CreateElementNS(string, string)
Creates an element of the given qualified name and namespace URI.
[DOMName("createElementNS")]
public Element CreateElementNS(string namespaceURI, string qualifiedName)Parameters
namespaceURI string
The namespace URI.
qualifiedName string
Name of the qualified.
Returns
The Aspose.Html.Dom.Element.
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.
[DOMName("createEntityReference")]
public EntityReference CreateEntityReference(string name)Parameters
name string
The entity name.
Returns
The Aspose.Html.Dom.EntityReference.
CreateEvent(string)
Creates an Aspose.Html.Dom.Events.Event of a type supported by the implementation.
public Event CreateEvent(string eventType)Parameters
eventType string
The eventType parameter specifies the type of Aspose.Html.Dom.Events.Event interface to be created.
The Aspose.Html.Dom.Events.IDocumentEvent.CreateEvent(System.String) method is used in creating Aspose.Html.Dom.Events.Events when it is either inconvenient or unnecessary
for the user to create an Aspose.Html.Dom.Events.Event themselves.
In cases where the implementation provided Aspose.Html.Dom.Events.Event is insufficient, users may supply
their own Aspose.Html.Dom.Events.Event implementations for use with the Aspose.Html.Dom.Events.IEventTarget.DispatchEvent(Aspose.Html.Dom.Events.Event) method.
Returns
The newly created Aspose.Html.Dom.Events.Event
Exceptions
NOT_SUPPORTED_ERR: Raised if the implementation does not support the type of Aspose.Html.Dom.Events.Event interface requested
CreateExpression(string, IXPathNSResolver)
Creates a parsed XPath expression with resolved namespaces. This is useful when an expression will be reused in an application since it makes it possible to compile the expression string into a more efficient internal form and preresolve all namespace prefixes which occur within the expression.
public IXPathExpression CreateExpression(string expression, IXPathNSResolver resolver)Parameters
expression string
The XPath expression string to be parsed.
resolver IXPathNSResolver
The resolver permits translation of all prefixes,
including the xml namespace prefix, within the XPath expression into
appropriate namespace URIs. If this is specified as null, any namespace
prefix within the expression will result in Aspose.Html.Dom.DOMException being
thrown with the code NAMESPACE_ERR.
Returns
The compiled form of the XPath expression.
Exceptions
INVALID_EXPRESSION_ERR: Raised if the expression is not legal according to the rules of the Aspose.Html.Dom.XPath.IXPathEvaluator.
NAMESPACE_ERR: Raised if the expression contains namespace prefixes which cannot be resolved by the specified Aspose.Html.Dom.XPath.IXPathNSResolver.
CreateNSResolver(Node)
Adapts any DOM node to resolve namespaces so that an XPath expression can be easily evaluated
relative to the context of the node where it appeared within the document. This adapter works
like the DOM Level 3 method lookupNamespaceURI on nodes in resolving the namespaceURI
from a given prefix using the current information available in the node’s hierarchy at the time
lookupNamespaceURI is called, also correctly resolving the implicit xml prefix.
public IXPathNSResolver CreateNSResolver(Node nodeResolver)Parameters
nodeResolver Node
The node to be used as a context for namespace resolution.
Returns
Aspose.Html.Dom.XPath.IXPathNSResolver which resolves namespaces with respect to the definitions in scope for a specified node.
CreateNodeIterator(Node)
Create a new NodeIterator over the subtree rooted at the specified node.
public INodeIterator CreateNodeIterator(Node root)Parameters
root Node
node which will be iterated together with its children. The iterator is initially positioned just before this node. The whatToShow flags and the filter, if any, are not considered when setting this position. The root must not be null.
Returns
The newly created NodeIterator.
Exceptions
NOT_SUPPORTED_ERR: Raised if the specified root is null.
CreateNodeIterator(Node, long)
Create a new NodeIterator over the subtree rooted at the specified node.
public INodeIterator CreateNodeIterator(Node root, long whatToShow)Parameters
root Node
node which will be iterated together with its children. The iterator is initially positioned just before this node. The whatToShow flags and the filter, if any, are not considered when setting this position. The root must not be null.
whatToShow long
flag specifies which node types may appear in the logical view of the tree presented by the iterator. See the description of NodeFilter for the set of possible SHOW_ values.These flags can be combined using OR.
Returns
The newly created NodeIterator.
Exceptions
NOT_SUPPORTED_ERR: Raised if the specified root is null.
CreateNodeIterator(Node, long, INodeFilter)
Create a new NodeIterator over the subtree rooted at the specified node.
public INodeIterator CreateNodeIterator(Node root, long whatToShow, INodeFilter filter)Parameters
root Node
node which will be iterated together with its children. The iterator is initially positioned just before this node. The whatToShow flags and the filter, if any, are not considered when setting this position. The root must not be null.
whatToShow long
flag specifies which node types may appear in the logical view of the tree presented by the iterator. See the description of NodeFilter for the set of possible SHOW_ values.These flags can be combined using OR.
filter INodeFilter
NodeFilter to be used with this TreeWalker, or null to indicate no filter.
Returns
The newly created NodeIterator.
Exceptions
NOT_SUPPORTED_ERR: Raised if the specified root is null.
CreateProcessingInstruction(string, string)
Creates a ProcessingInstruction node given the specified name and data strings.
[DOMName("createProcessingInstruction")]
public ProcessingInstruction CreateProcessingInstruction(string target, string data)Parameters
target string
The target.
data string
The instruction data.
Returns
The Aspose.Html.Dom.ProcessingInstruction.
CreateTextNode(string)
Creates a Text node given the specified string.
[DOMName("createTextNode")]
public Text CreateTextNode(string data)Parameters
data string
The text data.
Returns
The Aspose.Html.Dom.Text.
CreateTreeWalker(Node)
Create a new TreeWalker over the subtree rooted at the specified node.
public ITreeWalker CreateTreeWalker(Node root)Parameters
root Node
node which will serve as the root for the TreeWalker. The whatToShow flags and the NodeFilter are not considered when setting this value; any node type will be accepted as the root. The currentNode of the TreeWalker is initialized to this node, whether or not it is visible. The root functions as a stopping point for traversal methods that look upward in the document structure, such as parentNode and nextNode. The root must not be null.
Returns
The newly created TreeWalker.
Exceptions
NOT_SUPPORTED_ERR: Raised if the specified root is null.
CreateTreeWalker(Node, long)
Create a new TreeWalker over the subtree rooted at the specified node.
public ITreeWalker CreateTreeWalker(Node root, long whatToShow)Parameters
root Node
node which will serve as the root for the TreeWalker. The whatToShow flags and the NodeFilter are not considered when setting this value; any node type will be accepted as the root. The currentNode of the TreeWalker is initialized to this node, whether or not it is visible. The root functions as a stopping point for traversal methods that look upward in the document structure, such as parentNode and nextNode. The root must not be null.
whatToShow long
flag specifies which node types may appear in the logical view of the tree presented by the tree-walker. See the description of NodeFilter for the set of possible SHOW_ values.These flags can be combined using OR.
Returns
The newly created TreeWalker.
Exceptions
NOT_SUPPORTED_ERR: Raised if the specified root is null.
CreateTreeWalker(Node, long, INodeFilter)
Create a new TreeWalker over the subtree rooted at the specified node.
public ITreeWalker CreateTreeWalker(Node root, long whatToShow, INodeFilter filter)Parameters
root Node
node which will serve as the root for the TreeWalker. The whatToShow flags and the NodeFilter are not considered when setting this value; any node type will be accepted as the root. The currentNode of the TreeWalker is initialized to this node, whether or not it is visible. The root functions as a stopping point for traversal methods that look upward in the document structure, such as parentNode and nextNode. The root must not be null.
whatToShow long
flag specifies which node types may appear in the logical view of the tree presented by the tree-walker. See the description of NodeFilter for the set of possible SHOW_ values.These flags can be combined using OR.
filter INodeFilter
NodeFilter to be used with this TreeWalker, or null to indicate no filter.
Returns
The newly created TreeWalker.
Exceptions
NOT_SUPPORTED_ERR: Raised if the specified root is null.
Dispose(bool)
Releases unmanaged and - optionally - managed resources.
protected override void Dispose(bool disposing)Parameters
disposing bool
true to release both managed and unmanaged resources; false to release only unmanaged resources.
Evaluate(string, Node, IXPathNSResolver, XPathResultType, object)
Evaluates an XPath expression string and returns a result of the specified type if possible.
public IXPathResult Evaluate(string expression, Node contextNode, IXPathNSResolver resolver, XPathResultType type, object result)Parameters
expression string
The XPath expression string to be parsed and evaluated.
contextNode Node
The context is context node for the evaluation of this XPath expression.
resolver IXPathNSResolver
The resolver permits translation of all prefixes, including the xml namespace prefix, within the XPath expression into appropriate namespace URIs.
type XPathResultType
If a specific type is specified, then the result will be returned as the corresponding type.
result object
The result specifies a specific result object which may be reused and returned by this method.
Returns
The result of the evaluation of the XPath expression.
GetElementById(string)
This method returns an Aspose.Html.Dom.Element object representing the element whose id property matches the specified string. Since element IDs are required to be unique if specified, they're a useful way to get access to a specific element quickly.
If you need to get access to an element which doesn't have an ID, you can use Aspose.Html.Dom.Document.QuerySelector(System.String) to find the element using any selector.
public Element GetElementById(string elementId)Parameters
elementId string
The ID of the element to locate. The ID is case-sensitive string which is unique within the document; only one element may have any given ID.
Returns
An Aspose.Html.Dom.Element object describing the DOM element object matching the specified ID, or null if no matching element was found in the document.
Remarks
Refer to official spec.
GetElementsByClassName(string)
This method returns an array-like object of all child elements which have all the given class name(s).
When called on the document object, the complete document is searched, including the root node. You may also call this method on any element; it will return only elements which are descendants of the specified root element with the given class name(s).
[DOMName("getElementsByClassName")]
public HTMLCollection GetElementsByClassName(string classNames)Parameters
classNames string
The string that contains an unordered set of unique space-separated tokens representing classes (class names)
Returns
A live Aspose.Html.Collections.HTMLCollection of found elements.
Remarks
Refer to official spec.
GetElementsByTagName(string)
This method returns an Aspose.Html.Collections.HTMLCollection of elements with the given tag name.
The complete document is searched, including the root node. The returned Aspose.Html.Collections.HTMLCollection is live, meaning that it updates itself automatically to stay in sync with the DOM tree without having to call this method again.
[DOMName("getElementsByTagName")]
public HTMLCollection GetElementsByTagName(string tagname)Parameters
tagname string
A string representing the name of the elements. The special string "*" represents all elements.
Returns
A live Aspose.Html.Collections.HTMLCollection of found elements in the order they appear in the tree.
Remarks
Refer to official spec.
GetElementsByTagNameNS(string, string)
Returns a list of elements with the given tag name belonging to the given namespace. The complete document is searched, including the root node.
[DOMName("getElementsByTagNameNS")]
public HTMLCollection GetElementsByTagNameNS(string namespaceURI, string localName)Parameters
namespaceURI string
The namespace URI of elements to look for.
localName string
Either the local name of elements to look for or the special value *, which matches all elements.
Returns
A live Aspose.Html.Collections.NodeList of found elements in the order they appear in the tree.
Remarks
Refer to official spec.
ImportNode(Node, bool)
Imports a node from another document to this document, without altering or removing the source node from the original document; this method creates a new copy of the source node.
[DOMName("importNode")]
public Node ImportNode(Node importedNode, bool deep)Parameters
importedNode Node
The imported node.
deep bool
if set to true [deep].
Returns
The Aspose.Html.Dom.Node.
Navigate(string)
Loads the document at the specified Uniform Resource Locator (URL) into the current instance, replacing the previous content.
public void Navigate(string address)Parameters
address string
The document address. It will be combined with the current directory path to form an absolute URL.
Navigate(Url)
Loads the document at the specified Uniform Resource Locator (URL) into the current instance, replacing the previous content.
public void Navigate(Url url)Parameters
url Url
The document URL.
Navigate(string, string)
Loads the document from specified content and using baseUri to resolve relative resources, replacing the previous content.
public void Navigate(string content, string baseUri)Parameters
content string
The document content.
baseUri string
The base URI to resolve relative resources. It will be combined with the current directory path to form an absolute URL.
Exceptions
baseUri is null.
Navigate(string, Url)
Loads the document from specified content and using baseUri to resolve relative resources, replacing the previous content.
public void Navigate(string content, Url baseUri)Parameters
content string
The document content.
baseUri Url
The base URI to resolve relative resources.
Exceptions
baseUri is null.
Navigate(Stream, string)
Loads the document from specified content and using baseUri to resolve relative resources, replacing the previous content. Document loading starts from the current position in the stream.
public void Navigate(Stream content, string baseUri)Parameters
content Stream
The document content.
baseUri string
The base URI to resolve relative resources. It will be combined with the current directory path to form an absolute URL.
Exceptions
baseUri is null.
Navigate(Stream, Url)
Loads the document from specified content and using baseUri to resolve relative resources, replacing the previous content. Document loading starts from the current position in the stream.
public void Navigate(Stream content, Url baseUri)Parameters
content Stream
The document content.
baseUri Url
The base URI to resolve relative resources.
Exceptions
baseUri is null.
Navigate(RequestMessage)
Loads the document based on specified request object, replacing the previous content.
public void Navigate(RequestMessage request)Parameters
request RequestMessage
The request object that is used to load document content.
Navigate(string, CancellationToken)
Loads the document at the specified Uniform Resource Locator (URL) into the current instance, replacing the previous content.
public void Navigate(string address, CancellationToken cancellationToken)Parameters
address string
The document address. It will be combined with the current directory path to form an absolute URL.
cancellationToken CancellationToken
The cancellation token.
Exceptions
Operation was cancelled.
Navigate(Url, CancellationToken)
Loads the document at the specified Uniform Resource Locator (URL) into the current instance, replacing the previous content.
public void Navigate(Url url, CancellationToken cancellationToken)Parameters
url Url
The document URL.
cancellationToken CancellationToken
The cancellation token.
Exceptions
Operation was cancelled.
Navigate(string, string, CancellationToken)
Loads the document from specified content and using baseUri to resolve relative resources, replacing the previous content.
public void Navigate(string content, string baseUri, CancellationToken cancellationToken)Parameters
content string
The document content.
baseUri string
The base URI to resolve relative resources. It will be combined with the current directory path to form an absolute URL.
cancellationToken CancellationToken
The cancellation token.
Exceptions
Operation was cancelled.
baseUri is null.
Navigate(string, Url, CancellationToken)
Loads the document from specified content and using baseUri to resolve relative resources, replacing the previous content.
public void Navigate(string content, Url baseUri, CancellationToken cancellationToken)Parameters
content string
The document content.
baseUri Url
The base URI to resolve relative resources.
cancellationToken CancellationToken
The cancellation token.
Exceptions
Operation was cancelled.
baseUri is null.
Navigate(Stream, string, CancellationToken)
Loads the document from specified content and using baseUri to resolve relative resources, replacing the previous content. Document loading starts from the current position in the stream.
public void Navigate(Stream content, string baseUri, CancellationToken cancellationToken)Parameters
content Stream
The document content.
baseUri string
The base URI to resolve relative resources. It will be combined with the current directory path to form an absolute URL.
cancellationToken CancellationToken
The cancellation token.
Exceptions
Operation was cancelled.
baseUri is null.
Navigate(Stream, Url, CancellationToken)
Loads the document from specified content and using baseUri to resolve relative resources, replacing the previous content. Document loading starts from the current position in the stream.
public void Navigate(Stream content, Url baseUri, CancellationToken cancellationToken)Parameters
content Stream
The document content.
baseUri Url
The base URI to resolve relative resources.
cancellationToken CancellationToken
The cancellation token.
Exceptions
Operation was cancelled.
baseUri is null.
Navigate(RequestMessage, CancellationToken)
Loads the document based on specified request object, replacing the previous content.
public void Navigate(RequestMessage request, CancellationToken cancellationToken)Parameters
request RequestMessage
The request object that is used to load document content.
cancellationToken CancellationToken
The cancellation token.
Exceptions
Operation was cancelled.
QuerySelector(string)
Returns the first Element in document, which match selector
public Element QuerySelector(string selector)Parameters
selector string
The selector.
Returns
The matched node.
QuerySelectorAll(string)
Returns a NodeList of all the Elements in document, which match selector
public NodeList QuerySelectorAll(string selector)Parameters
selector string
The query selector
Returns
Aspose.Html.Collections.HTMLCollection
RenderTo(IDevice)
This method is used to render the contents of the current document to a specified graphical device.
public virtual void RenderTo(IDevice device)Parameters
device IDevice
The user device.
Write(params string[])
Write a string of text to a document stream opened by open(). Note that the function will produce a document which is not necessarily driven by a DTD and therefore might be produce an invalid result in the context of the document.
[DOMName("write")]
public void Write(params string[] texts)Parameters
texts string
[]
The string to be parsed into some structure in the document structure model.
WriteLn(params string[])
Write a string of text followed by a newline character to a document stream opened by open(). Note that the function will produce a document which is not necessarily driven by a DTD and therefore might be produce an invalid result in the context of the document
[DOMName("writeln")]
public void WriteLn(params string[] texts)Parameters
texts string
[]
The string to be parsed into some structure in the document structure model.
OnAbort
Gets or sets event handler for OnAbort event.
public event DOMEventHandler OnAbortEvent Type
OnBlur
Gets or sets event handler for OnBlur event.
public event DOMEventHandler OnBlurEvent Type
OnCanPlayThrough
Gets or sets event handler for OnCanPlayThrough event.
public event DOMEventHandler OnCanPlayThroughEvent Type
OnCancel
Gets or sets event handler for OnCancel event.
public event DOMEventHandler OnCancelEvent Type
OnCanplay
Gets or sets event handler for OnCanplay event.
public event DOMEventHandler OnCanplayEvent Type
OnChange
Gets or sets event handler for OnChange event.
public event DOMEventHandler OnChangeEvent Type
OnClick
Gets or sets event handler for OnClick event.
public event DOMEventHandler OnClickEvent Type
OnCueChange
Gets or sets event handler for OnCueChange event.
public event DOMEventHandler OnCueChangeEvent Type
OnDblClick
Gets or sets event handler for OnDblClick event.
public event DOMEventHandler OnDblClickEvent Type
OnDurationChange
Gets or sets event handler for OnDurationChange event.
public event DOMEventHandler OnDurationChangeEvent Type
OnEmptied
Gets or sets event handler for OnEmptied event.
public event DOMEventHandler OnEmptiedEvent Type
OnEnded
Gets or sets event handler for OnEnded event.
public event DOMEventHandler OnEndedEvent Type
OnError
Gets or sets event handler for OnError event.
public event DOMEventHandler OnErrorEvent Type
OnFocus
Gets or sets event handler for OnFocus event.
public event DOMEventHandler OnFocusEvent Type
OnInput
Gets or sets event handler for OnInput event.
public event DOMEventHandler OnInputEvent Type
OnInvalid
Gets or sets event handler for OnInvalid event.
public event DOMEventHandler OnInvalidEvent Type
OnKeyDown
Gets or sets event handler for OnKeyDown event.
public event DOMEventHandler OnKeyDownEvent Type
OnKeyPress
Gets or sets event handler for OnKeyPress event.
public event DOMEventHandler OnKeyPressEvent Type
OnKeyUp
Gets or sets event handler for OnKeyUp event.
public event DOMEventHandler OnKeyUpEvent Type
OnLoad
Gets or sets event handler for OnLoad event.
public event DOMEventHandler OnLoadEvent Type
OnLoadStart
Gets or sets event handler for OnLoadStart event.
public event DOMEventHandler OnLoadStartEvent Type
OnLoadedData
Gets or sets event handler for OnLoadedData event.
public event DOMEventHandler OnLoadedDataEvent Type
OnLoadedMetadata
Gets or sets event handler for OnLoadedMetadata event.
public event DOMEventHandler OnLoadedMetadataEvent Type
OnMouseDown
Gets or sets event handler for OnMouseDown event.
public event DOMEventHandler OnMouseDownEvent Type
OnMouseEnter
Gets or sets event handler for OnMouseEnter event.
public event DOMEventHandler OnMouseEnterEvent Type
OnMouseLeave
Gets or sets event handler for OnMouseLeave event.
public event DOMEventHandler OnMouseLeaveEvent Type
OnMouseMove
Gets or sets event handler for OnMouseMove event.
public event DOMEventHandler OnMouseMoveEvent Type
OnMouseOut
Gets or sets event handler for OnMouseOut event.
public event DOMEventHandler OnMouseOutEvent Type
OnMouseOver
Gets or sets event handler for OnMouseOver event.
public event DOMEventHandler OnMouseOverEvent Type
OnMouseUp
Gets or sets event handler for OnMouseUp event.
public event DOMEventHandler OnMouseUpEvent Type
OnMouseWheel
Gets or sets event handler for OnMouseWheel event.
public event DOMEventHandler OnMouseWheelEvent Type
OnPause
Gets or sets event handler for OnPause event.
public event DOMEventHandler OnPauseEvent Type
OnPlay
Gets or sets event handler for OnPlay event.
public event DOMEventHandler OnPlayEvent Type
OnPlaying
Gets or sets event handler for OnPlaying event.
public event DOMEventHandler OnPlayingEvent Type
OnProgress
Gets or sets event handler for OnProgress event.
public event DOMEventHandler OnProgressEvent Type
OnRateChange
Gets or sets event handler for OnRateChange event.
public event DOMEventHandler OnRateChangeEvent Type
OnReadyStateChange
Gets or sets event handler for OnReadyStateChange event.
public event DOMEventHandler OnReadyStateChangeEvent Type
OnReset
Gets or sets event handler for OnReset event.
public event DOMEventHandler OnResetEvent Type
OnResize
Gets or sets event handler for OnResize event.
public event DOMEventHandler OnResizeEvent Type
OnScroll
Gets or sets event handler for OnScroll event.
public event DOMEventHandler OnScrollEvent Type
OnSeeked
Gets or sets event handler for OnSeeked event.
public event DOMEventHandler OnSeekedEvent Type
OnSeeking
Gets or sets event handler for OnSeeking event.
public event DOMEventHandler OnSeekingEvent Type
OnSelect
Gets or sets event handler for OnSelect event.
public event DOMEventHandler OnSelectEvent Type
OnShow
Gets or sets event handler for OnShow event.
public event DOMEventHandler OnShowEvent Type
OnStalled
Gets or sets event handler for OnStalled event.
public event DOMEventHandler OnStalledEvent Type
OnSubmit
Gets or sets event handler for OnSubmit event.
public event DOMEventHandler OnSubmitEvent Type
OnSuspend
Gets or sets event handler for OnSuspend event.
public event DOMEventHandler OnSuspendEvent Type
OnTimeUpdate
Gets or sets event handler for OnTimeUpdate event.
public event DOMEventHandler OnTimeUpdateEvent Type
OnToggle
Gets or sets event handler for OnToggle event.
public event DOMEventHandler OnToggleEvent Type
OnVolumeChange
Gets or sets event handler for OnVolumeChange event.
public event DOMEventHandler OnVolumeChangeEvent Type
OnWaiting
Gets or sets event handler for OnWaiting event.
public event DOMEventHandler OnWaiting