# - - - B i r d F o r m . w r i t e S i n g l e
def writeSingle(self, formNode):
"""Generate XML for a single sighting.
[ formNode is an et.Element ->
formNode +:= form node with age-sex-group, loc-group,
and sighting-notes content added from that sighting ]
"""
#-- 1 --
sighting = self._sightingList[0]
For each of the three content groups, we add the XML using
the appropriate .writeNode() method. See
Section 15.3, “AgeSexGroup.writeNode()”,
Section 14.4, “LocGroup.writeNode(): Translate to
XML”, and
Section 16.6, “SightNotes.writeNode()”.
#-- 1 --
# [ if sighting.ageSexGroup ->
# formNode := formNode with age-sex-group content
# added from sighting
# else -> I ]
if sighting.ageSexGroup:
sighting.ageSexGroup.writeNode(formNode)
#-- 2 --
# [ if sighting.locGroup ->
# formNode := formNode with loc-group content
# added from sighting
# else -> I ]
if sighting.locGroup:
sighting.locGroup.writeNode(formNode)
#-- 3 --
# [ if sighting.sightNotes ->
# formNode := formNode with sighting-notes content
# added from sighting
# else -> I ]
if sighting.sightNotes:
sighting.sightNotes.writeNode(formNode)