XmlConfigurationFactory { public static Configuration fromXml(String xml) throws ConfigurationFactoryException { SAXParser saxParser; try { saxParser = SAXParserFactory.newInstance().newSAXParser(); ConfigurationHandler handler = new ConfigurationHandler(); saxParser.parse(new ByteArrayInputStream(xml.getBytes(ENCODING)), handler); return handler.getBuilder().build(); } catch (ParserConfigurationException | SAXException | IOException e) { throw new ConfigurationFactoryException("Could not parse the configuration", e); } }  static Configuration fromXml(String xml); static String toXml(Configuration configuration); static final String ELEMENT_CONFIG; static final String ATTRIBUTE_NAME; static final String ATTRIBUTE_TYPE; static final String ATTRIBUTE_PATH; static final String ATTRIBUTE_METHOD; }
@Test void testReadResource() throws IOException, ConfigurationFactoryException { String configXml = IOUtil .readStringFromUTF8Stream(XmlConfigurationFactoryTest.class.getClassLoader().getResourceAsStream("configurationtest.xml")); Configuration config = XmlConfigurationFactory.fromXml(configXml); assertNotNull(config.getChildConfiguration("multipliers")); assertNotNull(config.getChildConfiguration("offsets")); }