本文整理匯總了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;
}