Search in sources :

Example 1 with CIIToUBL22Converter

use of com.helger.en16931.cii2ubl.CIIToUBL22Converter 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);
    }
}
Also used : Serializable(java.io.Serializable) ErrorList(com.helger.commons.error.list.ErrorList) CIIToUBL22Converter(com.helger.en16931.cii2ubl.CIIToUBL22Converter)

Aggregations

ErrorList (com.helger.commons.error.list.ErrorList)1 CIIToUBL22Converter (com.helger.en16931.cii2ubl.CIIToUBL22Converter)1 Serializable (java.io.Serializable)1