@Test public void testParserFailure() { TableTagParser tableTagParser = new TableTagParser(); try { tableTagParser.parser("WEB-INF/struts-config.xml"); Assert.fail(); } catch (TableTagParseException e) { Assert.assertEquals("exception.framework.TableTagParseException", e.getKey()); } }
public Table parser(String file) throws TableTagParseException { Table table = null; try { DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); SchemaFactory schfactory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI); schfactory.setErrorHandler(null); Schema schema = schfactory.newSchema(new StreamSource(MifosResourceUtil.getClassPathResourceAsURIString(FilePaths.CUSTOMTABLETAGXSD))); factory.setNamespaceAware(false); factory.setValidating(false); factory.setSchema(schema); DocumentBuilder builder = factory.newDocumentBuilder(); builder.setErrorHandler(null); Document document = builder.parse(MifosResourceUtil.getClassPathResourceAsURIString(file)); table = createTable(document); } catch (Exception e) { throw new TableTagParseException(e); } return table; }
TableTagParser { public Table parser(String file) throws TableTagParseException { Table table = null; try { DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); SchemaFactory schfactory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI); schfactory.setErrorHandler(null); Schema schema = schfactory.newSchema(new StreamSource(MifosResourceUtil.getClassPathResourceAsURIString(FilePaths.CUSTOMTABLETAGXSD))); factory.setNamespaceAware(false); factory.setValidating(false); factory.setSchema(schema); DocumentBuilder builder = factory.newDocumentBuilder(); builder.setErrorHandler(null); Document document = builder.parse(MifosResourceUtil.getClassPathResourceAsURIString(file)); table = createTable(document); } catch (Exception e) { throw new TableTagParseException(e); } return table; } }
TableTagParser { public Table parser(String file) throws TableTagParseException { Table table = null; try { DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); SchemaFactory schfactory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI); schfactory.setErrorHandler(null); Schema schema = schfactory.newSchema(new StreamSource(MifosResourceUtil.getClassPathResourceAsURIString(FilePaths.CUSTOMTABLETAGXSD))); factory.setNamespaceAware(false); factory.setValidating(false); factory.setSchema(schema); DocumentBuilder builder = factory.newDocumentBuilder(); builder.setErrorHandler(null); Document document = builder.parse(MifosResourceUtil.getClassPathResourceAsURIString(file)); table = createTable(document); } catch (Exception e) { throw new TableTagParseException(e); } return table; }  }
TableTagParser { public Table parser(String file) throws TableTagParseException { Table table = null; try { DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); SchemaFactory schfactory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI); schfactory.setErrorHandler(null); Schema schema = schfactory.newSchema(new StreamSource(MifosResourceUtil.getClassPathResourceAsURIString(FilePaths.CUSTOMTABLETAGXSD))); factory.setNamespaceAware(false); factory.setValidating(false); factory.setSchema(schema); DocumentBuilder builder = factory.newDocumentBuilder(); builder.setErrorHandler(null); Document document = builder.parse(MifosResourceUtil.getClassPathResourceAsURIString(file)); table = createTable(document); } catch (Exception e) { throw new TableTagParseException(e); } return table; }  static TableTagParser getInstance(); Table parser(String file); }
TableTagParser { public Table parser(String file) throws TableTagParseException { Table table = null; try { DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); SchemaFactory schfactory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI); schfactory.setErrorHandler(null); Schema schema = schfactory.newSchema(new StreamSource(MifosResourceUtil.getClassPathResourceAsURIString(FilePaths.CUSTOMTABLETAGXSD))); factory.setNamespaceAware(false); factory.setValidating(false); factory.setSchema(schema); DocumentBuilder builder = factory.newDocumentBuilder(); builder.setErrorHandler(null); Document document = builder.parse(MifosResourceUtil.getClassPathResourceAsURIString(file)); table = createTable(document); } catch (Exception e) { throw new TableTagParseException(e); } return table; }  static TableTagParser getInstance(); Table parser(String file);  }