Class PatternRuleLoader

  • All Implemented Interfaces:
    org.xml.sax.ContentHandler, org.xml.sax.DTDHandler, org.xml.sax.EntityResolver, org.xml.sax.ErrorHandler

    public class PatternRuleLoader
    extends org.xml.sax.helpers.DefaultHandler
    Loads PatternRules from an XML file.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private boolean relaxedMode  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.util.List<AbstractPatternRule> getRules​(java.io.File file)  
      java.util.List<AbstractPatternRule> getRules​(java.io.InputStream is, java.lang.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
    • Field Detail

      • relaxedMode

        private boolean relaxedMode
    • Constructor Detail

      • PatternRuleLoader

        public PatternRuleLoader()
    • Method Detail

      • getRules

        public final java.util.List<AbstractPatternRule> getRules​(java.io.File file)
                                                           throws java.io.IOException
        Parameters:
        file - XML file with pattern rules
        Throws:
        java.io.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 java.util.List<AbstractPatternRule> getRules​(java.io.InputStream is,
                                                                  java.lang.String filename)
                                                           throws java.io.IOException
        Parameters:
        is - stream with the XML rules
        filename - used only for verbose exception message - should refer to where the stream comes from
        Throws:
        java.io.IOException