本文整理汇总了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 );
}
示例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);
}
}
示例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 );
}
示例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());
}
示例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();
}
示例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);
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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();
}
示例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;
}
示例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;
}