/** * Parses the given conversion.xml file to a Java model. Performs XSD validation. * * @param conversionXml an input conversion.xml content * @param conversionXmlPath a path to the input conversion.xml * @param format a destination format within conversion.xml * @throws XmlParsingException if the input is not a valid XML or it doesn't pass XSD validation */ public ConversionXmlProvider(InputStream conversionXml, String conversionXmlPath, IFormat format) throws XmlParsingException { this.conversion = XmlParser.parse(conversionXml, conversionXmlPath, new String[]{CONVERSION_XSD}, CONVERSION_PACKAGE, ConversionType.class); this.formatType = conversion.getFormats().getMap().get(format.getName()); if (this.formatType == null) { throw new ConversionException(String.format("'%s' doesn't contain configuration for '%s' format.", conversionXmlPath, format.getName())); } }