add a child element to an XML element - Maple Help

Online Help

All Products    Maple    MapleSim

Home : Support : Online Help : Connectivity : Web Features : XMLTools : XMLTools/AddChild

XMLTools[AddChild] - add a child element to an XML element

Calling Sequence

AddChild(xmlTree, child, n)




Maple XML tree; XML element



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



positive integer; position where the child element is added



The AddChild(xmlTree, child, n) command creates a new XML element from xmlTree by inserting the XML element child at 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.



x:=XMLElementa,,some text,XMLElementb,,more text,XMLElementc

x:=_XML_Element_XML_ElementTypea,,_XML_Textsome text,_XML_Element_XML_ElementTypeb,,_XML_Textmore text,_XML_Element_XML_ElementTypec,,


useXMLToolsinforifrom0toContentModelCountxdoprintAddChildx,XMLElementd,,some child text,iend doend use

_XML_Element_XML_ElementTypea,,_XML_Element_XML_ElementTyped,,_XML_Textsome child text,_XML_Textsome text,_XML_Element_XML_ElementTypeb,,_XML_Textmore text,_XML_Element_XML_ElementTypec,,

_XML_Element_XML_ElementTypea,,_XML_Textsome text,_XML_Element_XML_ElementTyped,,_XML_Textsome child text,_XML_Element_XML_ElementTypeb,,_XML_Textmore text,_XML_Element_XML_ElementTypec,,

_XML_Element_XML_ElementTypea,,_XML_Textsome text,_XML_Element_XML_ElementTypeb,,_XML_Textmore text,_XML_Element_XML_ElementTyped,,_XML_Textsome child text,_XML_Element_XML_ElementTypec,,

_XML_Element_XML_ElementTypea,,_XML_Textsome text,_XML_Element_XML_ElementTypeb,,_XML_Textmore text,_XML_Element_XML_ElementTypec,,,_XML_Element_XML_ElementTyped,,_XML_Textsome child text


See Also

XMLTools, XMLTools[ContentModelCount], XMLTools[FirstChild], XMLTools[GetChild], XMLTools[HasChild], XMLTools[RemoveChild]

Download Help Document

Was this information helpful?

Please add your Comment (Optional)
E-mail Address (Optional)
What is ? This question helps us to combat spam