本文整理汇总了Java中org.apache.commons.digester3.Digester.addRule方法的典型用法代码示例。如果您正苦于以下问题:Java Digester.addRule方法的具体用法?Java Digester.addRule怎么用?Java Digester.addRule使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.commons.digester3.Digester
的用法示例。
在下文中一共展示了Digester.addRule方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: addChainRules
import org.apache.commons.digester3.Digester; //导入方法依赖的package包/类
private void addChainRules(Digester digester) {
digester.addObjectCreate("*/" + getChainElement(),
getChainClass(),
getClassAttribute());
digester.addSetProperties("*/" + getChainElement());
digester.addRule("*/" + getChainElement(),
new ConfigRegisterRule(nameAttribute));
}
示例2: addCommandRules
import org.apache.commons.digester3.Digester; //导入方法依赖的package包/类
private void addCommandRules(Digester digester) {
digester.addObjectCreate("*/" + getCommandElement(),
null,
getClassAttribute());
digester.addSetProperties("*/" + getCommandElement());
digester.addRule("*/" + getCommandElement(),
new ConfigRegisterRule(nameAttribute));
}
示例3: addCatalogRules
import org.apache.commons.digester3.Digester; //导入方法依赖的package包/类
private void addCatalogRules(Digester digester) {
digester.addRule("*/" + getCatalogElement(),
new ConfigCatalogRule(nameAttribute, catalogClass));
digester.addSetProperties("*/" + getCatalogElement());
}
示例4: addDefineElementRule
import org.apache.commons.digester3.Digester; //导入方法依赖的package包/类
private void addDefineElementRule(Digester digester) {
digester.addRule("*/" + getDefineElement(),
new ConfigDefineRule(getNameAttribute(),
getClassAttribute()));
}
示例5: build
import org.apache.commons.digester3.Digester; //导入方法依赖的package包/类
/**
* Builds a Vocabulary from the supplied input stream
*
* @param is For the XML
* @return The extension
* @throws SAXException
* @throws IOException
* @throws ParserConfigurationException
*/
public Vocabulary build(InputStream is) throws IOException, SAXException, ParserConfigurationException {
Digester digester = new Digester(saxf.newSAXParser());
digester.setNamespaceAware(true);
digester.setXIncludeAware(false);
digester.setRuleNamespaceURI(VOCABULARY_NAMESPACE);
Vocabulary tv = new Vocabulary();
digester.push(tv);
// build the thesaurus
digester.addCallMethod("*/thesaurus", "setTitle", 1);
digester.addRule("*/thesaurus", new CallParamNoNSRule(0, "title"));
digester.addCallMethod("*/thesaurus", "setDescription", 1);
digester.addRule("*/thesaurus", new CallParamNoNSRule(0, "description"));
digester.addCallMethod("*/thesaurus", "setLink", 1);
digester.addRule("*/thesaurus", new CallParamNoNSRule(0, "relation"));
digester.addCallMethod("*/thesaurus", "setUri", 1);
digester.addRule("*/thesaurus", new CallParamNoNSRule(0, "URI"));
// build the concept
digester.addObjectCreate("*/concept", VocabularyConcept.class);
digester.addCallMethod("*/concept", "setLink", 1);
digester.addRule("*/concept", new CallParamNoNSRule(0, "relation"));
digester.addCallMethod("*/concept", "setDescription", 1);
digester.addRule("*/concept", new CallParamNoNSRule(0, "description"));
digester.addCallMethod("*/concept", "setUri", 1);
digester.addRule("*/concept", new CallParamNoNSRule(0, "URI"));
digester.addCallMethod("*/concept", "setIdentifier", 1);
digester.addRule("*/concept", new CallParamNoNSRule(0, "identifier"));
// build the terms
digester.addObjectCreate("*/preferred/term", VocabularyTerm.class);
VocabularyTerm t = new VocabularyTerm();
digester.addCallMethod("*/preferred/term", "setLang", 1);
digester.addRule("*/preferred/term", new CallParamNoNSRule(0, "lang"));
digester.addCallMethod("*/preferred/term", "setTitle", 1);
digester.addRule("*/preferred/term", new CallParamNoNSRule(0, "title"));
digester.addSetNext("*/preferred/term", "addPreferredTerm");
// build alternative terms
digester.addObjectCreate("*/alternative/term", VocabularyTerm.class);
VocabularyTerm talt = new VocabularyTerm();
digester.addCallMethod("*/alternative/term", "setLang", 1);
digester.addRule("*/alternative/term", new CallParamNoNSRule(0, "lang"));
digester.addCallMethod("*/alternative/term", "setTitle", 1);
digester.addRule("*/alternative/term", new CallParamNoNSRule(0, "title"));
digester.addSetNext("*/alternative/term", "addAlternativeTerm");
// add concept
digester.addSetNext("*/concept", "addConcept");
digester.parse(is);
return tv;
}
示例6: build
import org.apache.commons.digester3.Digester; //导入方法依赖的package包/类
/**
* Builds an extension from the supplied input stream
*
* @param is For the XML
* @return The extension
* @throws SAXException
* @throws IOException
* @throws ParserConfigurationException
*/
public Extension build(InputStream is, URL url, boolean dev) throws IOException, SAXException, ParserConfigurationException {
// in order to deal with arbitrary namespace prefixes we need to parse namespace aware!
Digester digester = new Digester(saxf.newSAXParser());
digester.setRuleNamespaceURI(EXTENSION_NAMESPACE);
Extension e = new Extension(url, dev);
digester.push(e);
digester.addCallMethod("*/extension", "setTitle", 1);
digester.addRule("*/extension", new CallParamNoNSRule(0, "title"));
digester.addCallMethod("*/extension", "setName", 1);
digester.addCallParam("*/extension", 0, "name");
digester.addCallMethod("*/extension", "setNamespace", 1);
digester.addCallParam("*/extension", 0, "namespace");
digester.addCallMethod("*/extension", "setRowType", 1);
digester.addCallParam("*/extension", 0, "rowType");
digester.addCallMethod("*/extension", "setLink", 1);
digester.addRule("*/extension", new CallParamNoNSRule(0, "relation"));
digester.addCallMethod("*/extension", "setDescription", 1);
digester.addRule("*/extension", new CallParamNoNSRule(0, "description"));
digester.addCallMethod("*/extension", "setSubject", 1);
digester.addRule("*/extension", new CallParamNoNSRule(0, "subject"));
// build the properties
digester.addObjectCreate("*/property", ExtensionProperty.class);
digester.addCallMethod("*/property", "setQualname", 1);
digester.addCallParam("*/property", 0, "qualName");
digester.addCallMethod("*/property", "setName", 1);
digester.addCallParam("*/property", 0, "name");
digester.addCallMethod("*/property", "setNamespace", 1);
digester.addCallParam("*/property", 0, "namespace");
digester.addCallMethod("*/property", "setGroup", 1);
digester.addCallParam("*/property", 0, "group");
digester.addCallMethod("*/property", "setType", 1);
digester.addCallParam("*/property", 0, "type");
digester.addCallMethod("*/property", "setRequired", 1);
digester.addCallParam("*/property", 0, "required");
digester.addCallMethod("*/property", "setLink", 1);
digester.addRule("*/property", new CallParamNoNSRule(0, "relation"));
digester.addCallMethod("*/property", "setDescription", 1);
digester.addRule("*/property", new CallParamNoNSRule(0, "description"));
digester.addCallMethod("*/property", "setExamples", 1);
digester.addCallParam("*/property", 0, "examples");
digester.addCallMethod("*/property", "setColumnLength", 1);
digester.addCallParam("*/property", 0, "columnLength");
// This is a special rule that will use the url2ThesaurusMap
// to set the Vocabulary based on the attribute "thesaurus"
digester.addRule("*/property", thesaurusRule);
digester.addSetNext("*/property", "addProperty");
digester.parse(is);
return e;
}