def parse_data_types_from_doc_ref(api, doc, namespace_context, ignore_missing_entries=False):
output = []<EOL>data_types, routes_by_ns = parse_data_types_and_routes_from_doc_ref(<EOL>api, doc, namespace_context, ignore_missing_entries=ignore_missing_entries)<EOL>for d in data_types:<EOL><INDENT>output.append(d)<EOL><DEDENT>for ns_name, routes in routes_by_ns.items():<EOL><INDENT>try:<EOL><INDENT>ns = api.namespaces[ns_name]<EOL>for r in routes:<EOL><INDENT>for d in ns.get_route_io_data_types_for_route(r):<EOL><INDENT>output.append(d)<EOL><DEDENT><DEDENT><DEDENT>except KeyError:<EOL><INDENT>if not ignore_missing_entries:<EOL><INDENT>raise<EOL><DEDENT><DEDENT><DEDENT>return output<EOL>
Given a documentation string, parse it and return all references to other
data types. If there are references to routes, include also the data types of
those routes.

Args:
- api: The API containing this doc ref.
- doc: The documentation string to parse.
- namespace_context: The namespace name relative to this documentation.
- ignore_missing_entries: If set, this will skip references to nonexistent data types instead
                          of raising an exception.

Returns:
- a list of referenced data types