Next / Previous / Contents / Shipman's homepage

6.7. BirdNoteSet.__readDayNotes(): Read one day-notes node

The node argument is a day-notes node as an Element node. This method processes the content of that subtree, converting it to a DayNotes object, and adding it to self.

birdnotes.py
# - - -   B i r d N o t e S e t . _ _ r e a d D a y N o t e s

    def __readDayNotes ( self, dayNode ):
        """Convert a DAY_NOTES_N node to a DayNotes object.

          [ dayNode is a DAY_NOTES_N node as a DOM Element ->
              if dayNode is valid ->
                self.__dayList  +:=  a new DayNotes element made
                                     from dayNode
              else -> raise IOError ]
        """

To convert the node into a DayNotes object, we use the static method Section 7.9, “DayNotes.readNode(): XML to internal form”. It may raise IOError if there are any validity problems anywhere in the node's subtree. If everything goes well, we add the new instance to self.__dayList.

birdnotes.py
        #-- 1 --
        # [ if dayNode is a valid DAY_NOTES_N node ->
        #     dayNotes  :=  a DayNotes object representing dayNode
        #   else -> raise IOError ]
        dayNotes  =  DayNotes.readNode ( self, self.txny, dayNode )

        #-- 2 --
        self.addDay ( dayNotes )