'Find references inside the document.'

def _find_references(self, tag, tag_name, attrs):

    filter_ref = self._filter_ref
    base_url = self._base_url
    decode_url = self._decode_url
    for (_, url_path) in filter(filter_ref, attrs.iteritems()):
        try:
            url_path = decode_url(url_path)
            url = base_url.url_join(url_path, encoding=self._encoding)
        except ValueError:
            msg = 'Ignoring    URL    "%s"    as    it    generated    an    invalid    URL.'
            om.out.debug((msg % url_path))
        else:
            self._tag_and_url.add((tag_name, url))
