/** * Description of the Method * * @param name Description of the Parameter * @param forceNew Description of the Parameter * @return Description of the Return Value * @exception XMLException Description of the Exception */ public static synchronized XMLTagHandler findXMLTagHandler(String name, boolean forceNew) throws XMLException { if (DEBUG) { System.out.println("trying to find '" + name + "'"); } XMLTagHandler th = tagHandlers.get(name); if (th == null) { locateTagHandler(name); // try it again th = tagHandlers.get(name); if (th == null) { th = getDefaultXMLTagHandler(); } } if (th != null) { th.initHandler(); } if (DEBUG) { System.out.println("Tag handler: " + th); } return th; }
/** * Description of the Method * * @param name Description of the Parameter * @param packageName Description of the Parameter * @return Description of the Return Value * @exception XMLException Description of the Exception */ public static synchronized XMLTagHandler findFixedXMLTagHandler(String name, String packageName) throws XMLException { if (DEBUG) { System.out.println("trying to find '" + name + "' in " + packageName); } XMLTagHandler th = tagHandlers.get(name); if (th != null) { return th; } XMLCompiledDTD handler; /// @todo: loacate the Compiled DTD in the package and register String className = packageName + ".CompiledDTD"; if (DEBUG) { System.out.println("Looking for " + className); } Class clazz = null; try { try { clazz = Class.forName(className); } catch (ClassNotFoundException e) { if (DEBUG) { e.printStackTrace(System.out); } ClassLoader cl = ClassLoader.getSystemClassLoader(); if (cl != null) { clazz = cl.loadClass(className); } } if (clazz != null) { handler = (XMLCompiledDTD) clazz.newInstance(); registerCompiledDTD(handler, name); } } catch (ClassNotFoundException | InstantiationException | IllegalAccessException | XMLException e) { } th = (XMLTagHandler) tagHandlers.get(name); if (th != null) { th.initHandler(); } return th; }