Extensions.Xml.AddXmlChildElement

From emotive
Jump to navigation Jump to search

Classification

Name AddXmlChildElement
Short Description Adds a child to a parent
Class Action
Extension OTX Xml extension
Group Xml related Actions
Exceptions XmlChangeException
Checker Rules -
Standard Compliant Yes

OTL Syntax

Xml.AddXmlChildElement(XmlElementTerm parent, XmlElementTerm child, XmlElementTerm insertBefore);

Description

The AddXmlChildElement action is used to add a child to a parent. If this element has already been added to another parent or it is used as a root node, the XmlException shall be thrown and the element is not added to the parent.

Properties

Name Data Type Class Default Cardinality Description
Child XmlElement Term - [1..1] The element that is added to the parent.
InsertBefore XmlElement Term - [0..1] Optional element. If omitted, the new child element is added at the last element of the parent otherwise before the element described here.
Parent XmlElement Term - [1..1] The element to which the child element is added.

OTL Examples

/// Local Declarations

Xml.XmlElement XmlElement1;
Xml.XmlElement XmlElement2;

/// Flow

XmlElement1 = Xml.CreateXmlElement("root", "text", {"attr":"val"});
XmlElement2 = Xml.CreateXmlElement("child", "childtext", {"attr1":"val1"});
Xml.AddXmlChildElement(XmlElement1, XmlElement2);

See also

DeleteXmlAttribute
DeleteXmlChildElement
SetXmlComment
SetXmlElementAttribute
SetXmlElementAttributes
SetXmlElementText
SetXmlProcessingInstructions
ValidateXml
XmlSaveToFile