Parse numbering document.

    Numbering is defined in file 'numbering.xml'.

def parse_numbering(document, xmlcontent):
    """Parse numbering document.

    Numbering is defined in file 'numbering.xml'.
    """

    numbering = etree.fromstring(xmlcontent)

    document.abstruct_numbering = {}
    document.numbering = {}

    for abstruct_num in numbering.xpath('.//w:abstractNum', namespaces=NAMESPACES):
        numb = {}
        for lvl in abstruct_num.xpath('./w:lvl', namespaces=NAMESPACES):
            ilvl = int(lvl.attrib[_name('{{{w}}}ilvl')])

            fmt = lvl.find(_name('{{{w}}}numFmt'))
            numb[ilvl] = {'numFmt': fmt.attrib[_name('{{{w}}}val')]}

        document.abstruct_numbering[abstruct_num.attrib[_name('{{{w}}}abstractNumId')]] = numb

    for num in numbering.xpath('.//w:num', namespaces=NAMESPACES):
        num_id = num.attrib[_name('{{{w}}}numId')]

        abs_num = num.find(_name('{{{w}}}abstractNumId'))

        if abs_num is not None:
            number_id = abs_num.attrib[_name('{{{w}}}val')]
            document.numbering[int(num_id)] = number_id