om.DomNode.createChild

Creates and adds a node at the end of the list of children in the current node.

Syntax

createChild(
   tagName STRING )
  RETURNS om.DomNode
  1. tagName is the tag name of the new node.

Usage

The createChild() method creates a new om.DomNode element with the tag name passed as parameter, and adds it at the end of the children of the object node calling the method.

The method returns the reference to the created object.

Note: When using the string "@chars" as tag name, the createChild() method creates an XML text node. To set/get the value of a text node, use the "@chars" as attribute name with setAttribute()/getAttribute(). Alternatively, the createChars() method of the om.DomDocument class can be used, to create a text node and set the value in a single step.

Example

DEFINE parent, child om.DomNode
...
LET child = parent.createChild("Item")

For a complete example, see Example 1: Creating a DOM tree.