本文整理匯總了Java中org.apache.commons.digester.Digester.setValidating方法的典型用法代碼示例。如果您正苦於以下問題:Java Digester.setValidating方法的具體用法?Java Digester.setValidating怎麽用?Java Digester.setValidating使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.apache.commons.digester.Digester
的用法示例。
在下文中一共展示了Digester.setValidating方法的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 );
}
示例2: 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);
}
示例3: 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);
}
示例4: 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);
}
}
示例5: 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 );
}
示例6: createDigester
import org.apache.commons.digester.Digester; //導入方法依賴的package包/類
private static Digester createDigester() {
Digester d = new Digester();
d.setValidating(false);
d.addObjectCreate("hyracks-cluster", HyracksCluster.class);
d.addSetProperties("hyracks-cluster");
d.addObjectCreate("hyracks-cluster/cluster-controller", ClusterController.class);
d.addSetProperties("hyracks-cluster/cluster-controller");
d.addSetNext("hyracks-cluster/cluster-controller", "setClusterController");
d.addObjectCreate("hyracks-cluster/node-controllers/node-controller", NodeController.class);
d.addSetProperties("hyracks-cluster/node-controllers/node-controller");
d.addSetNext("hyracks-cluster/node-controllers/node-controller", "addNodeController");
d.addObjectCreate("*/container-specification", ContainerSpecification.class);
d.addSetProperties("*/container-specification");
d.addSetNext("*/container-specification", "setContainerSpecification");
return d;
}
示例7: 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());
}
示例8: configureDigester
import org.apache.commons.digester.Digester; //導入方法依賴的package包/類
private static void configureDigester(Digester digester) {
digester.setValidating(false);
digester.addObjectCreate("params", ClientCertificate.class);
digester.addObjectCreate("*/param/value/struct/member/", Member.class);
digester.addCallMethod("*/param/value/struct/member/name",
"setName", 0);
digester.addCallMethod("*/param/value/struct/member/value/string",
"addValue", 0);
digester.addObjectCreate("*/param/value/struct/member/value/array",
ArrayList.class);
digester.addCallMethod(
"*/param/value/struct/member/value/array/data/value/string",
"add", 0);
digester.addSetNext("*/param/value/struct/member/value/array",
"setValues");
digester.addSetNext("*/param/value/struct/member", "addMember");
}
示例9: parseURL
import org.apache.commons.digester.Digester; //導入方法依賴的package包/類
private void parseURL(URL u) {
Digester d = new Digester();
d.setValidating(false);
d.push(this);
d.addObjectCreate("factory/template", HashMap.class);
d.addRule("factory/template", new AttributeCopyRule());
d.addSetNext("factory/template", "addFactoryTemplate");
try {
d.parse(u.openStream());
}
catch (Exception e) {
throw new ManifestFactoryParseException("Unable to parse " +
builder.getManifestFilename(), e);
}
}
示例10: load
import org.apache.commons.digester.Digester; //導入方法依賴的package包/類
/**
* Load the contents of our configuration file.
*/
protected void load() {
// Validate the existence of our configuration file
File file = new File(pathname);
if (!file.isAbsolute())
file = new File(System.getProperty("catalina.base"), pathname);
if (!file.exists() || !file.canRead()) {
log("Cannot load configuration file " + file.getAbsolutePath());
return;
}
// Load the contents of our configuration file
Digester digester = new Digester();
digester.setValidating(false);
digester.addRuleSet(new MemoryRuleSet());
try {
digester.push(this);
digester.parse(file);
} catch (Exception e) {
log("Error processing configuration file " +
file.getAbsolutePath(), e);
return;
}
}
示例11: get
import org.apache.commons.digester.Digester; //導入方法依賴的package包/類
/**
* Reading the checksum file (xml) from an InputSream and put it in a Map.
*
* @param in
* @return A Map with the file name as key and the checksum as value.
*/
public static Map<String, String> get(final InputStream in) {
Digester digester = new Digester();
digester.setValidating(false);
digester.addObjectCreate("checksums", HashMap.class);
digester.addCallMethod("checksums/file", "put", 2);
digester.addCallParam("checksums/file/name", 0);
digester.addCallParam("checksums/file/checksum", 1);
try {
@SuppressWarnings("unchecked")
Map<String, String> checksums = (Map<String, String>) digester.parse(in);
return checksums;
} catch (Exception e) {
throw new FatalException("Error while parsing checksums: " + e.getMessage(), e);
}
}
示例12: 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();
}
示例13: createDigester
import org.apache.commons.digester.Digester; //導入方法依賴的package包/類
/**
* Creates a new digester.
*
* @return the new digester.
* @throws ParserConfigurationException
* if digester is not configured properly
*/
private Digester createDigester() throws ParserConfigurationException {
Digester digester = new Digester();
digester.setValidating(false);
digester.setClassLoader(CheckStyleRules.class.getClassLoader());
String section = "*/section";
digester.addObjectCreate(section, Rule.class);
digester.addSetProperties(section);
digester.addSetNext(section, "add");
String subSection = "*/section/subsection";
digester.addObjectCreate(subSection, Topic.class);
digester.addSetProperties(subSection);
digester.addSetNext(subSection, "setDescription");
digester.addRule(subSection, new TopicRule());
return digester;
}
示例14: getFormat
import org.apache.commons.digester.Digester; //導入方法依賴的package包/類
protected Format getFormat() throws IOException, SAXException {
// parse the XML ...
// create a field object per field element
if (format == null) {
Digester digester = new Digester();
digester.setValidating(true);
digester.setUseContextClassLoader(true);
digester.addObjectCreate("format", "com.sapienter.jbilling.server.mediation.Format");
digester.addObjectCreate("format/field", "com.sapienter.jbilling.server.mediation.FormatField");
digester.addCallMethod("format/field/name","setName",0);
digester.addCallMethod("format/field/type","setType",0);
digester.addCallMethod("format/field/startPosition","setStartPosition",0);
digester.addCallMethod("format/field/durationFormat","setDurationFormat",0);
digester.addCallMethod("format/field/length","setLength",0);
digester.addCallMethod("format/field/isKey","isKeyTrue");
digester.addSetNext("format/field", "addField", "com.sapienter.jbilling.server.mediation.FormatField");
format = (Format) digester.parse(new File(formatFileName));
LOG.debug("using format: " + format);
}
return format;
}
示例15: DigesterXmlDocument
import org.apache.commons.digester.Digester; //導入方法依賴的package包/類
public DigesterXmlDocument() {
dig = new Digester();
dig.setValidating(false);
dig.addObjectCreate("address-book", DigesterXmlDocument.class);
dig.addObjectCreate("address-book/contact", Contact.class);
dig.addSetProperties("address-book/contact", "type", "type");
dig.addCallMethod("address-book/contact/name", "setName", 0);
dig.addCallMethod("address-book/contact/address", "setAddress", 0);
dig.addCallMethod("address-book/contact/city", "setCity", 0);
dig.addCallMethod("address-book/contact/province", "setProvince", 0);
dig.addCallMethod("address-book/contact/postalcode", "setPostalcode", 0);
dig.addCallMethod("address-book/contact/country", "setCountry", 0);
dig.addCallMethod("address-book/contact/telephone", "setTelephone", 0);
dig.addSetNext("address-book/contact", "populateDocument");
}