Java Code Examples for org.apache.commons.digester.Digester#addRuleSet()
The following examples show how to use
org.apache.commons.digester.Digester#addRuleSet() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DigesterRuleParser.java From lams with GNU General Public License v2.0 | 6 votes |
/** * Creates another DigesterRuleParser, and uses it to extract the rules * out of the give XML file. The contents of the current pattern stack * will be prepended to all of the pattern strings parsed from the file. */ private void includeXMLRules(String fileName) throws IOException, SAXException, CircularIncludeException { ClassLoader cl = Thread.currentThread().getContextClassLoader(); if (cl == null) { cl = DigesterRuleParser.this.getClass().getClassLoader(); } URL fileURL = cl.getResource(fileName); if (fileURL == null) { throw new FileNotFoundException("File \"" + fileName + "\" not found."); } fileName = fileURL.toExternalForm(); if (includedFiles.add(fileName) == false) { // circular include detected throw new CircularIncludeException(fileName); } // parse the included xml file DigesterRuleParser includedSet = new DigesterRuleParser(targetDigester, patternStack, includedFiles); includedSet.setDigesterRulesDTD(getDigesterRulesDTD()); Digester digester = new Digester(); digester.addRuleSet(includedSet); digester.push(DigesterRuleParser.this); digester.parse(fileName); includedFiles.remove(fileName); }
Example 2
Source File: DigesterLoader.java From lams with GNU General Public License v2.0 | 5 votes |
/** * Creates a new digester and initializes it from the specified InputSource * @param rulesSource load the xml rules from this InputSource * @return a new Digester initialized with the rules */ public static Digester createDigester(InputSource rulesSource) { RuleSet ruleSet = new FromXmlRuleSet(rulesSource); Digester digester = new Digester(); digester.addRuleSet(ruleSet); return digester; }
Example 3
Source File: DigesterLoader.java From lams with GNU General Public License v2.0 | 5 votes |
/** * Creates a new digester and initializes it from the specified XML file * @param rulesXml URL to the XML file defining the digester rules * @return a new Digester initialized with the rules */ public static Digester createDigester(URL rulesXml) { RuleSet ruleSet = new FromXmlRuleSet(rulesXml); Digester digester = new Digester(); digester.addRuleSet(ruleSet); return digester; }
Example 4
Source File: JRXmlTemplateDigesterFactory.java From jasperreports with GNU Lesser General Public License v3.0 | 5 votes |
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); }
Example 5
Source File: DigesterLoader.java From lams with GNU General Public License v2.0 | 3 votes |
/** * Creates a new digester and initializes it from the specified InputSource. * This constructor allows the digester to be used to load the rules to be specified. * This allows properties to be configured on the Digester instance before it is used. * * @param rulesSource load the xml rules from this InputSource * @param rulesDigester digester to load the specified XML file. * @return a new Digester initialized with the rules */ public static Digester createDigester(InputSource rulesSource, Digester rulesDigester) { RuleSet ruleSet = new FromXmlRuleSet(rulesSource, rulesDigester); Digester digester = new Digester(); digester.addRuleSet(ruleSet); return digester; }
Example 6
Source File: DigesterLoader.java From lams with GNU General Public License v2.0 | 3 votes |
/** * Creates a new digester and initializes it from the specified XML file. * This constructor allows specifing a rulesDigester to do the XML file * loading; thus no matter the XML files is packed into a jar, a war, or a * ear, the rulesDigester can always find the XML files with properly set * ClassLoader. * * @param rulesXml URL to the XML file defining the digester rules * @param rulesDigester digester to load the specified XML file. * @return a new Digester initialized with the rules */ public static Digester createDigester(URL rulesXml, Digester rulesDigester) { RuleSet ruleSet = new FromXmlRuleSet(rulesXml, rulesDigester); Digester digester = new Digester(); digester.addRuleSet(ruleSet); return digester; }