%XML_ELEM_ADDCHILDREN

Add child elements to an XML element

WTSupported in traditional Synergy on Windows
WNSupported in Synergy .NET on Windows
USupported on UNIX
VSupported on OpenVMS
status = %XML_ELEM_ADDCHILDREN(parent, elem_list)

Return value

status

One of the following values:

XML_SUCCESS = child elements are added successfully.

XML_FAIL = The child elements are not added successfully.

Arguments

parent

The XML element instance to which one or more children will be added. (XML_ELEM_TYPE)

elem_list

A list of child elements that will be added to the parent. (XML_ELEMLIST_TYPE)

Discussion

%XML_ELEM_ADDCHILDREN adds each of the XML elements in the specified list of child elements to the specified parent element. These children are appended to any existing children already in the parent.

This function is defined as ^VAL.

Examples

The following example adds two new children to the root element.

    doc         ,XML_DOC_TYPE
    root        ,XML_ELEM_TYPE
    elem1       ,XML_ELEM_TYPE
    elem2       ,XML_ELEM_TYPE
    elemlist    ,XML_ELEMLIST_TYPE

    root = %xml_doc_getroot(doc)

    elemlist = %xml_elemlist_create()
    elem1=%xml_elem_create()
    elem2=%xml_elem_create()

    xcall xml_elem_setname(elem1, "JavaCity")
    xcall xml_elem_setattribute(elem1, "location", "California")
    xcall xml_elemlist_add(elemlist, elem1)

    xcall xml_elem_setname(elem2, "SeattlesBest")
    xcall xml_elem_setattribute(elem2, "location", "Washington")
    xcall xml_elemlist_add(elemlist, elem2)

    xcall xml_elem_addchildren(root, elemlist)