DOMParser extension type
The DOMParser
interface provides
the ability to parse or source code from a
string into a DOM Document.
You can perform the opposite operation—converting a DOM tree into XML or HTML source—using the XMLSerializer interface.
In the case of an HTML document, you can also replace portions of the DOM with new DOM trees built from HTML by setting the value of the Element.innerHTML and Element.outerHTML properties. These properties can also be read to fetch HTML fragments corresponding to the corresponding DOM subtree.
Note that XMLHttpRequest can parse XML and HTML directly
from a URL-addressable resource, returning a Document
in its
XMLHttpRequest.response property.
Note: Be aware that block-level elements like
<p>
will be automatically closed if another block-level element is nested inside and therefore parsed before the closing</p>
tag.
- on
- Implemented types
- Available extensions
Constructors
- DOMParser()
-
factory
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
parseFromString(
String string, DOMParserSupportedType type) → Document -
The
parseFromString()
method of the DOMParser interface parses a string containing either HTML or XML, returning anHTMLDocument
or an XMLDocument. -
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited