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
Loads
PatternRule
s from an XML file.-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfinal List
<AbstractPatternRule> final 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
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.xml.sax.ContentHandler
declaration
-
Field Details
-
relaxedMode
private boolean relaxedMode
-
-
Constructor Details
-
PatternRuleLoader
public PatternRuleLoader()
-
-
Method Details
-
getRules
- 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
- Parameters:
is
- stream with the XML rulesfilename
- used only for verbose exception message - should refer to where the stream comes from- Throws:
IOException
-