本文整理汇总了Java中org.apache.commons.digester.Digester.setErrorHandler方法的典型用法代码示例。如果您正苦于以下问题:Java Digester.setErrorHandler方法的具体用法?Java Digester.setErrorHandler怎么用?Java Digester.setErrorHandler使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.commons.digester.Digester
的用法示例。
在下文中一共展示了Digester.setErrorHandler方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: configureDigester
import org.apache.commons.digester.Digester; //导入方法依赖的package包/类
protected void configureDigester(JasperReportsContext jasperReportsContext, Digester digester) throws SAXException, ParserConfigurationException
{
digester.setNamespaceAware(true);
digester.setRuleNamespaceURI(JRXmlConstants.JASPERTEMPLATE_NAMESPACE);
boolean validating = JRPropertiesUtil.getInstance(jasperReportsContext).getBooleanProperty(JRReportSaxParserFactory.COMPILER_XML_VALIDATION);
digester.setErrorHandler(this);
digester.setValidating(validating);
digester.setFeature("http://xml.org/sax/features/validation", validating);
digester.addRuleSet(rules);
}
示例2: getDigester
import org.apache.commons.digester.Digester; //导入方法依赖的package包/类
/**
* <p>Configures a Digester</p>
*
* @return Digester
*/
private Digester getDigester() {
final SaxErrorHandler errorHandler = new SaxErrorHandler();
final Digester digester = new Digester();
digester.setErrorHandler(errorHandler);
digester.setValidating(true);
digester.setEntityResolver(new DtdEntityResolver());
return digester;
}
示例3: buildDigester
import org.apache.commons.digester.Digester; //导入方法依赖的package包/类
/**
* @return fully-initialized Digester used to process entry XML files
*/
protected Digester buildDigester(String schemaLocation, String digestorRulesFileName) {
Digester digester = new Digester();
digester.setNamespaceAware(false);
digester.setValidating(true);
digester.setErrorHandler(new XmlErrorHandler());
digester.setSchema(schemaLocation);
Rules rules = loadRules(digestorRulesFileName);
digester.setRules(rules);
return digester;
}
示例4: buildDigester
import org.apache.commons.digester.Digester; //导入方法依赖的package包/类
/**
* @return fully-initialized Digester used to process entry XML files
*/
private Digester buildDigester(String schemaLocation, String digestorRulesFileName) {
Digester digester = new Digester();
digester.setNamespaceAware(false);
digester.setValidating(true);
digester.setErrorHandler(new XmlErrorHandler());
digester.setSchema(schemaLocation);
Rules rules = loadRules(digestorRulesFileName);
digester.setRules(rules);
return digester;
}
示例5: execute
import org.apache.commons.digester.Digester; //导入方法依赖的package包/类
/**
* Installs a module description in the target OpenCms. Module description
* comes from the path given in the parameter configurationXml. The XML file
* there contains module description(s) in the format as in WEB-INF/config/opencms-modules.xml
* or manifest.xml of an exported module. It may contain multiple modules,
* but it must be well formed, say, in case of multiple modules it must have one root node
* containing the module entries. These module configuration(s) get added to
* WEB-INF/config/opencms-modules.xml of the target installation.
* Module content gets sync'ed and published afterwards by the respective plugin goals.
*
* @param webappDirectory
* path to WEB-INF of the OpenCms installation
* @param adminPassword
* password of user "Admin" performing the operation
* @param moduleSourcePath
* path to module xml configuration file
* @throws CmsException
* if anything OpenCms goes wrong
* @throws IOException
* in case configuration files cannot be read
* @throws SAXException
* in case configuration files cannot be parsed
*/
public final void execute(final String webappDirectory,
final String adminPassword, final String moduleSourcePath, final String moduleVersion)
throws IOException, CmsException, SAXException {
final String webinfdir = webappDirectory + File.separatorChar +
"WEB-INF";
final CmOpenCmsShell cmsshell = CmOpenCmsShell.getInstance(webinfdir,
"Admin", adminPassword);
this.moduleVersion = moduleVersion;
if (cmsshell != null) {
this.cms = cmsshell.getCmsObject();
final CmsRequestContext requestcontext = this.cms.getRequestContext();
requestcontext.setCurrentProject(this.cms.readProject("Offline"));
this.setReport(new CmsShellReport(requestcontext.getLocale()));
// code taken from org.opencms.module.CmsModuleImportExportHandler (readModuleFromImport)
final Digester digester = new Digester();
digester.setUseContextClassLoader(true);
digester.setValidating(false);
digester.setRuleNamespaceURI(null);
digester.setErrorHandler(new CmsXmlErrorHandler());
digester.push(this);
CmsModuleXmlHandler.addXmlDigesterRules(digester);
simpleReport("Parsing module file: "+moduleSourcePath+". Version: "+moduleVersion);
digester.parse(new FileInputStream(new File(moduleSourcePath)));
simpleReport("End of parsing module file: "+moduleSourcePath+". Version: "+moduleVersion);
}else{
System.err.println("[WARN]VfsModule.execute(): CmsShell not available");
}
}
示例6: getDigester
import org.apache.commons.digester.Digester; //导入方法依赖的package包/类
public Digester getDigester(Configuration configuration) throws SAXNotSupportedException, SAXNotRecognizedException {
Digester digester = new Digester();
digester.setUseContextClassLoader(true);
digester.push(configuration);
URL digesterRulesURL = ClassUtils.getResourceURL(this, getDigesterRules());
FromXmlRuleSet ruleSet = new FromXmlRuleSet(digesterRulesURL);
digester.addRuleSet(ruleSet);
Rule attributeChecker = new AttributeCheckingRule();
digester.addRule("*/jmsRealms", attributeChecker);
digester.addRule("*/jmsRealm", attributeChecker);
digester.addRule("*/sapSystem", attributeChecker);
digester.addRule("*/adapter", attributeChecker);
digester.addRule("*/pipeline", attributeChecker);
digester.addRule("*/errorMessageFormatter", attributeChecker);
digester.addRule("*/receiver", attributeChecker);
digester.addRule("*/sender", attributeChecker);
digester.addRule("*/listener", attributeChecker);
digester.addRule("*/postboxSender", attributeChecker);
digester.addRule("*/postboxListener", attributeChecker);
digester.addRule("*/errorSender", attributeChecker);
digester.addRule("*/messageLog", attributeChecker);
digester.addRule("*/inProcessStorage", attributeChecker);
digester.addRule("*/errorStorage", attributeChecker);
digester.addRule("*/pipe", attributeChecker);
digester.addRule("*/readerFactory", attributeChecker);
digester.addRule("*/manager", attributeChecker);
digester.addRule("*/manager/flow", attributeChecker);
digester.addRule("*/recordHandler", attributeChecker);
digester.addRule("*/resultHandler", attributeChecker);
digester.addRule("*/forward", attributeChecker);
digester.addRule("*/child", attributeChecker);
digester.addRule("*/param", attributeChecker);
digester.addRule("*/pipeline/exits/exit", attributeChecker);
digester.addRule("*/scheduler/job", attributeChecker);
digester.addRule("*/locker", attributeChecker);
digester.addRule("*/directoryCleaner", attributeChecker);
digester.addRule("*/statistics", attributeChecker);
digester.addRule("*/handler", attributeChecker);
digester.addRule("*/cache", attributeChecker);
digester.addRule("*/inputValidator", attributeChecker);
digester.addRule("*/outputValidator", attributeChecker);
digester.addRule("*/inputWrapper", attributeChecker);
digester.addRule("*/outputWrapper", attributeChecker);
if (MonitorManager.getInstance().isEnabled()) {
MonitorManager.getInstance().setDigesterRules(digester);
}
boolean validation = AppConstants.getInstance().getBoolean(CONFIGURATION_VALIDATION_KEY, false);
if (validation) {
digester.setValidating(true);
digester.setNamespaceAware(true);
digester.setProperty("http://java.sun.com/xml/jaxp/properties/schemaLanguage", "http://www.w3.org/2001/XMLSchema");
digester.setProperty("http://java.sun.com/xml/jaxp/properties/schemaSource", "AdapterFramework.xsd");
XmlErrorHandler xeh = new XmlErrorHandler();
digester.setErrorHandler(xeh);
}
return digester;
}