def generate_catalog(xsd_schemas=None, xmlcatalog_dir=None, xmlcatalog_file=None):
<EOL>if requests is None:<EOL><INDENT>sys.stderr.write(req_requests_msg)<EOL>return<EOL><DEDENT>logger.debug("<STR_LIT>")<EOL>if xsd_schemas is None:<EOL><INDENT>xsd_schemas = XSD_SCHEMAS<EOL><DEDENT>if xmlcatalog_file is None:<EOL><INDENT>xmlcatalog_file = XMLCATALOG_FILE<EOL><DEDENT>if xmlcatalog_dir is None:<EOL><INDENT>xmlcatalog_dir = XMLCATALOG_DIR<EOL><DEDENT>if not os.path.isdir(xmlcatalog_dir):<EOL><INDENT>os.mkdir(xmlcatalog_dir)<EOL><DEDENT>catalog = Catalog()<EOL>comment = '<STR_LIT>' %(__version__, date.today().isoformat())<EOL>for schema_uri in xsd_schemas:<EOL><INDENT>filename = os.path.basename(schema_uri)<EOL>schema_path = os.path.join(xmlcatalog_dir, filename)<EOL>saved = download_schema(schema_uri, schema_path, comment)<EOL>if saved:<EOL><INDENT>catalog.uri_list.append(Uri(name=schema_uri, uri=filename))<EOL><DEDENT><DEDENT>if catalog.uri_list:<EOL><INDENT>with open(xmlcatalog_file, '<STR_LIT:wb>') as xml_catalog:<EOL><INDENT>catalog.serializeDocument(xml_catalog, pretty=True)<EOL><DEDENT><DEDENT>return catalog<EOL>
Generating an XML catalog for use in resolving schemas

    Creates the XML Catalog directory if it doesn't already exist.
    Uses :meth:`download_schema` to save local copies of schemas,
    adding a comment indicating the date downloaded by eulxml.

    Generates a new catalog.xml file, with entries for all schemas
    that downloaded successfully.  If no schemas downloaded, the catalog
    is not generated.

    .. Note::

        Currently this method overwites any existing schema and catalog
        files, without checking if they are present or need to be
        updated.