*/
final List<de.ddb.conversion.context.xml.Format> formats = contextDocument
.getConversionContext().getFormats().getFormatList();
for (final de.ddb.conversion.context.xml.Format formatElement : formats) {
try {
final Format format = new Format(formatElement.getName());
if (formatElement.getContentType() != null) {
format.setContentType(formatElement.getContentType());
}
/*
* check syntax
*/
new URI(formatElement.getNamespace());
format.setNamespaceString(formatElement.getNamespace());
if (formatElement.isSetSchemaLocation()) {
/*
* check syntax
*/
new URL(formatElement.getSchemaLocation());
format.setSchemaLocationString(formatElement
.getSchemaLocation());
}
if (formatElement.isSetContentType()) {
format.setContentType(formatElement.getContentType());
}
if (formatElement.isSetEndOfRecordPattern()) {
format.setEndOfRecordPatternString(formatElement
.getEndOfRecordPattern());
}
if (formatElement.isSetRecordPattern()) {
format.setRecordPatternString(formatElement
.getRecordPattern());
}
if (formatElement.isSetStartOfRecordPattern()) {
format.setStartOfRecordPatternString(formatElement
.getStartOfRecordPattern());
}
if (formatElement.isSetRecordDelimiterPattern()) {
format.setRecordDelimiterPatternString(formatElement
.getRecordDelimiterPattern());
}
format.setDescription(formatElement.getDescription());
context.addFormat(format);
} catch (final URISyntaxException e) {
LOGGER.error("Format could not be added because of bad schema uri syntax.");
if (LOGGER.isDebugEnabled()) {
LOGGER.debug(e, e);