use of com.helger.commons.error.list.ErrorList in project ph-schematron by phax.
the class SchematronHelper method convertToErrorList.
/**
* Convert a {@link SchematronOutputType} to an {@link IErrorList}.
*
* @param aSchematronOutput
* The result of Schematron validation
* @param sResourceName
* The name of the resource that was validated (may be a file path
* etc.)
* @return List non-<code>null</code> error list of {@link SVRLResourceError}
* objects.
*/
@Nonnull
public static IErrorList convertToErrorList(@Nonnull final SchematronOutputType aSchematronOutput, @Nullable final String sResourceName) {
ValueEnforcer.notNull(aSchematronOutput, "SchematronOutput");
final ErrorList ret = new ErrorList();
for (final SVRLFailedAssert aFailedAssert : SVRLHelper.getAllFailedAssertions(aSchematronOutput)) ret.add(aFailedAssert.getAsResourceError(sResourceName));
return ret;
}
use of com.helger.commons.error.list.ErrorList in project mustangproject by ZUGFeRD.
the class CIIToUBL method convert.
/**
* converts a CII XML file to a UBL XML file
* thanks to Philip Helger for his library
* @param input
* @param output
*/
public void convert(File input, File output) {
ErrorList occurred = new ErrorList();
CIIToUBL22Converter cc = new CIIToUBL22Converter();
Serializable aUBL = cc.convertCIItoUBL(input, occurred);
if (aUBL instanceof oasis.names.specification.ubl.schema.xsd.invoice_21.InvoiceType) {
UBL21Writer.invoice().setFormattedOutput(true).write((oasis.names.specification.ubl.schema.xsd.invoice_21.InvoiceType) aUBL, output);
} else if (aUBL instanceof oasis.names.specification.ubl.schema.xsd.creditnote_21.CreditNoteType) {
UBL21Writer.creditNote().setFormattedOutput(true).write((oasis.names.specification.ubl.schema.xsd.creditnote_21.CreditNoteType) aUBL, output);
} else if (aUBL instanceof oasis.names.specification.ubl.schema.xsd.invoice_22.InvoiceType) {
UBL22Writer.invoice().setFormattedOutput(true).write((oasis.names.specification.ubl.schema.xsd.invoice_22.InvoiceType) aUBL, output);
} else if (aUBL instanceof oasis.names.specification.ubl.schema.xsd.creditnote_22.CreditNoteType) {
UBL22Writer.creditNote().setFormattedOutput(true).write((oasis.names.specification.ubl.schema.xsd.creditnote_22.CreditNoteType) aUBL, output);
}
}
Aggregations