Next / Previous / Contents / Shipman's homepage

6.17. UniBlock.__init__()

The constructor dissassembles the subtree that defines a block. From charlist.rnc:

block = element block {
  attribute start { text },  # Inclusive, e.g., "02200"
  attribute end { text },    # Inclusive, e.g., "022FF"
  attribute name { text }    # E.g., "Mathematical Operators"
}

For the definitions of the attribute names, see Section 6.3, “unidata: Manifest constants”.

unidata.py
# - - -   U n i B l o c k . _ _ i n i t _ _

    def __init__(self, node):
        '''Constructor.
        '''
        self.name = node.attrib[NAME_A]
        self.start = int(node.attrib[START_A], 16)
        self.end = int(node.attrib[END_A], 16)