public static ContentMatcher getInstance(String xmlFileName) {
        ContentMatcher cm = new ContentMatcher();

        // Load the pattern definitions from an XML file
        try {
            cm.loadXMLPatternDefinitions(cm.getClass().getResourceAsStream(xmlFileName));
            
        } catch (JDOMException | IOException ex) {
            throw new IllegalArgumentException("Failed to initialize the ContentMatcher object using: " + xmlFileName, ex);
        }
        
        return cm;
    }
public static ContentMatcher getInstance ( String xmlFileName ) { ContentMatcher cm = new ContentMatcher ( ) ; try { cm . loadXMLPatternDefinitions ( cm . getClass ( ) . getResourceAsStream ( xmlFileName ) ) ; } catch ( JDOMException | IOException ex ) { throw new IllegalArgumentException ( "Failed to initialize the ContentMatcher object using: " + xmlFileName , ex ) ; } return cm ; }
Direct method for a complete ContentMatcher instance creation.
Use the ClassLoader for the resource detection and loading, be careful regarding the
relative file name use (this class is in another package).
@param xmlFileName the name of the XML file that need to be used for initialization
@return a ContentMatcher instance