Next / Previous / Contents / Shipman's homepage

14.5. subElement(): Add a child element

See Section 13.4, “subElement(): Adding a child element”.

etbuilder.py
# - - -   s u b E l e m e n t

def subElement(parent, child):
    '''Add a child node to the parent and return the child.

      [ (parent is an Element) and
        (child is an Element with no parent) ->
          parent  :=  parent with child added as its new last child
          return child ]
    '''
    #-- 1 --
    parent.append(child)

    #-- 2 --
    return child