Difference between revisions of "Extensions.Xml.AddXmlChildElement"

From emotive
Jump to navigation Jump to search
 
(One intermediate revision by the same user not shown)
Line 5: Line 5:
 
== OTL Syntax ==
 
== OTL Syntax ==
 
<syntaxhighlight lang="java" enclose="div" style="font-size: medium;">
 
<syntaxhighlight lang="java" enclose="div" style="font-size: medium;">
Xml.AddXmlChildElement(XmlElementTerm, XmlElementTerm, XmlElementTerm);
+
Xml.AddXmlChildElement(XmlElementTerm parent, XmlElementTerm child, XmlElementTerm insertBefore);
 
</syntaxhighlight>
 
</syntaxhighlight>
  
Line 21: Line 21:
 
== OTL Examples ==
 
== OTL Examples ==
 
<syntaxhighlight lang="java" enclose="div" style="font-size: medium;">
 
<syntaxhighlight lang="java" enclose="div" style="font-size: medium;">
 +
/// Local Declarations
 +
 
Xml.XmlElement XmlElement1;
 
Xml.XmlElement XmlElement1;
 
Xml.XmlElement XmlElement2;
 
Xml.XmlElement XmlElement2;

Latest revision as of 04:54, 8 November 2018

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