當前位置: 首頁>>代碼示例>>Java>>正文


Java Digester類代碼示例

本文整理匯總了Java中org.apache.commons.digester.Digester的典型用法代碼示例。如果您正苦於以下問題:Java Digester類的具體用法?Java Digester怎麽用?Java Digester使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


Digester類屬於org.apache.commons.digester包,在下文中一共展示了Digester類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: XmlParser

import org.apache.commons.digester.Digester; //導入依賴的package包/類
/**
     * Constructor.
     * Creates a digester parser and initializes syntax rules.
     */
 public XmlParser()
 {
digester = new Digester();
digester.setValidating(validating);
digester.setNamespaceAware(true);
digester.setUseContextClassLoader(true);
// Register our local copy of the DTDs that we can find
 for (int i = 0; i < registrations.length; i += 2) {
     URL url = this.getClass().getResource(registrations[i+1]);
     if (url != null)
         {
         digester.register(registrations[i], url.toString());
         }
 }
   // Init syntax rules
 initDigester( digester );
 }
 
開發者ID:lamsfoundation,項目名稱:lams,代碼行數:22,代碼來源:XmlParser.java

示例2: createStopDigester

import org.apache.commons.digester.Digester; //導入依賴的package包/類
/**
 * Create and configure the Digester we will be using for shutdown.
 */
protected Digester createStopDigester() {

    // Initialize the digester
    Digester digester = new Digester();
    if (debug)
        digester.setDebug(999);

    // Configure the rules we need for shutting down
    digester.addObjectCreate("Server",
                             "org.apache.catalina.core.StandardServer",
                             "className");
    digester.addSetProperties("Server");
    digester.addSetNext("Server",
                        "setServer",
                        "org.apache.catalina.Server");

    return (digester);

}
 
開發者ID:c-rainstorm,項目名稱:jerrydog,代碼行數:23,代碼來源:Catalina.java

示例3: createTldDigester

import org.apache.commons.digester.Digester; //導入依賴的package包/類
/**
 * Create (if necessary) and return a Digester configured to process a tag
 * library descriptor, looking for additional listener classes to be
 * registered.
 */
private static Digester createTldDigester() {

    URL url = null;
    Digester tldDigester = new Digester();
    tldDigester.setValidating(true);
    url = ContextConfig.class.getResource(Constants.TldDtdResourcePath_11);
    tldDigester.register(Constants.TldDtdPublicId_11,
                         url.toString());
    url = ContextConfig.class.getResource(Constants.TldDtdResourcePath_12);
    tldDigester.register(Constants.TldDtdPublicId_12,
                         url.toString());
    tldDigester.addRuleSet(new TldRuleSet());
    return (tldDigester);

}
 
開發者ID:c-rainstorm,項目名稱:jerrydog,代碼行數:21,代碼來源:ContextConfig.java

示例4: createWebDigester

import org.apache.commons.digester.Digester; //導入依賴的package包/類
/**
 * Create (if necessary) and return a Digester configured to process the
 * web application deployment descriptor (web.xml).
 */
private static Digester createWebDigester() {

    URL url = null;
    Digester webDigester = new Digester();
    webDigester.setValidating(true);
    url = ContextConfig.class.getResource(Constants.WebDtdResourcePath_22);
    webDigester.register(Constants.WebDtdPublicId_22,
                         url.toString());
    url = ContextConfig.class.getResource(Constants.WebDtdResourcePath_23);
    webDigester.register(Constants.WebDtdPublicId_23,
                         url.toString());
    webDigester.addRuleSet(new WebRuleSet());
    return (webDigester);

}
 
開發者ID:c-rainstorm,項目名稱:jerrydog,代碼行數:20,代碼來源:ContextConfig.java

示例5: loadVenusService

