Parse endnotes document.

    Endnotes are defined in file 'endnotes.xml'

def parse_endnotes(document, xmlcontent):
    """Parse endnotes document.

    Endnotes are defined in file 'endnotes.xml'
    """

    endnotes = etree.fromstring(xmlcontent)
    document.endnotes = {}

    for note in endnotes.xpath('.//w:endnote', namespaces=NAMESPACES):
        paragraphs = [parse_paragraph(document, para) for para in note.xpath('.//w:p', namespaces=NAMESPACES)]

        document.endnotes[note.attrib[_name('{{{w}}}id')]] = paragraphs