AddChild - Maple Help
For the best experience, we recommend viewing online help using Google Chrome or Mozilla Firefox.

Online Help

All Products    Maple    MapleSim


XMLTools

  

AddChild

  

add a child element to an XML element

 

Calling Sequence

Parameters

Description

Examples

Calling Sequence

AddChild(xmlTree, child, n)

Parameters

xmlTree

-

Maple XML tree; XML element

child

-

string or XML element; child element to add to the xmlTree

n

-

nonnegative integer; position after which the child element is added

Description

• 

The AddChild(xmlTree, child, n) command creates a new XML element from xmlTree by inserting the XML element child after the position indicated by n. Parameter n must be less than or equal to the number of children in the original tree xmlTree. The new child node child becomes the n + 1st child of the resulting tree.

Examples

> 

with⁡XMLTools:

> 

x≔XMLElement⁡a,,some text,XMLElement⁡b,,more text,XMLElement⁡c

x≔_XML_Element⁡_XML_ElementType⁡a,,_XML_Text⁡some text,_XML_Element⁡_XML_ElementType⁡b,,_XML_Text⁡more text,_XML_Element⁡_XML_ElementType⁡c,,

(1)
> 

useXMLToolsinforifrom0toContentModelCount⁡xdoprint⁡AddChild⁡x,XMLElement⁡d,,some child text,iend doend use

_XML_Element⁡_XML_ElementType⁡a,,_XML_Element⁡_XML_ElementType⁡d,,_XML_Text⁡some child text,_XML_Text⁡some text,_XML_Element⁡_XML_ElementType⁡b,,_XML_Text⁡more text,_XML_Element⁡_XML_ElementType⁡c,,

_XML_Element⁡_XML_ElementType⁡a,,_XML_Text⁡some text,_XML_Element⁡_XML_ElementType⁡d,,_XML_Text⁡some child text,_XML_Element⁡_XML_ElementType⁡b,,_XML_Text⁡more text,_XML_Element⁡_XML_ElementType⁡c,,

_XML_Element⁡_XML_ElementType⁡a,,_XML_Text⁡some text,_XML_Element⁡_XML_ElementType⁡b,,_XML_Text⁡more text,_XML_Element⁡_XML_ElementType⁡d,,_XML_Text⁡some child text,_XML_Element⁡_XML_ElementType⁡c,,

_XML_Element⁡_XML_ElementType⁡a,,_XML_Text⁡some text,_XML_Element⁡_XML_ElementType⁡b,,_XML_Text⁡more text,_XML_Element⁡_XML_ElementType⁡c,,,_XML_Element⁡_XML_ElementType⁡d,,_XML_Text⁡some child text

(2)

See Also

XMLTools

XMLTools[ContentModelCount]

XMLTools[FirstChild]

XMLTools[GetChild]

XMLTools[HasChild]

XMLTools[RemoveChild]