Given a parent node, this method attaches sighting-notes content from the instance to that
parent. See Section 16.7, “SightNotes.writeChild(): Attach
narrative to a child”.
# - - - S i g h t N o t e s . w r i t e N o d e
def writeNode(self, parent):
"""Translate to XML.
"""
#-- 1 --
# [ if self.desc is not None ->
# parent := parent with a new rnc.DESC_N child
# attached containing self.desc
# else -> I ]
self.writeChild(parent, rnc.DESC_N, self.desc)
The other optional single items are handled similarly.
#-- 2 --
# [ simile ]
self.writeChild(parent, rnc.BEHAVIOR_N, self.behavior)
#-- 3 --
self.writeChild(parent, rnc.VOC_N, self.voc)
#-- 4 --
self.writeChild(parent, rnc.BREEDING_N, self.breeding)
There may be any number of photo children;
see Section 17.3, “Photo.writeNode()”.
#-- 5 --
if len(self._photoList):
for photo in self._photoList:
photo.writeNode(parent)
If the .notes attribute is not None, it contains a Narrative instance, which is
added to the tree using Section 18.6, “Narrative.writeNode(): Write as XML”.
#-- 6 --
if self.notes:
self.notes.writeNode(parent)