import org.apache.commons.digester.Digester; //導入依賴的package包/類
private void loadVenusService(List<ServiceConfig> serviceConfigList, Map<String, InterceptorMapping> interceptors, Map<String, InterceptorStackConfig> interceptorStacks) {
    for (Resource config : configFiles) {
        RuleSet ruleSet = new FromXmlRuleSet(this.getClass().getResource("venusServerRule.xml"), new DigesterRuleParser());
        Digester digester = new Digester();
        digester.addRuleSet(ruleSet);

        try {
            InputStream is = config.getInputStream();
            Venus venus = (Venus) digester.parse(is);
            serviceConfigList.addAll(venus.getServiceConfigs());
            interceptors.putAll(venus.getInterceptors());
            interceptorStacks.putAll(venus.getInterceptorStatcks());
        } catch (Exception e) {
            throw new ConfigurationException("can not parser xml:" + config.getFilename(), e);
        }
    }
}
 
開發者ID:blusechen,項目名稱:venus,代碼行數:18,代碼來源:XmlFileServiceManager.java

示例6: addTextInputComponentRules

import org.apache.commons.digester.Digester; //導入依賴的package包/類
public static void addTextInputComponentRules(Digester digester)
	{
		String componentNamespace = digester.getRuleNamespaceURI();
		
		String textInputComponentPattern = "*/componentElement/textInput";
//		digester.addObjectCreate(textInputComponentPattern, TextInputComponent.class.getName());
		digester.addFactoryCreate(textInputComponentPattern, TextInputComponentFactory.class.getName());

		digester.addSetProperties(textInputComponentPattern);
		
//		digester.addSetProperties(textInputComponentPattern,
//			//properties to be ignored by this rule
//			new String[]{JRXmlConstants.ATTRIBUTE_evaluationTime, StandardBarbecueComponent.PROPERTY_ROTATION}, 
//			new String[0]);
		
		digester.setRuleNamespaceURI(JRXmlConstants.JASPERREPORTS_NAMESPACE);

		digester.addFactoryCreate(textInputComponentPattern + "/textField", TextInputTextFieldFactory.class.getName());

		digester.setRuleNamespaceURI(componentNamespace);
	}
 
開發者ID:TIBCOSoftware,項目名稱:jasperreports,代碼行數:22,代碼來源:TextInputComponentDigester.java

示例7: setPieChartRules

import org.apache.commons.digester.Digester; //導入依賴的package包/類
@SuppressWarnings("deprecation")
protected void setPieChartRules(Digester digester)
{
	String pieChartPattern = "*/componentElement/pieChart";
	digester.addFactoryCreate(pieChartPattern, PieChartXmlFactory.class.getName());
	
	String pieDatasetPattern = pieChartPattern + "/pieDataset";
	digester.addObjectCreate(pieDatasetPattern, DesignPieDataset.class.getName());
	digester.addSetNext(pieDatasetPattern, "setDataset", PieDataset.class.getName());

	String keyExpressionPattern = pieDatasetPattern + "/keyExpression";
	digester.addFactoryCreate(keyExpressionPattern, JRExpressionFactory.StringExpressionFactory.class.getName());
	digester.addCallMethod(keyExpressionPattern, "setText", 0);
	digester.addSetNext(keyExpressionPattern, "setKeyExpression", JRExpression.class.getName());

	String valueExpressionPattern = pieDatasetPattern + "/valueExpression";
	digester.addFactoryCreate(valueExpressionPattern, JRExpressionFactory.NumberExpressionFactory.class.getName());
	digester.addCallMethod(valueExpressionPattern, "setText", 0);
	digester.addSetNext(valueExpressionPattern, "setValueExpression", JRExpression.class.getName());

	String titleExpressionPattern = pieChartPattern + "/titleExpression";
	digester.addFactoryCreate(titleExpressionPattern, JRExpressionFactory.StringExpressionFactory.class.getName());
	digester.addCallMethod(titleExpressionPattern, "setText", 0);
	digester.addSetNext(titleExpressionPattern, "setTitleExpression", JRExpression.class.getName());
}
 
開發者ID:TIBCOSoftware,項目名稱:jasperreports,代碼行數:26,代碼來源:ChartsDigester.java

示例8: addSortComponentRules

