本文整理汇总了Java中org.apache.tomcat.util.digester.Digester.setErrorHandler方法的典型用法代码示例。如果您正苦于以下问题:Java Digester.setErrorHandler方法的具体用法?Java Digester.setErrorHandler怎么用?Java Digester.setErrorHandler使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.tomcat.util.digester.Digester
的用法示例。
在下文中一共展示了Digester.setErrorHandler方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: doTestValidateVersion
import org.apache.tomcat.util.digester.Digester; //导入方法依赖的package包/类
private void doTestValidateVersion(String version) throws IOException, SAXException {
WebXml webxml = new WebXml();
// Special cases
if ("2.2".equals(version)) {
webxml.setPublicId(XmlIdentifiers.WEB_22_PUBLIC);
} else if ("2.3".equals(version)) {
webxml.setPublicId(XmlIdentifiers.WEB_23_PUBLIC);
} else {
webxml.setVersion(version);
}
// Merged web.xml that is published as MERGED_WEB_XML context attribute
// in the simplest case consists of webapp's web.xml file
// plus the default conf/web.xml one.
Set<WebXml> defaults = new HashSet<WebXml>();
defaults.add(getDefaultWebXmlFragment());
webxml.merge(defaults);
Digester digester = DigesterFactory.newDigester(true, true, new WebRuleSet(), true);
XmlErrorHandler handler = new XmlErrorHandler();
digester.setErrorHandler(handler);
InputSource is = new InputSource(new StringReader(webxml.toXml()));
WebXml webxmlResult = new WebXml();
digester.push(webxmlResult);
digester.parse(is);
Assert.assertEquals(0, handler.getErrors().size());
Assert.assertEquals(0, handler.getWarnings().size());
Assert.assertEquals(version, webxml.getVersion());
Assert.assertEquals(version, webxmlResult.getVersion());
}
示例2: testWebapp_2_2
import org.apache.tomcat.util.digester.Digester; //导入方法依赖的package包/类
@Test
public void testWebapp_2_2() throws Exception {
XmlErrorHandler handler = new XmlErrorHandler();
Digester digester = DigesterFactory.newDigester(
true, true, new WebRuleSet(false), true);
digester.setErrorHandler(handler);
digester.push(new WebXml());
WebXml desc = (WebXml) digester.parse(
new File("test/webapp-2.2/WEB-INF/web.xml"));
Assert.assertEquals("2.2", desc.getVersion());
Assert.assertEquals(XmlIdentifiers.WEB_22_PUBLIC, desc.getPublicId());
Assert.assertEquals(0, handler.getErrors().size());
Assert.assertEquals(0, handler.getWarnings().size());
}
示例3: testWebapp_2_3
import org.apache.tomcat.util.digester.Digester; //导入方法依赖的package包/类
@Test
public void testWebapp_2_3() throws Exception {
XmlErrorHandler handler = new XmlErrorHandler();
Digester digester = DigesterFactory.newDigester(
true, true, new WebRuleSet(false), true);
digester.setErrorHandler(handler);
digester.push(new WebXml());
WebXml desc = (WebXml) digester.parse(
new File("test/webapp-2.3/WEB-INF/web.xml"));
Assert.assertEquals("2.3", desc.getVersion());
Assert.assertEquals(XmlIdentifiers.WEB_23_PUBLIC, desc.getPublicId());
Assert.assertEquals(0, handler.getErrors().size());
Assert.assertEquals(0, handler.getWarnings().size());
}
示例4: testWebapp_2_4
import org.apache.tomcat.util.digester.Digester; //导入方法依赖的package包/类
@Test
public void testWebapp_2_4() throws Exception {
XmlErrorHandler handler = new XmlErrorHandler();
Digester digester = DigesterFactory.newDigester(
true, true, new WebRuleSet(false), true);
digester.setErrorHandler(handler);
digester.push(new WebXml());
WebXml desc = (WebXml) digester.parse(
new File("test/webapp-2.4/WEB-INF/web.xml"));
Assert.assertEquals("2.4", desc.getVersion());
Assert.assertEquals(0, handler.getErrors().size());
Assert.assertEquals(0, handler.getWarnings().size());
}
示例5: testWebapp_2_5
import org.apache.tomcat.util.digester.Digester; //导入方法依赖的package包/类
@Test
public void testWebapp_2_5() throws Exception {
XmlErrorHandler handler = new XmlErrorHandler();
Digester digester = DigesterFactory.newDigester(
true, true, new WebRuleSet(false), true);
digester.setErrorHandler(handler);
digester.push(new WebXml());
WebXml desc = (WebXml) digester.parse(
new File("test/webapp-2.5/WEB-INF/web.xml"));
Assert.assertEquals("2.5", desc.getVersion());
Assert.assertEquals(0, handler.getErrors().size());
Assert.assertEquals(0, handler.getWarnings().size());
}
示例6: testWebapp_3_0
import org.apache.tomcat.util.digester.Digester; //导入方法依赖的package包/类
@Test
public void testWebapp_3_0() throws Exception {
XmlErrorHandler handler = new XmlErrorHandler();
Digester digester = DigesterFactory.newDigester(
true, true, new WebRuleSet(false), true);
digester.setErrorHandler(handler);
digester.push(new WebXml());
WebXml desc = (WebXml) digester.parse(
new File("test/webapp-3.0/WEB-INF/web.xml"));
Assert.assertEquals("3.0", desc.getVersion());
Assert.assertEquals(0, handler.getErrors().size());
Assert.assertEquals(0, handler.getWarnings().size());
}