blockly > utils > xml > textToDom
utils.xml.textToDom() function
Converts an XML string into a DOM structure.
Control characters should be escaped. (But we will try to best-effort parse unescaped characters.)
Note that even when escaped, U+0000 will be parsed as U+FFFD (the "replacement character") because U+0000 is never a valid XML character (even in XML 1.1). https://www.w3.org/TR/xml11/#charsets
Signature:
export declare function textToDom(text: string): Element;
Parameters
| Parameter | Type | Description |
|---|---|---|
| text | string | An XML string. |
Returns:
Element
A DOM object representing the singular child of the document element.
Exceptions
if the text doesn't parse.