import org.apache.commons.digester.Digester; //導入依賴的package包/類
public static void addSortComponentRules(Digester digester)
{
	String componentNamespace = digester.getRuleNamespaceURI();
	
	String sortComponentPattern = "*/componentElement/sort";
	digester.addObjectCreate(sortComponentPattern, SortComponent.class.getName());
	
	digester.addSetProperties(sortComponentPattern, new String[] {
			SortComponent.PROPERTY_EVALUATION_TIME,
			}, 
			new String[0]);
	
	digester.addRule(sortComponentPattern, 
			new XmlConstantPropertyRule(
					SortComponent.PROPERTY_EVALUATION_TIME,
					EvaluationTimeEnum.values()));

	digester.addFactoryCreate(sortComponentPattern + "/symbol", SortComponentSymbolFactory.class.getName());
	
	digester.setRuleNamespaceURI(JRXmlConstants.JASPERREPORTS_NAMESPACE);

	digester.addFactoryCreate(sortComponentPattern + "/symbol/font", SortComponentSymbolFontFactory.class.getName());
	digester.addSetNext(sortComponentPattern + "/symbol/font", "setSymbolFont", JRFont.class.getName());

	digester.setRuleNamespaceURI(componentNamespace);
}
 
開發者ID:TIBCOSoftware,項目名稱:jasperreports,代碼行數:27,代碼來源:SortComponentDigester.java

示例9: addListRules

import org.apache.commons.digester.Digester; //導入依賴的package包/類
protected void addListRules(Digester digester)
{
	String listPattern = "*/componentElement/list";
	digester.addObjectCreate(listPattern, StandardListComponent.class);
	digester.addSetProperties(listPattern,
			//properties to be ignored by this rule
			new String[]{"printOrder"}, 
			new String[0]);
	digester.addRule(listPattern, new XmlConstantPropertyRule(
			"printOrder", "printOrderValue", PrintOrderEnum.values()));
	
	String listContentsPattern = listPattern + "/listContents";
	digester.addObjectCreate(listContentsPattern, DesignListContents.class);
	digester.addSetProperties(listContentsPattern);
	digester.addSetNext(listContentsPattern, "setContents");
}
 
開發者ID:TIBCOSoftware,項目名稱:jasperreports,代碼行數:17,代碼來源:ComponentsXmlDigesterConfigurer.java

示例10: addBarcodeRules

import org.apache.commons.digester.Digester; //導入依賴的package包/類
@SuppressWarnings("deprecation")
protected <T> void addBarcodeRules(Digester digester, 
		String barcodePattern, Class<T> barcodeComponentClass,
		String[] ignoredProperties)
{
	digester.addObjectCreate(barcodePattern, barcodeComponentClass);
	digester.addSetProperties(barcodePattern,
			//properties to be ignored by this rule
			ignoredProperties, 
			new String[0]);
	//rule to set evaluation time
	digester.addRule(barcodePattern, 
			new XmlConstantPropertyRule(
					JRXmlConstants.ATTRIBUTE_evaluationTime, "evaluationTimeValue",
					EvaluationTimeEnum.values()));
	
	String codeExpressionPattern = barcodePattern + "/codeExpression";
	digester.addFactoryCreate(codeExpressionPattern, 
			JRExpressionFactory.StringExpressionFactory.class.getName());
	digester.addCallMethod(codeExpressionPattern, "setText", 0);
	digester.addSetNext(codeExpressionPattern, "setCodeExpression", 
			JRExpression.class.getName());
}
 
開發者ID:TIBCOSoftware,項目名稱:jasperreports,代碼行數:24,代碼來源:ComponentsXmlDigesterConfigurer.java

示例11: addItemRules

import org.apache.commons.digester.Digester; //導入依賴的package包/類
protected void addItemRules(Digester digester, String itemPattern, String namespace)
{
	digester.addFactoryCreate(itemPattern, ItemXmlFactory.class.getName());
	digester.addSetNext(itemPattern, "addItem", Item.class.getName());

	String locationItemPropertyPattern = itemPattern + "/itemProperty";
	digester.addFactoryCreate(locationItemPropertyPattern, ItemPropertyXmlFactory.class.getName());
	digester.addSetNext(locationItemPropertyPattern, "addItemProperty", ItemProperty.class.getName());

	digester.setRuleNamespaceURI(namespace);
	
	String locationItemPropertyValueExpressionPattern = locationItemPropertyPattern + "/" + JRXmlConstants.ELEMENT_valueExpression;
	digester.addFactoryCreate(locationItemPropertyValueExpressionPattern, JRExpressionFactory.class.getName());
	digester.addCallMethod(locationItemPropertyValueExpressionPattern, "setText", 0);
	digester.addSetNext(locationItemPropertyValueExpressionPattern, "setValueExpression", JRExpression.class.getName());
}
 
開發者ID:TIBCOSoftware,項目名稱:jasperreports,代碼行數:17,代碼來源:ComponentsXmlDigesterConfigurer.java

示例12: addExpressionRules

import org.apache.commons.digester.Digester; //導入依賴的package包/類
protected <T> void addExpressionRules(Digester digester, String expressionPattern,
		Class<T> factoryClass, String setterMethod, boolean jrNamespace)
{
	String originalNamespace = digester.getRuleNamespaceURI();
	if (jrNamespace)
	{
		digester.setRuleNamespaceURI(JRXmlWriter.JASPERREPORTS_NAMESPACE.getNamespaceURI());
	}
	
	digester.addFactoryCreate(expressionPattern, factoryClass);
	digester.addCallMethod(expressionPattern, "setText", 0);
	digester.addSetNext(expressionPattern, setterMethod,
			JRExpression.class.getName());
	
	if (jrNamespace)
	{
		digester.setRuleNamespaceURI(originalNamespace);
	}
}
 
開發者ID:TIBCOSoftware,項目名稱:jasperreports,代碼行數:20,代碼來源:ComponentsXmlDigesterConfigurer.java

示例13: parseConfig

import org.apache.commons.digester.Digester; //導入依賴的package包/類
private void parseConfig(String publicId, String entityURL,
    String strutsConfig) {
    // Prepare a Digester for parsing a struts-config.xml file
    Digester digester = new Digester();

    digester.push(config);
    digester.setNamespaceAware(true);
    digester.setValidating(true);
    digester.addRuleSet(new ConfigRuleSet());
    digester.register(publicId,
        this.getClass().getResource(entityURL).toString());

    // Parse the test struts-config.xml file
    try {
        InputStream input =
            this.getClass().getResourceAsStream(strutsConfig);

        assertNotNull("Got an input stream for " + strutsConfig, input);
        digester.parse(input);
        input.close();
    } catch (Throwable t) {
        t.printStackTrace(System.out);
        fail("Parsing threw exception:  " + t);
    }
}
 
開發者ID:SonarSource,項目名稱:sonar-scanner-maven,代碼行數:26,代碼來源:TestModuleConfig.java

示例14: XmlParser

import org.apache.commons.digester.Digester; //導入依賴的package包/類
/**
    * Constructor.
    * Creates a digester parser and initializes syntax rules.
    */
public XmlParser()
{
  digester = new Digester();
  digester.setValidating(validating);
  digester.setNamespaceAware(true);
  digester.setUseContextClassLoader(true);
  // Register our local copy of the DTDs that we can find
for (int i = 0; i < registrations.length; i += 2) {
    URL url = this.getClass().getResource(registrations[i+1]);
    if (url != null)
        {
        digester.register(registrations[i], url.toString());
        }
}
  // Init syntax rules
initDigester( digester );
}
 
開發者ID:SonarSource,項目名稱:sonar-scanner-maven,代碼行數:22,代碼來源:XmlParser.java

示例15: addRuleInstances

import org.apache.commons.digester.Digester; //導入依賴的package包/類
@Override
public void addRuleInstances(Digester digester) {
	
	digester.addRule("faces-config", new FacesConfigRule());
	
	digester.addRule(
	        "faces-config/managed-bean", new ManagedBeanRule());
	      digester.addCallMethod(
	        "faces-config/managed-bean/managed-bean-class", 
	        "setManagedBeanClass", 0);
	      digester.addCallMethod(
	        "faces-config/managed-bean/managed-bean-name", 
	        "setManagedBeanName", 0);
	      digester.addCallMethod(
	        "faces-config/managed-bean/managed-bean-scope", 
	        "setManagedBeanScope", 0);
	
}
 
開發者ID:camac,項目名稱:Barista,代碼行數:19,代碼來源:ManagedBeanRuleSet.java


注:本文中的org.apache.commons.digester.Digester類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。