Package org.languagetool.rules.patterns
Class PatternRuleLoader
- java.lang.Object
-
- org.xml.sax.helpers.DefaultHandler
-
- org.languagetool.rules.patterns.PatternRuleLoader
-
- All Implemented Interfaces:
ContentHandler
,DTDHandler
,EntityResolver
,ErrorHandler
public class PatternRuleLoader extends DefaultHandler
LoadsPatternRule
s from an XML file.- Author:
- Daniel Naber
-
-
Constructor Summary
Constructors Constructor Description PatternRuleLoader()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description List<AbstractPatternRule>
getRules(File file)
List<AbstractPatternRule>
getRules(InputStream is, String filename)
void
setRelaxedMode(boolean relaxedMode)
If set to true, don't throw an exception if id or name is not set.-
Methods inherited from class org.xml.sax.helpers.DefaultHandler
characters, endDocument, endElement, endPrefixMapping, error, fatalError, ignorableWhitespace, notationDecl, processingInstruction, resolveEntity, setDocumentLocator, skippedEntity, startDocument, startElement, startPrefixMapping, unparsedEntityDecl, warning
-
-
-
-
Method Detail
-
getRules
public final List<AbstractPatternRule> getRules(File file) throws IOException
- Parameters:
file
- XML file with pattern rules- Throws:
IOException
-
setRelaxedMode
public void setRelaxedMode(boolean relaxedMode)
If set to true, don't throw an exception if id or name is not set. Used for online rule editor.- Since:
- 2.1
-
getRules
public final List<AbstractPatternRule> getRules(InputStream is, String filename) throws IOException
- Parameters:
is
- stream with the XML rulesfilename
- used only for verbose exception message - should refer to where the stream comes from- Throws:
IOException
-
-