b'\n_START_ARTICLE_\nXML katalog\n_START_PARAGRAPH_\nXML katalog je dokument popisuj\xc3\xadc\xc3\xad korespondenci mezi odkazy na extern\xc3\xad entity a jejich lok\xc3\xa1ln\xc4\x9b dostupn\xc3\xbdmi ekvivalenty. XML katalog je pou\xc5\xbe\xc3\xadv\xc3\xa1n XML resolverem pro zp\xc5\x99\xc3\xadstupn\xc4\x9bn\xc3\xad lok\xc3\xa1ln\xc4\x9b ulo\xc5\xbeen\xc3\xbdch defini\xc4\x8dn\xc3\xadch soubor\xc5\xaf v p\xc5\x99\xc3\xadpad\xc4\x9b nedostupnosti s\xc3\xadt\xc4\x9b._NEWLINE_XML dokumenty se zpravidla odkazuj\xc3\xad na extern\xc3\xad entity, nap\xc5\x99\xc3\xadklad ve\xc5\x99ejn\xc3\xa9 a/nebo syst\xc3\xa9mov\xc3\xa9 ID pro definice typu dokumentu. Tyto extern\xc3\xad vztahy se vyj\xc3\xa1d\xc5\x99uj\xc3\xad pomoc\xc3\xad identifik\xc3\xa1tor\xc5\xaf URI, kter\xc3\xa9 jsou typicky URL._NEWLINE_Absolutn\xc3\xad URL budou fungovat, pouze pokud jsou dosa\xc5\xbeiteln\xc3\xa9 z va\xc5\xa1\xc3\xad s\xc3\xadt\xc4\x9b. Kv\xc5\xafli odkaz\xc5\xafm na nelok\xc3\xa1ln\xc3\xad prost\xc5\x99edky je zpracov\xc3\xa1n\xc3\xad XML citliv\xc3\xa9 na pl\xc3\xa1novan\xc3\xa9 i nepl\xc3\xa1novan\xc3\xa9 v\xc3\xbdpadky s\xc3\xadt\xc4\x9b._NEWLINE_Naopak relativn\xc3\xad URL funguj\xc3\xad pouze v tom kontextu, v jak\xc3\xa9m byly p\xc5\xafvodn\xc4\x9b vytvo\xc5\x99eny. Nap\xc5\x99\xc3\xadklad URL \xe2\x80\x9e../../xml/dtd/docbookx.xml\xe2\x80\x9c bude fungovat pouze za velmi specifick\xc3\xbdch podm\xc3\xadnek._NEWLINE_T\xc4\x9bmto probl\xc3\xa9m\xc5\xafm lze zabr\xc3\xa1nit pou\xc5\xbe\xc3\xadv\xc3\xa1n\xc3\xadm resolveru entit (kter\xc3\xbd je standardn\xc3\xad sou\xc4\x8d\xc3\xa1st\xc3\xad bal\xc3\xadku SAX) nebo URI Resolveru (standardn\xc3\xad sou\xc4\x8d\xc3\xa1st JAXP). Resolver m\xc5\xaf\xc5\xbee kontrolovat pou\xc5\xbeit\xc3\xa1 URI a ur\xc4\x8dovat, kde lze nal\xc3\xa9zt pot\xc5\x99ebn\xc3\xa9 soubory.\n_START_SECTION_\nP\xc5\x99\xc3\xadklad souboru Catalog.xml\n_START_PARAGRAPH_\nN\xc3\xa1sleduj\xc3\xadc\xc3\xad jednoduch\xc3\xbd katalog ukazuje, jak lze lok\xc3\xa1ln\xc4\x9b ke\xc5\xa1ovan\xc3\xa9 DTD poskytovat nap\xc5\x99\xc3\xadklad n\xc3\xa1stroj\xc5\xafm pro validaci XHTML str\xc3\xa1nek:_NEWLINE__NEWLINE_ _NEWLINE_  <?xml version="1.0"?>_NEWLINE_  <!DOCTYPE catalog    PUBLIC "-//OASIS//DTD Entity Resolution XML Catalog V1.0//EN"           "http://www.oasis-open.org/committees/entity/release/1.0/catalog.dtd">_NEWLINE__NEWLINE_  <catalog xmlns="urn:oasis:names:tc:entity:xmlns:xml:catalog"_NEWLINE_           prefer="public">_NEWLINE__NEWLINE_    <public publicId="-//W3C//DTD XHTML 1.0 Strict//EN"_NEWLINE_            uri="dtd/xhtml1/xhtml1-strict.dtd"/>_NEWLINE__NEWLINE_    <public publicId="-//W3C//DTD XHTML 1.0 Transitional//EN"_NEWLINE_            uri="dtd/xhtml1/xhtml1-transitional.dtd"/>_NEWLINE__NEWLINE_    <public publicId="-//W3C//DTD XHTML 1.1//EN"_NEWLINE_            uri="dtd/xhtml11/xhtml11-flat.dtd"/>_NEWLINE__NEWLINE_  </catalog>_NEWLINE_Tento katalog umo\xc5\xbe\xc5\x88uje resolvovat -//W3C//DTD XHTML 1.0 Strict//EN na lok\xc3\xa1ln\xc3\xad URI dtd/xhtml1/xhtml1-strict.dtd a poskytuje lok\xc3\xa1ln\xc3\xad URI pro dal\xc5\xa1\xc3\xad dva ve\xc5\x99ejn\xc3\xa9 ID._NEWLINE_V\xc3\xbd\xc5\xa1e uveden\xc3\xbd dokument v\xc5\xa1ak s\xc3\xa1m obsahuje DOCTYPE, co\xc5\xbe m\xc5\xaf\xc5\xbee zp\xc5\xafsobit, \xc5\xbee se parser pokus\xc3\xad p\xc5\x99istupovat k syst\xc3\xa9mov\xc3\xa9mu ID URL pro DOCTYPE (tj. http://www.oasis-open.org/committees/entity/release/1.0/catalog.dtd) v okam\xc5\xbeiku, kdy resolver katalogu je\xc5\xa1t\xc4\x9b nen\xc3\xad pln\xc4\x9b fun\xc4\x8dn\xc3\xad, co\xc5\xbe m\xc5\xaf\xc5\xbee zp\xc5\xafsobit jeho selh\xc3\xa1n\xc3\xad. Tomu lze zabr\xc3\xa1nit odstran\xc4\x9bn\xc3\xadm deklarace DOCTYPE._NEWLINE_N\xc3\xa1sleduj\xc3\xadc\xc3\xad p\xc5\x99\xc3\xadklad, kter\xc3\xbd ukazuje jak ztoto\xc5\xbenit deklarace <system/> s deklaracemi <public/>, proto deklaraci DOCTYPE neobsahuje:_NEWLINE__NEWLINE_  <?xml version="1.0"?>_NEWLINE_  <catalog xmlns="urn:oasis:names:tc:entity:xmlns:xml:catalog">_NEWLINE__NEWLINE_    <system systemId="http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"_NEWLINE_            uri="dtd/xhtml1/xhtml1-strict.dtd"/>_NEWLINE__NEWLINE_    <system systemId="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"_NEWLINE_            uri="dtd/xhtml1/xhtml1-transitional.dtd"/>_NEWLINE__NEWLINE_    <system systemId="http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"_NEWLINE_            uri="dtd/xhtml11/xhtml11-flat.dtd"/>_NEWLINE__NEWLINE_  </catalog>\n_START_SECTION_\nPou\xc5\xbe\xc3\xadv\xc3\xa1n\xc3\xad katalogu - p\xc5\x99\xc3\xadklad v Java SAX\n_START_PARAGRAPH_\nResolvery katalog\xc5\xaf jsou dostupn\xc3\xa9 pro r\xc5\xafzn\xc3\xa9 programovac\xc3\xad jazyky. N\xc3\xa1sleduj\xc3\xadc\xc3\xad p\xc5\x99\xc3\xadklad ukazuje, jak lze v jazyce Java vytvo\xc5\x99it SAX parser umo\xc5\xbe\xc5\x88uj\xc3\xadc\xc3\xad zpracov\xc3\xa1vat vstupy, ve nich\xc5\xbe se pou\xc5\xbe\xc3\xadv\xc3\xa1 org.apache.xml.resolver.tools.CatalogResolver pro resolvov\xc3\xa1n\xc3\xad extern\xc3\xadch entit na lok\xc3\xa1ln\xc4\x9b ke\xc5\xa1ovan\xc3\xa9 instance. Tento resolver poch\xc3\xa1z\xc3\xad z Apache Xerces a nyn\xc3\xad je obsa\xc5\xbeen v runtime Javy firmy Sun._NEWLINE_SAXParser vytvo\xc5\x99\xc3\xadme obvykl\xc3\xbdm zp\xc5\xafsobem pomoc\xc3\xad factories. Dostaneme XML reader a jeho entity resolver nastav\xc3\xadme bu\xc4\x8f na standardn\xc3\xad (CatalogResolver) nebo na jin\xc3\xbd podle pot\xc5\x99eby:_NEWLINE__NEWLINE_  final SAXParser saxParser = SAXParserFactory.newInstance().newSAXParser();_NEWLINE_  final XMLReader reader = saxParser.getXMLReader();_NEWLINE__NEWLINE_  final ContentHandler handler = ...;_NEWLINE_  final InputSource input = ...;_NEWLINE__NEWLINE_  reader.setEntityResolver( new CatalogResolver() );_NEWLINE_  reader.setContentHandler( handler );_NEWLINE_  reader.parse( input );_NEWLINE_Metoda parse se mus\xc3\xad volat na reader, ne na SAX parser.'