Next / Previous / Contents / Shipman's homepage

17.2. Photo.readNode() (static method)

birdnotes.py
# - - -   P h o t o . r e a d N o d e

    @staticmethod
    def readNode(node):
        """Convert from XML.
        """
        #-- 1 --
        # [ catNo  :=  node's rnc.CAT_NO_A attribute ]
        catNo = node.attrib[rnc.CAT_NO_A]

        #-- 2 --
        # [ if node has an rnc.URL_A attribute ->
        #     url  :=  that attribute's value
        #   else ->
        #     url  :=  None ]
        url = node.attrib.get(rnc.URL_A, None)

Note that node.text will be None if there was no content in the photo element. See Section 17.1, “Photo.__init__().

birdnotes.py
        #-- 3 --
        return  Photo(catNo, url, node.text)