Referring to a local DTD in Java

前端 未结 4 460
借酒劲吻你
借酒劲吻你 2021-01-04 20:15

I have some XML that I\'m parsing with a SAX parser in Java. It starts with this preamble:



        
4条回答
  •  再見小時候
    2021-01-04 20:52

    Take a look at this article on using XML catalogs to resolve DTDs locally without having to modify your XML source. The basic steps are:

    1. create an XML file that maps system IDs to local DTDs
    2. modify your code to instantiate and configure a CatalogResolver
    3. provide the CatalogResolver to the XML Reader (obtained from the parser)

提交回复
热议问题