Document document = DocumentHelper.parseText(config.getSubElement("module").toString());
document.setDocType(new DefaultDocumentType("module", "-//Puppy Crawl//DTD Check Configuration 1.2//EN", "http://www.puppycrawl.com/dtds/configuration_1_2.dtd"));
//logger.debug("Configuring checkstyle: " + document.asXML());
com.puppycrawl.tools.checkstyle.api.Configuration csc = ConfigurationLoader.loadConfiguration(
new ByteArrayInputStream(document.asXML().getBytes()),
new PropertiesExpander(new Properties()), true);
checker = new Checker();
// must be done before calling configure method on checker, otherwise locale setting will not be used
checker.setLocaleCountry("en");
checker.setLocaleLanguage("en");
checker.setModuleClassLoader(CheckstyleAgent.class.getClassLoader());