本文整理汇总了Java中org.apache.commons.digester.Digester.clear方法的典型用法代码示例。如果您正苦于以下问题:Java Digester.clear方法的具体用法?Java Digester.clear怎么用?Java Digester.clear使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.commons.digester.Digester
的用法示例。
在下文中一共展示了Digester.clear方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getEctMeasurementsType
import org.apache.commons.digester.Digester; //导入方法依赖的package包/类
static public EctFormProp getEctMeasurementsType(InputStream is) {
EctFormProp ret = null;
try {
Digester digester = new Digester();
digester.setValidating(false);
digester.addObjectCreate("formProp", EctFormProp.class);
digester.addObjectCreate("formProp/measurement", EctMeasurementTypesBean.class);
digester.addBeanPropertySetter("formProp/measurement/type", "type");
digester.addBeanPropertySetter("formProp/measurement/typeDesc", "typeDesc");
digester.addBeanPropertySetter("formProp/measurement/typeDisplayName", "typeDisplayName");
digester.addBeanPropertySetter("formProp/measurement/measuringInstrc", "measuringInstrc");
digester.addBeanPropertySetter("formProp/measurement/canPrefill", "canPrefill");
digester.addObjectCreate("formProp/measurement/validationRule", EctValidationsBean.class);
digester.addBeanPropertySetter("formProp/measurement/validationRule/name", "name");
digester.addBeanPropertySetter("formProp/measurement/validationRule/regularExp", "regularExp");
digester.addBeanPropertySetter("formProp/measurement/validationRule/minValue", "minValue");
digester.addBeanPropertySetter("formProp/measurement/validationRule/maxValue", "maxValue");
digester.addBeanPropertySetter("formProp/measurement/validationRule/minLength", "minLength");
digester.addBeanPropertySetter("formProp/measurement/validationRule/maxLength", "maxLength");
digester.addBeanPropertySetter("formProp/measurement/validationRule/isNumeric", "isNumeric");
digester.addBeanPropertySetter("formProp/measurement/validationRule/isDate", "isDate");
digester.addSetNext("formProp/measurement/validationRule", "addValidationRule");
digester.addSetNext("formProp/measurement", "addMeasurementType");
ret = (EctFormProp) digester.parse(is);
digester.clear();
}
catch (Exception exc) {
MiscUtils.getLogger().error("Error", exc);
}
return ret;
}
示例2: load
import org.apache.commons.digester.Digester; //导入方法依赖的package包/类
public void load(Resource resource){
URL eis = this.getClass().getResource("VenusSystemExceptionRule.xml");
if (eis == null) {
throw new VenusConfigException("classpath resource 'VenusSystemExceptionRule.xml' not found");
}
RuleSet ruleSet = new FromXmlRuleSet(eis, new DigesterRuleParser());
Digester digester = new Digester();
digester.addRuleSet(ruleSet);
try{
List<ExceptionConfig> list = (List<ExceptionConfig>) digester.parse(resource.getInputStream());
for (ExceptionConfig config : list) {
if (config.getErrorCode() == 0) {
Exception exception = (Exception) reflectionProvider.newInstance(config.getType());
if (exception instanceof CodedException) {
config.setErrorCode(((CodedException) exception).getErrorCode());
} else {
throw new VenusConfigException("exception type=" + config.getType()
+ " must implement CodedException or errorCode must not be null");
}
}
codeMap.put(config.getErrorCode(), config);
classMap.put(config.getType(), config);
}
}catch(Exception e){
try {
logger.error("parser "+resource.getURL()+" error", e);
} catch (IOException e1) {
logger.error("parser "+resource.getFilename()+" error", e);
}
}finally{
digester.clear();
}
}
示例3: processStandardFacesConfig
import org.apache.commons.digester.Digester; //导入方法依赖的package包/类
private static void processStandardFacesConfig(
DesignerProject designerProject, Digester digester,
FacesConfigBean fcb) {
IFile config = designerProject.getProject().getFile(FACESCONFIG_PATH);
if (!config.exists()) {
if (logger.isInfoEnabled()) {
logger.info("faces-config.xml not found for project {0}",
designerProject.getProject().getName());
}
return;
}
digester.clear();
digester.push(fcb);
try {
digester.parse(config.getContents(false));
} catch (Exception e) {
if (logger.isErrorEnabled()) {
logger.error(e,
"Error Parsing Standard faces config for project {0}",
designerProject.getProject().getName());
}
}
}
示例4: getEctMeasurementsType
import org.apache.commons.digester.Digester; //导入方法依赖的package包/类
static public EctFormProp getEctMeasurementsType(InputStream is) {
EctFormProp ret = null;
try {
Digester digester = new Digester();
digester.setValidating(false);
digester.addObjectCreate("formProp", EctFormProp.class);
digester.addObjectCreate("formProp/measurement", EctMeasurementTypesBean.class);
digester.addBeanPropertySetter("formProp/measurement/type", "type");
digester.addBeanPropertySetter("formProp/measurement/typeDesc", "typeDesc");
digester.addBeanPropertySetter("formProp/measurement/typeDisplayName", "typeDisplayName");
digester.addBeanPropertySetter("formProp/measurement/measuringInstrc", "measuringInstrc");
digester.addBeanPropertySetter("formProp/measurement/canPrefill", "canPrefill");
digester.addObjectCreate("formProp/measurement/validationRule", EctValidationsBean.class);
digester.addBeanPropertySetter("formProp/measurement/validationRule/name", "name");
digester.addBeanPropertySetter("formProp/measurement/validationRule/regularExp", "regularExp");
digester.addBeanPropertySetter("formProp/measurement/validationRule/minValue", "minValue");
digester.addBeanPropertySetter("formProp/measurement/validationRule/maxValue", "maxValue");
digester.addBeanPropertySetter("formProp/measurement/validationRule/minLength", "minLength");
digester.addBeanPropertySetter("formProp/measurement/validationRule/maxLength", "maxLength");
digester.addBeanPropertySetter("formProp/measurement/validationRule/isNumeric", "isNumeric");
digester.addBeanPropertySetter("formProp/measurement/validationRule/isDate", "isDate");
digester.addSetNext("formProp/measurement/validationRule", "addValidationRule");
digester.addSetNext("formProp/measurement", "addMeasurementType");
//File input = new File(xmlPath);
ret = (EctFormProp) digester.parse(is);
digester.clear();
}
catch (Exception exc) {
MiscUtils.getLogger().error("Error", exc);
}
return ret;
}
示例5: init
import org.apache.commons.digester.Digester; //导入方法依赖的package包/类
public void init() {
doScanExtension();
//兼容 3.0.8以前版本
if(configFiles == null){
return;
}
for (String configFile : configFiles) {
configFile = (String) ConfigUtil.filter(configFile);
configFile = configFile.trim();
URL eis = this.getClass().getResource("VenusSystemExceptionRule.xml");
if (eis == null) {
throw new VenusConfigException("classpath resource 'VenusSystemExceptionRule.xml' not found");
}
RuleSet ruleSet = new FromXmlRuleSet(eis, new DigesterRuleParser());
Digester digester = new Digester();
digester.addRuleSet(ruleSet);
try {
InputStream is = null;
if (configFile.startsWith("classpath:")) {
configFile = configFile.substring("classpath:".length());
is = this.getClass().getClassLoader().getResourceAsStream(configFile);
} else {
is = new FileInputStream(new File(configFile));
}
List<ExceptionConfig> list = (List<ExceptionConfig>) digester.parse(is);
for (ExceptionConfig config : list) {
if (config.getErrorCode() == 0) {
Exception exception = (Exception) reflectionProvider.newInstance(config.getType());
if (exception instanceof CodedException) {
config.setErrorCode(((CodedException) exception).getErrorCode());
} else {
throw new VenusConfigException("exception type=" + config.getType()
+ " must implement CodedException or errorCode must not be null");
}
}
codeMap.put(config.getErrorCode(), config);
classMap.put(config.getType(), config);
}
} catch (Exception e) {
logger.error("parser VenusSystemExceptionRule.xml error", e);
}finally{
digester.clear();
}
}
}