This is a utility function used to attach the various
child elements in the sighting-notes pattern.
# - - - S i g h t N o t e s . w r i t e C h i l d
def writeChild ( self, parent, childName, narr ):
"""Attach a child and put narrative into it.
[ (parent is an et.Element) and
(childName is an element name as a string) and
(narr is a Narrative instance or None) ->
if narr is not None ->
parent := parent with a new child named (childName)
attached, containing narr ]
else -> I ]
"""
#-- 1 --
if narr is None:
return
#-- 2 --
# [ parent := parent with a new childName child added
# child := that new child ] See Section 12.1, “Sighting.__init__()”.
child = et.SubElement ( parent, childName )
See Section 17.6, “Narrative.writeNode(): Write as XML”.
#-- 3 --
# [ child := child with narr added ]
narr.writeNode ( child )