📄 dtdentityresolver.java
字号:
//// ____.// __/\ ______| |__/\. _______// __ .____| | \ | +----+ \// _______| /--| | | - \ _ | : - \_________// \\______: :---| : : | : | \________>// |__\---\_____________:______: :____|____:_____\// /_____|//// . . . i n j a h i a w e t r u s t . . .//////// DtdEntityResolver//// NK 08.03.2001//package org.jahia.utils.xml;import java.io.*;import java.util.*;import org.w3c.dom.*;import org.jahia.exceptions.*;import org.jahia.utils.*; // JahiaConsoleimport org.xml.sax.EntityResolver;import org.xml.sax.InputSource;import org.jahia.data.constants.JahiaConstants;/** * Substitute external DTD files with local DTD files. * * @author Khue * @version 1.0 */public class DtdEntityResolver implements EntityResolver { /** * Registered DTD, the key is the public id */ private Hashtable m_DTDs = new Hashtable(); /** * Replace external dtd with local dtd. * Return an InputSource to a local DTD file or null if not found * in the registered DTD * */ public InputSource resolveEntity (String publicID, String systemID) { //System.out.println("DtdEntityResolver: " + publicID + " " + systemID); if ( publicID == null ){ return null; } String dtd = null; if ( m_DTDs.get(publicID) != null ){ dtd = (String) m_DTDs.get(publicID); } if( dtd != null ) { //System.out.println("DtdEntityResolver: found dtd "); File f = new File( dtd ); if( f.exists() ) try { return new InputSource(new FileInputStream(f)); } catch( FileNotFoundException ex ) { } } return null; } /** * * @param publicID the key to identify the requested dtd * @param dtd the dtd resource file */ public void registerDTD(String publicID, String dtd) { m_DTDs.put(publicID, dtd); }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -