当前位置: 首页>>代码示例>>Java>>正文


Java Digester.setNamespaceAware方法代码示例

本文整理汇总了Java中org.apache.commons.digester.Digester.setNamespaceAware方法的典型用法代码示例。如果您正苦于以下问题:Java Digester.setNamespaceAware方法的具体用法?Java Digester.setNamespaceAware怎么用?Java Digester.setNamespaceAware使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.commons.digester.Digester的用法示例。


在下文中一共展示了Digester.setNamespaceAware方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: 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

示例3: 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

示例4: DdlUtilsDataHandling

import org.apache.commons.digester.Digester; //导入方法依赖的package包/类
/**
 * Creates a new data handling object.
 */
public DdlUtilsDataHandling()
{
    _digester = new Digester();
    _digester.setEntityResolver(new EntityResolver() {
        public InputSource resolveEntity(String publicId, String systemId)
        {
            // we don't care about the DTD for data files
            return new InputSource(new StringReader(""));
        }

    });
    _digester.setNamespaceAware(true);
    _digester.setValidating(false);
    _digester.setUseContextClassLoader(true);
    _digester.setRules(new ExtendedBaseRules());
    _digester.addRuleSet(new DataRuleSet());
}
 
开发者ID:KualiCo,项目名称:ojb,代码行数:21,代码来源:DdlUtilsDataHandling.java

示例5: S2ValidatorResources

import org.apache.commons.digester.Digester; //导入方法依赖的package包/类
/**
 * インスタンスを構築します。
 * 
 * @param streams
 *            入力ストリームの配列
 * @throws IOException
 *             IO例外が発生した場合。
 * @throws SAXException
 *             SAX例外が発生した場合。
 */
public S2ValidatorResources(InputStream[] streams) throws IOException,
        SAXException {
    URL rulesUrl = ValidatorResources.class
            .getResource("digester-rules.xml");
    Digester digester = DigesterLoader.createDigester(rulesUrl);
    digester.setNamespaceAware(true);
    digester.setValidating(true);
    digester.setUseContextClassLoader(true);
    for (int i = 0; i < REGISTRATIONS.length; i += 2) {
        URL url = ValidatorResources.class
                .getResource(REGISTRATIONS[i + 1]);
        if (url != null) {
            digester.register(REGISTRATIONS[i], url.toString());
        }
    }
    for (int i = 0; i < streams.length; i++) {
        digester.push(this);
        digester.parse(streams[i]);
    }
    initialize();
}
 
开发者ID:seasarorg,项目名称:sa-struts,代码行数:32,代码来源:S2ValidatorResources.java

示例6: 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);
}
 
开发者ID:TIBCOSoftware,项目名称:jasperreports,代码行数:14,代码来源:JRXmlTemplateDigesterFactory.java

示例7: 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;
}
 
开发者ID:VU-libtech,项目名称:OLE-INST,代码行数:17,代码来源:XmlBatchInputFileTypeBase.java

示例8: 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;
}
 
开发者ID:kuali,项目名称:kfs,代码行数:17,代码来源:CustomerInvoiceWriteoffBatchDigesterTest.java

示例9: initDigester

import org.apache.commons.digester.Digester; //导入方法依赖的package包/类
/**
 *  Initialize the digester.
 */
private Digester initDigester() {
    URL rulesUrl = this.getClass().getResource(VALIDATOR_RULES);
    if (rulesUrl == null) {
        // Fix for Issue# VALIDATOR-195
        rulesUrl = ValidatorResources.class.getResource(VALIDATOR_RULES);
    }
    if (getLog().isDebugEnabled()) {
        getLog().debug("Loading rules from '" + rulesUrl + "'");
    }
    Digester digester = DigesterLoader.createDigester(rulesUrl);
    digester.setNamespaceAware(true);
    digester.setValidating(true);
    digester.setUseContextClassLoader(true);

    // Add rules for arg0-arg3 elements
    addOldArgRules(digester);

    // register DTDs
    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());
        }
    }
    return digester;
}
 
开发者ID:ManfredTremmel,项目名称:gwt-commons-validator,代码行数:30,代码来源:ValidatorResources.java

示例10: createEmptyDigester

import org.apache.commons.digester.Digester; //导入方法依赖的package包/类
static protected Digester createEmptyDigester()
  throws ParserConfigurationException, SAXException
{
  SAXParserFactory spf = SAXParserFactory.newInstance();
  spf.setNamespaceAware(true);
  // requires JAXP 1.3, in JavaSE 5.0
  // spf.setXIncludeAware(true);
  Digester digester = new Digester(spf.newSAXParser());
  digester.setNamespaceAware(true);

  return digester;
}
 
开发者ID:alessandroleite,项目名称:maven-jdev-plugin,代码行数:13,代码来源:FacesConfigParser.java

示例11: getDigester

import org.apache.commons.digester.Digester; //导入方法依赖的package包/类
protected static Digester getDigester() {

		Digester digester = new Digester();

		digester.setValidating(false);

		digester.addObjectCreate("rss", RSS.class);
		digester.addSetProperties("rss");

		digester.addObjectCreate("rss/channel", Channel.class);
		digester.addSetProperties("rss/channel");
		digester.addCallMethod("rss/channel/title", "setTitle", 0);
		digester.addSetNext("rss/channel", "addChannel");

		digester.addObjectCreate("rss/channel/item", Item.class);
		digester.addSetProperties("rss/channel/item");
		digester.addCallMethod("rss/channel/item/title", "setTitle", 0);
		digester.addCallMethod("rss/channel/item/guid", "setGuid", 0);
		digester.addCallMethod("rss/channel/item/link", "setLink", 0);
		digester.addCallMethod("rss/channel/item/description", "setDescription", 0);
		digester.addCallMethod("rss/channel/item/author", "setAuthor", 0);
		digester.addCallMethod("rss/channel/item/pubDate", "setPubDate", 0);
		digester.addCallMethod("rss/channel/item/category", "addCategory", 1);
		digester.addCallParam("rss/channel/item/category", 0);
		digester.addSetNext("rss/channel/item", "addItem");

		digester.addObjectCreate("rss/channel/item/enclosure", Enclosure.class);
		digester.addSetProperties("rss/channel/item/enclosure");
		digester.addSetNext("rss/channel/item/enclosure", "addEnclosure");

		digester.setNamespaceAware(true);

		digester.setRuleNamespaceURI("http://purl.org/rss/1.0/modules/content/");
		// some feeds use <content:encoded> for their HTML
		digester.addCallMethod("rss/channel/item/encoded", "setDescription", 0);

		return digester;
	}
 
开发者ID:bmunzenb,项目名称:feed-buddy,代码行数:39,代码来源:RSSParser.java

示例12: parseRecord

import org.apache.commons.digester.Digester; //导入方法依赖的package包/类
private static List<RawOccurrenceRecord> parseRecord(InputSource inputSource, OccurrenceSchemaType schemaType)
  throws IOException, SAXException {
  RawOccurrenceRecordBuilder builder = new RawOccurrenceRecordBuilder();
  Digester digester = new Digester();
  digester.setNamespaceAware(true);
  digester.setValidating(false);
  digester.push(builder);
  digester.addRuleSet(RULE_SETS.get(schemaType));
  digester.parse(inputSource);

  builder.resolvePriorities();
  return builder.generateRawOccurrenceRecords();
}
 
开发者ID:gbif,项目名称:occurrence,代码行数:14,代码来源:XmlFragmentParser.java

示例13: createDigester

import org.apache.commons.digester.Digester; //导入方法依赖的package包/类
public static Digester createDigester(boolean validateXml) {

		Digester digester = new Digester();

		digester.setNamespaceAware(false);
		digester.setUseContextClassLoader(true);
		digester.setValidating(validateXml);

		try {
			digester.addRuleSet(new ManagedBeanRuleSet());
		} catch (IncompatibleClassChangeError e) {
			e.printStackTrace();
		}

		digester.push(new FacesConfigBean());

		return digester;

	}
 
开发者ID:camac,项目名称:Barista,代码行数:20,代码来源:BaristaUtil.java

示例14: 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;
}
 
开发者ID:ibissource,项目名称:iaf,代码行数:62,代码来源:ConfigurationDigester.java


注:本文中的org.apache.commons.digester.Digester.setNamespaceAware方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。