See the 2022 Blockly Developer Summit site here.

Namespace: xml

Property

NAME_SPACE

constant   static

Namespace for Blockly's XML.

Methods

createElement

static

createElement(tagName) returns Element

Create DOM element for XML.

Parameter

tagName

string

Name of DOM element.

Returns

non-null Element New DOM element.

createTextNode

static

createTextNode(text) returns Text

Create text element for XML.

Parameter

text

string

Text content.

Returns

non-null Text New DOM text node.

domToText

static

domToText(dom) returns string

Converts a DOM structure into plain text. Currently the text format is fairly ugly: all one line with no whitespace.

Parameter

dom

Node

A tree of XML nodes.

Value must not be null.

Returns

string Text representation.

getDocument

static

getDocument() returns Document

Get the document object to use for XML serialization.

Returns

non-null Document The document object.

setDocument

static

setDocument(document)

Get the document object to use for XML serialization.

Parameter

document

Document

The document object to use.

Value must not be null.

textToDomDocument

static

textToDomDocument(text) returns Document

Converts an XML string into a DOM tree.

Parameter

text

string

XML string.

Throws

if XML doesn't parse.

Returns

Document The DOM document.