Method XmlNode():createElement() Foundation

Creates an element node.

Syntax
CLASS METHOD :createElement( <cName> [,<cContent>] [,<aAttributes>] ) --> oXmlNode
Parameters
<cName>
A character string with the node name to be used for the node.
<cContent>
A character string with the content value. This parameter is optional. If nothing is specified in the <cContent> parameter, the new node has no content defined.
<aAttributes>
An array that specifies the attributes to be defined for the new node. The attributes may be specified either using a sub-array with attribute data, or via a DataObject that has the required information assigned to its member variables. This parameter is optional. If nothing is specified in the <aAttributes> parameter, the new node has no attributes defined.
In case arrays are to be used to define the attributes, a sub-array of the following format must be added for each attribute to the array in <aAttributes>:
{<cName>,<cValue>[,<cNamespace>]}
<cName> is the name of the attribute, and <cValue> specifies the attribute's value. If the attribute belongs to a certain namespace, the namespace name must be specified in the optional third array element.
As an alternative to using sub-arrays, the attributes of the new element node may also be specified using a DataObject. In this case, a DataObject with the following member variables must be assigned for each attribute to the array in <aAttributes>.
Members of the DataObjects in <aAttributes>
Name Data Type Description
name C Name of the attribute
value C Attribute value
namespace C Namespace the attribute belongs to
Return

An XmlNode() object representing the new element node.

Description

The method :createElement() creates an element node using the specified node name, attributes and content. The element node returned by :createElement() is not associated with any other node. Instead, it must be added to an existing node or document node using the :addChild() method.

Feedback

If you see anything in the documentation that is not correct, does not match your experience with the particular feature or requires further clarification, please use this form to report a documentation issue.