Ingest a resource and store data in its instance

        :param resource: XML node cRefPattern or list of them in ASC hierarchy order (deepest to highest, eg. lines to poem to book)
        :type resource: [lxml.etree._Element]
        :param xpath: XPath to use to retrieve citation
        :type xpath: str

        :returns: A citation object
        :rtype: Citation

def ingest(resource, xpath=".//tei:cRefPattern"):
        """ Ingest a resource and store data in its instance

        :param resource: XML node cRefPattern or list of them in ASC hierarchy order (deepest to highest, eg. lines to poem to book)
        :type resource: [lxml.etree._Element]
        :param xpath: XPath to use to retrieve citation
        :type xpath: str

        :returns: A citation object
        :rtype: Citation
        """
        if len(resource) == 0 and isinstance(resource, list):
            return None
        elif isinstance(resource, list):
            resource = resource[0]
        elif not isinstance(resource, _Element):
            return None

        resource = resource.xpath(xpath, namespaces=XPATH_NAMESPACES)
        citations = []

        for x in range(0, len(resource)):
            citations.append(
                Citation(
                    name=resource[x].get("n"),
                    refsDecl=resource[x].get("replacementPattern")[7:-1],
                    child=_child_or_none(citations)
                )
            )
        if len(citations) > 1:
            for citation in citations[:-1]:
                citation.root = citations[-1]
        return citations[-1]