public static InvoiceType Create()
        {
            var doc = new InvoiceType
            {
                UBLVersionID = "2.1",
                ID = "TOSL108",
                IssueDate = "2009-12-15",
                InvoiceTypeCode = new CodeType
                {
                    listID = "UN/ECE 1001 Subset",
                    listAgencyID = "6",
                    Value = "380"
                },
                Note = new TextType[]
                {
                    new TextType
                    {
                        languageID = "en",
                        Value = "Ordered in our booth at the convention."
                    }
                },
                TaxPointDate = "2009-11-30",
                DocumentCurrencyCode = new CodeType
                {
                    listID = "ISO 4217 Alpha",
                    listAgencyID = "6",
                    Value = "EUR"
                },
                AccountingCost = "Project cost code 123",
                InvoicePeriod = new PeriodType[]
                {
                    new PeriodType
                    {
                        StartDate = "2009-11-01",
                        EndDate = "2009-11-30"
                    }
                },
                OrderReference = new OrderReferenceType
                {
                    ID = "123"
                },
                ContractDocumentReference = new DocumentReferenceType[]
                {
                    new DocumentReferenceType
                    {
                        ID = "Contract321",
                        DocumentType = "Framework agreement"
                    }
                },
                AdditionalDocumentReference = new DocumentReferenceType[]
                {
                    new DocumentReferenceType
                    {
                        ID = "Doc1",
                        DocumentType = "Timesheet",
                        Attachment = new AttachmentType
                        {
                            ExternalReference = new ExternalReferenceType
                            {
                                URI = "http://www.suppliersite.eu/sheet001.html"
                            }
                        }
                    },
                    new DocumentReferenceType
                    {
                        ID = "Doc2",
                        DocumentType = "Drawing",
                        Attachment = new AttachmentType
                        {
                            EmbeddedDocumentBinaryObject = new BinaryObjectType
                            {
                                mimeCode = "application/pdf",
                                Value = System.Convert.FromBase64String("UjBsR09EbGhjZ0dTQUxNQUFBUUNBRU1tQ1p0dU1GUXhEUzhi")
                            }
                        }
                    }
                },
                AccountingSupplierParty = new SupplierPartyType
                {
                    Party = new PartyType
                    {
                        EndpointID = new IdentifierType
                        {
                            schemeID = "GLN",
                            schemeAgencyID = "9",
                            Value = "1234567890123"
                        },
                        PartyIdentification = new PartyIdentificationType[]
                        {
                            new PartyIdentificationType
                            {
                                ID = new IdentifierType
                                {
                                    schemeID = "ZZZ",
                                    Value = "Supp123"
                                }
                            }
                        },
                        PartyName = new PartyNameType[]
                        {
                            new PartyNameType
                            {
                                Name = "Salescompany ltd."
                            }
                        },
                        PostalAddress = new AddressType
                        {
                            ID = new IdentifierType
                            {
                                schemeID = "GLN",
                                schemeAgencyID = "9",
                                Value = "1231412341324"
                            },
                            Postbox = "5467",
                            StreetName = "Main street",
                            AdditionalStreetName = "Suite 123",
                            BuildingNumber = "1",
                            Department = "Revenue department",
                            CityName = "Big city",
                            PostalZone = "54321",
                            CountrySubentityCode = "RegionA",
                            Country = new CountryType
                            {
                                IdentificationCode = new CodeType
                                {
                                    listID = "ISO3166-1",
                                    listAgencyID = "6",
                                    Value = "DK"
                                }
                            }
                        },
                        PartyTaxScheme = new PartyTaxSchemeType[]
                        {
                            new PartyTaxSchemeType
                            {
                                CompanyID = new IdentifierType
                                {
                                    schemeID = "DKVAT",
                                    schemeAgencyID = "ZZZ",
                                    Value = "DK12345"
                                },
                                TaxScheme = new TaxSchemeType
                                {
                                    ID = new IdentifierType
                                    {
                                        schemeID = "UN/ECE 5153",
                                        schemeAgencyID = "6",
                                        Value = "VAT"
                                    }
                                }
                            }
                        },
                        PartyLegalEntity = new PartyLegalEntityType[]
                        {
                            new PartyLegalEntityType
                            {
                                RegistrationName = "The Sellercompany Incorporated",
                                CompanyID = new IdentifierType
                                {
                                    schemeID = "CVR",
                                    schemeAgencyID = "ZZZ",
                                    Value = "5402697509"
                                },
                                RegistrationAddress = new AddressType
                                {
                                    CityName = "Big city",
                                    CountrySubentity = "RegionA",
                                    Country = new CountryType
                                    {
                                        IdentificationCode = "DK"
                                    }
                                }
                            }
                        },
                        Contact = new ContactType
                        {
                            Telephone = "4621230",
                            Telefax = "4621231",
                            ElectronicMail = "*****@*****.**"
                        },
                        Person = new PersonType[]
                        {
                            new PersonType
                            {
                                FirstName = "Antonio",
                                FamilyName = "M",
                                MiddleName = "Salemacher",
                                JobTitle = "Sales manager"
                            }
                        }
                    }
                },
                AccountingCustomerParty = new CustomerPartyType
                {
                    Party = new PartyType
                    {
                        EndpointID = new IdentifierType
                        {
                            schemeID = "GLN",
                            schemeAgencyID = "9",
                            Value = "1234567987654"
                        },
                        PartyIdentification = new PartyIdentificationType[]
                        {
                            new PartyIdentificationType
                            {
                                ID = new IdentifierType
                                {
                                    schemeID = "ZZZ",
                                    Value = "345KS5324"
                                }
                            }
                        },
                        PartyName = new PartyNameType[]
                        {
                            new PartyNameType
                            {
                                Name = "Buyercompany ltd"
                            }
                        },
                        PostalAddress = new AddressType
                        {
                            ID = new IdentifierType
                            {
                                schemeID = "GLN",
                                schemeAgencyID = "9",
                                Value = "1238764941386"
                            },
                            Postbox = "123",
                            StreetName = "Anystreet",
                            AdditionalStreetName = "Back door",
                            BuildingNumber = "8",
                            Department = "Accounting department",
                            CityName = "Anytown",
                            PostalZone = "101",
                            CountrySubentity = "RegionB",
                            Country = new CountryType
                            {
                                IdentificationCode = new CodeType
                                {
                                    listID = "ISO3166-1",
                                    listAgencyID = "6",
                                    Value = "BE"
                                }
                            }
                        },
                        PartyTaxScheme = new PartyTaxSchemeType[]
                        {
                            new PartyTaxSchemeType
                            {
                                CompanyID = new IdentifierType
                                {
                                    schemeID = "BEVAT",
                                    schemeAgencyID = "ZZZ",
                                    Value = "BE54321"
                                },
                                TaxScheme = new TaxSchemeType
                                {
                                    ID = new IdentifierType
                                    {
                                        schemeID = "UN/ECE 5153",
                                        schemeAgencyID = "6",
                                        Value = "VAT"
                                    }
                                }
                            }
                        },
                        PartyLegalEntity = new PartyLegalEntityType[]
                        {
                            new PartyLegalEntityType
                            {
                                RegistrationName = "The buyercompany inc.",
                                CompanyID = new IdentifierType
                                {
                                    schemeAgencyID = "ZZZ",
                                    schemeID = "ZZZ",
                                    Value = "5645342123"
                                },
                                RegistrationAddress = new AddressType
                                {
                                    CityName = "Mainplace",
                                    CountrySubentity = "RegionB",
                                    Country = new CountryType
                                    {
                                        IdentificationCode = "BE"
                                    }
                                }
                            }
                        },
                        Contact = new ContactType
                        {
                            Telephone = "5121230",
                            Telefax = "5121231",
                            ElectronicMail = "*****@*****.**"
                        },
                        Person = new PersonType[]
                        {
                            new PersonType
                            {
                                FirstName = "John",
                                FamilyName = "X",
                                MiddleName = "Doe",
                                JobTitle = "Purchasing manager"
                            }
                        }
                    }
                },
                PayeeParty = new PartyType
                {
                    PartyIdentification = new PartyIdentificationType[]
                    {
                        new PartyIdentificationType
                        {
                            ID = new IdentifierType
                            {
                                schemeID = "GLN",
                                schemeAgencyID = "9",
                                Value = "098740918237"
                            }
                        }
                    },
                    PartyName = new PartyNameType[]
                    {
                        new PartyNameType
                        {
                            Name = "Ebeneser Scrooge Inc."
                        }
                    },
                    PartyLegalEntity = new PartyLegalEntityType[]
                    {
                        new PartyLegalEntityType
                        {
                            CompanyID = new IdentifierType
                            {
                                schemeID = "UK:CH",
                                schemeAgencyID = "ZZZ",
                                Value = "6411982340"
                            }
                        }
                    }
                },
                Delivery = new DeliveryType[]
                {
                    new DeliveryType
                    {
                        ActualDeliveryDate = "2009-12-15",
                        DeliveryLocation = new LocationType
                        {
                            ID = new IdentifierType
                            {
                                schemeID = "GLN",
                                schemeAgencyID = "9",
                                Value = "6754238987648"
                            },
                            Address = new AddressType
                            {
                                StreetName = "Deliverystreet",
                                AdditionalStreetName = "Side door",
                                BuildingNumber = "12",
                                CityName = "DeliveryCity",
                                PostalZone = "523427",
                                CountrySubentity = "RegionC",
                                Country = new CountryType
                                {
                                    IdentificationCode = "BE"
                                }
                            }
                        }
                    }
                },
                PaymentMeans = new PaymentMeansType[]
                {
                    new PaymentMeansType
                    {
                        PaymentMeansCode = new CodeType
                        {
                            listID = "UN/ECE 4461",
                            Value = "31"
                        },
                        PaymentDueDate = "2009-12-31",
                        PaymentChannelCode = "IBAN",
                        PaymentID = new IdentifierType[]
                        {
                            new IdentifierType
                            {
                                Value = "Payref1"
                            }
                        },
                        PayeeFinancialAccount = new FinancialAccountType
                        {
                            ID = "DK1212341234123412",
                            FinancialInstitutionBranch = new BranchType
                            {
                                FinancialInstitution = new FinancialInstitutionType
                                {
                                    ID = "DKDKABCD"
                                }
                            }
                        }
                    }
                },
                PaymentTerms = new PaymentTermsType[]
                {
                    new PaymentTermsType
                    {
                        Note = new TextType[]
                        {
                            new TextType
                            {
                                Value = "Penalty percentage 10% from due date"
                            }
                        }
                    }
                },
                AllowanceCharge = new AllowanceChargeType[]
                {
                    new AllowanceChargeType
                    {
                        ChargeIndicator = true,
                        AllowanceChargeReason = new TextType[]
                        {
                            new TextType
                            {
                                Value = "Packing cost"
                            }
                        },
                        Amount = new AmountType
                        {
                            currencyID = "EUR",
                            Value = 100M
                        }
                    },
                    new AllowanceChargeType
                    {
                        ChargeIndicator = false,
                        AllowanceChargeReason = new TextType[]
                        {
                            new TextType
                            {
                                Value = "Promotion discount"
                            }
                        },
                        Amount = new AmountType
                        {
                            currencyID = "EUR",
                            Value = 100M
                        }
                    }
                },
                TaxTotal = new TaxTotalType[]
                {
                    new TaxTotalType
                    {
                        TaxAmount = new AmountType
                        {
                            currencyID = "EUR",
                            Value = 292.20M
                        },
                        TaxSubtotal = new TaxSubtotalType[]
                        {
                            new TaxSubtotalType
                            {
                                TaxableAmount = new AmountType
                                {
                                    currencyID = "EUR",
                                    Value = 1460.5M
                                },
                                TaxAmount = new AmountType
                                {
                                    currencyID = "EUR",
                                    Value = 292.1M
                                },
                                TaxCategory = new TaxCategoryType
                                {
                                    ID = new IdentifierType
                                    {
                                        schemeID = "UN/ECE 5305",
                                        schemeAgencyID = "6",
                                        Value = "S"
                                    },
                                    Percent = 20M,
                                    TaxScheme = new TaxSchemeType
                                    {
                                        ID = new IdentifierType
                                        {
                                            schemeID = "UN/ECE 5153",
                                            schemeAgencyID = "6",
                                            Value = "VAT"
                                        }
                                    }
                                }
                            },
                            new TaxSubtotalType
                            {
                                TaxableAmount = new AmountType
                                {
                                    currencyID = "EUR",
                                    Value = 1M
                                },
                                TaxAmount = new AmountType
                                {
                                    currencyID = "EUR",
                                    Value = 0.1M
                                },
                                TaxCategory = new TaxCategoryType
                                {
                                    ID = new IdentifierType
                                    {
                                        schemeID = "UN/ECE 5305",
                                        schemeAgencyID = "6",
                                        Value = "AA"
                                    },
                                    Percent = 10M,
                                    TaxScheme = new TaxSchemeType
                                    {
                                        ID = new IdentifierType
                                        {
                                            schemeID = "UN/ECE 5153",
                                            schemeAgencyID = "6",
                                            Value = "VAT"
                                        }
                                    }
                                }
                            },
                            new TaxSubtotalType
                            {
                                TaxableAmount = new AmountType
                                {
                                    currencyID = "EUR",
                                    Value = -25M
                                },
                                TaxAmount = new AmountType
                                {
                                    currencyID = "EUR",
                                    Value = 0M
                                },
                                TaxCategory = new TaxCategoryType
                                {
                                    ID = new IdentifierType
                                    {
                                        schemeID = "UN/ECE 5305",
                                        schemeAgencyID = "6",
                                        Value = "E"
                                    },
                                    Percent = 0M,
                                    TaxExemptionReasonCode = new CodeType
                                    {
                                        listID = "CWA 15577",
                                        listAgencyID = "ZZZ",
                                        Value = "AAM"
                                    },
                                    TaxExemptionReason = new TextType[]
                                    {
                                        new TextType
                                        {
                                            Value = "Exempt New Means of Transport"
                                        }
                                    },
                                    TaxScheme = new TaxSchemeType
                                    {
                                        ID = new IdentifierType
                                        {
                                            schemeID = "UN/ECE 5153",
                                            schemeAgencyID = "6",
                                            Value = "VAT"
                                        }
                                    }
                                }
                            }
                        }
                    }
                },
                LegalMonetaryTotal = new MonetaryTotalType
                {
                    LineExtensionAmount = new AmountType
                    {
                        currencyID = "EUR",
                        Value = 1436.5M
                    },
                    TaxExclusiveAmount = new AmountType
                    {
                        currencyID = "EUR",
                        Value = 1436.5M
                    },
                    TaxInclusiveAmount = new AmountType
                    {
                        currencyID = "EUR",
                        Value = 1729M
                    },
                    AllowanceTotalAmount = new AmountType
                    {
                        currencyID = "EUR",
                        Value = 100M
                    },
                    ChargeTotalAmount = new AmountType
                    {
                        currencyID = "EUR",
                        Value = 100M
                    },
                    PrepaidAmount = new AmountType
                    {
                        currencyID = "EUR",
                        Value = 1000M
                    },
                    PayableRoundingAmount = new AmountType
                    {
                        currencyID = "EUR",
                        Value = 0.30M
                    },
                    PayableAmount = new AmountType
                    {
                        currencyID = "EUR",
                        Value = 729M
                    }
                },
                InvoiceLine = new InvoiceLineType[]
                {
                    new InvoiceLineType
                    {
                        ID = "1",
                        Note = new TextType[]
                        {
                            new TextType
                            {
                                Value = "Scratch on box"
                            }
                        },
                        InvoicedQuantity = new QuantityType
                        {
                            unitCode = "C62",
                            Value = 1M
                        },
                        LineExtensionAmount = new AmountType
                        {
                            currencyID = "EUR",
                            Value = 1273M
                        },
                        AccountingCost = "BookingCode001",
                        OrderLineReference = new OrderLineReferenceType[]
                        {
                            new OrderLineReferenceType
                            {
                                LineID = "1"
                            }
                        },
                        AllowanceCharge = new AllowanceChargeType[]
                        {
                            new AllowanceChargeType
                            {
                                ChargeIndicator = false,
                                AllowanceChargeReason = new TextType[]
                                {
                                    new TextType
                                    {
                                        Value = "Damage"
                                    }
                                },
                                Amount = new AmountType
                                {
                                    currencyID = "EUR",
                                    Value = 12M
                                }
                            },
                            new AllowanceChargeType
                            {
                                ChargeIndicator = true,
                                AllowanceChargeReason = new TextType[]
                                {
                                    new TextType
                                    {
                                        Value = "Testing"
                                    }
                                },
                                Amount = new AmountType
                                {
                                    currencyID = "EUR",
                                    Value = 10M
                                }
                            }
                        },
                        TaxTotal = new TaxTotalType[]
                        {
                            new TaxTotalType
                            {
                                TaxAmount = new AmountType
                                {
                                    currencyID = "EUR",
                                    Value = 254.6M
                                }
                            }
                        },
                        Item = new ItemType
                        {
                            Description = new TextType[]
                            {
                                new TextType
                                {
                                    languageID = "EN",
                                    Value = @"Processor: Intel Core 2 Duo SU9400 LV (1.4GHz). RAM:
				3MB. Screen 1440x900"
                                }
                            },
                            Name = "Labtop computer",
                            SellersItemIdentification = new ItemIdentificationType
                            {
                                ID = "JB007"
                            },
                            StandardItemIdentification = new ItemIdentificationType
                            {
                                ID = new IdentifierType
                                {
                                    schemeID = "GTIN",
                                    schemeAgencyID = "9",
                                    Value = "1234567890124"
                                }
                            },
                            CommodityClassification = new CommodityClassificationType[]
                            {
                                new CommodityClassificationType
                                {
                                    ItemClassificationCode = new CodeType
                                    {
                                        listAgencyID = "113",
                                        listID = "UNSPSC",
                                        Value = "12344321"
                                    }
                                },
                                new CommodityClassificationType
                                {
                                    ItemClassificationCode = new CodeType
                                    {
                                        listAgencyID = "2",
                                        listID = "CPV",
                                        Value = "65434568"
                                    }
                                }
                            },
                            ClassifiedTaxCategory = new TaxCategoryType[]
                            {
                                new TaxCategoryType
                                {
                                    ID = new IdentifierType
                                    {
                                        schemeID = "UN/ECE 5305",
                                        schemeAgencyID = "6",
                                        Value = "S"
                                    },
                                    Percent = 20M,
                                    TaxScheme = new TaxSchemeType
                                    {
                                        ID = new IdentifierType
                                        {
                                            schemeID = "UN/ECE 5153",
                                            schemeAgencyID = "6",
                                            Value = "VAT"
                                        }
                                    }
                                }
                            },
                            AdditionalItemProperty = new ItemPropertyType[]
                            {
                                new ItemPropertyType
                                {
                                    Name = "Color",
                                    Value = "black"
                                }
                            }
                        },
                        Price = new PriceType
                        {
                            PriceAmount = new AmountType
                            {
                                currencyID = "EUR",
                                Value = 1273M
                            },
                            BaseQuantity = new QuantityType
                            {
                                unitCode = "C62",
                                Value = 1M
                            },
                            AllowanceCharge = new AllowanceChargeType[]
                            {
                                new AllowanceChargeType
                                {
                                    ChargeIndicator = false,
                                    AllowanceChargeReason = new TextType[]
                                    {
                                        new TextType
                                        {
                                            Value = "Contract"
                                        }
                                    },
                                    MultiplierFactorNumeric = 0.15M,
                                    Amount = new AmountType
                                    {
                                        currencyID = "EUR",
                                        Value = 225M
                                    },
                                    BaseAmount = new AmountType
                                    {
                                        currencyID = "EUR",
                                        Value = 1500M
                                    }
                                }
                            }
                        }
                    },
                    new InvoiceLineType
                    {
                        ID = "2",
                        Note = new TextType[]
                        {
                            new TextType
                            {
                                Value = "Cover is slightly damaged."
                            }
                        },
                        InvoicedQuantity = new QuantityType
                        {
                            unitCode = "C62",
                            Value = -1M
                        },
                        LineExtensionAmount = new AmountType
                        {
                            currencyID = "EUR",
                            Value = -3.96M
                        },
                        OrderLineReference = new OrderLineReferenceType[]
                        {
                            new OrderLineReferenceType
                            {
                                LineID = "5"
                            }
                        },
                        TaxTotal = new TaxTotalType[]
                        {
                            new TaxTotalType
                            {
                                TaxAmount = new AmountType
                                {
                                    currencyID = "EUR",
                                    Value = -0.396M
                                }
                            }
                        },
                        Item = new ItemType
                        {
                            Name = "Returned \"Advanced computing\" book",
                            SellersItemIdentification = new ItemIdentificationType
                            {
                                ID = "JB008"
                            },
                            StandardItemIdentification = new ItemIdentificationType
                            {
                                ID = new IdentifierType
                                {
                                    schemeID = "GTIN",
                                    schemeAgencyID = "9",
                                    Value = "1234567890125"
                                }
                            },
                            CommodityClassification = new CommodityClassificationType[]
                            {
                                new CommodityClassificationType
                                {
                                    ItemClassificationCode = new CodeType
                                    {
                                        listAgencyID = "113",
                                        listID = "UNSPSC",
                                        Value = "32344324"
                                    }
                                },
                                new CommodityClassificationType
                                {
                                    ItemClassificationCode = new CodeType
                                    {
                                        listAgencyID = "2",
                                        listID = "CPV",
                                        Value = "65434567"
                                    }
                                }
                            },
                            ClassifiedTaxCategory = new TaxCategoryType[]
                            {
                                new TaxCategoryType
                                {
                                    ID = new IdentifierType
                                    {
                                        schemeID = "UN/ECE 5305",
                                        schemeAgencyID = "6",
                                        Value = "AA"
                                    },
                                    Percent = 10M,
                                    TaxScheme = new TaxSchemeType
                                    {
                                        ID = new IdentifierType
                                        {
                                            schemeID = "UN/ECE 5153",
                                            schemeAgencyID = "6",
                                            Value = "VAT"
                                        }
                                    }
                                }
                            }
                        },
                        Price = new PriceType
                        {
                            PriceAmount = new AmountType
                            {
                                currencyID = "EUR",
                                Value = 3.96M
                            },
                            BaseQuantity = new QuantityType
                            {
                                unitCode = "C62",
                                Value = 1M
                            }
                        }
                    },
                    new InvoiceLineType
                    {
                        ID = "3",
                        InvoicedQuantity = new QuantityType
                        {
                            unitCode = "C62",
                            Value = 2M
                        },
                        LineExtensionAmount = new AmountType
                        {
                            currencyID = "EUR",
                            Value = 4.96M
                        },
                        OrderLineReference = new OrderLineReferenceType[]
                        {
                            new OrderLineReferenceType
                            {
                                LineID = "3"
                            }
                        },
                        TaxTotal = new TaxTotalType[]
                        {
                            new TaxTotalType
                            {
                                TaxAmount = new AmountType
                                {
                                    currencyID = "EUR",
                                    Value = 0.496M
                                }
                            }
                        },
                        Item = new ItemType
                        {
                            Name = "\"Computing for dummies\" book",
                            SellersItemIdentification = new ItemIdentificationType
                            {
                                ID = "JB009"
                            },
                            StandardItemIdentification = new ItemIdentificationType
                            {
                                ID = new IdentifierType
                                {
                                    schemeID = "GTIN",
                                    schemeAgencyID = "9",
                                    Value = "1234567890126"
                                }
                            },
                            CommodityClassification = new CommodityClassificationType[]
                            {
                                new CommodityClassificationType
                                {
                                    ItemClassificationCode = new CodeType
                                    {
                                        listAgencyID = "113",
                                        listID = "UNSPSC",
                                        Value = "32344324"
                                    }
                                },
                                new CommodityClassificationType
                                {
                                    ItemClassificationCode = new CodeType
                                    {
                                        listAgencyID = "2",
                                        listID = "CPV",
                                        Value = "65434566"
                                    }
                                }
                            },
                            ClassifiedTaxCategory = new TaxCategoryType[]
                            {
                                new TaxCategoryType
                                {
                                    ID = new IdentifierType
                                    {
                                        schemeID = "UN/ECE 5305",
                                        schemeAgencyID = "6",
                                        Value = "AA"
                                    },
                                    Percent = 10M,
                                    TaxScheme = new TaxSchemeType
                                    {
                                        ID = new IdentifierType
                                        {
                                            schemeID = "UN/ECE 5153",
                                            schemeAgencyID = "6",
                                            Value = "VAT"
                                        }
                                    }
                                }
                            }
                        },
                        Price = new PriceType
                        {
                            PriceAmount = new AmountType
                            {
                                currencyID = "EUR",
                                Value = 2.48M
                            },
                            BaseQuantity = new QuantityType
                            {
                                unitCode = "C62",
                                Value = 1M
                            },
                            AllowanceCharge = new AllowanceChargeType[]
                            {
                                new AllowanceChargeType
                                {
                                    ChargeIndicator = false,
                                    AllowanceChargeReason = new TextType[]
                                    {
                                        new TextType
                                        {
                                            Value = "Contract"
                                        }
                                    },
                                    MultiplierFactorNumeric = 0.1M,
                                    Amount = new AmountType
                                    {
                                        currencyID = "EUR",
                                        Value = 0.275M
                                    },
                                    BaseAmount = new AmountType
                                    {
                                        currencyID = "EUR",
                                        Value = 2.75M
                                    }
                                }
                            }
                        }
                    },
                    new InvoiceLineType
                    {
                        ID = "4",
                        InvoicedQuantity = new QuantityType
                        {
                            unitCode = "C62",
                            Value = -1M
                        },
                        LineExtensionAmount = new AmountType
                        {
                            currencyID = "EUR",
                            Value = -25M
                        },
                        OrderLineReference = new OrderLineReferenceType[]
                        {
                            new OrderLineReferenceType
                            {
                                LineID = "2"
                            }
                        },
                        TaxTotal = new TaxTotalType[]
                        {
                            new TaxTotalType
                            {
                                TaxAmount = new AmountType
                                {
                                    currencyID = "EUR",
                                    Value = 0M
                                }
                            }
                        },
                        Item = new ItemType
                        {
                            Name = "Returned IBM 5150 desktop",
                            SellersItemIdentification = new ItemIdentificationType
                            {
                                ID = "JB010"
                            },
                            StandardItemIdentification = new ItemIdentificationType
                            {
                                ID = new IdentifierType
                                {
                                    schemeID = "GTIN",
                                    schemeAgencyID = "9",
                                    Value = "1234567890127"
                                }
                            },
                            CommodityClassification = new CommodityClassificationType[]
                            {
                                new CommodityClassificationType
                                {
                                    ItemClassificationCode = new CodeType
                                    {
                                        listAgencyID = "113",
                                        listID = "UNSPSC",
                                        Value = "12344322"
                                    }
                                },
                                new CommodityClassificationType
                                {
                                    ItemClassificationCode = new CodeType
                                    {
                                        listAgencyID = "2",
                                        listID = "CPV",
                                        Value = "65434565"
                                    }
                                }
                            },
                            ClassifiedTaxCategory = new TaxCategoryType[]
                            {
                                new TaxCategoryType
                                {
                                    ID = new IdentifierType
                                    {
                                        schemeID = "UN/ECE 5305",
                                        schemeAgencyID = "6",
                                        Value = "E"
                                    },
                                    Percent = 0M,
                                    TaxScheme = new TaxSchemeType
                                    {
                                        ID = new IdentifierType
                                        {
                                            schemeID = "UN/ECE 5153",
                                            schemeAgencyID = "6",
                                            Value = "VAT"
                                        }
                                    }
                                }
                            }
                        },
                        Price = new PriceType
                        {
                            PriceAmount = new AmountType
                            {
                                currencyID = "EUR",
                                Value = 25M
                            },
                            BaseQuantity = new QuantityType
                            {
                                unitCode = "C62",
                                Value = 1M
                            }
                        }
                    },
                    new InvoiceLineType
                    {
                        ID = "5",
                        InvoicedQuantity = new QuantityType
                        {
                            unitCode = "C62",
                            Value = 250M
                        },
                        LineExtensionAmount = new AmountType
                        {
                            currencyID = "EUR",
                            Value = 187.5M
                        },
                        AccountingCost = "BookingCode002",
                        OrderLineReference = new OrderLineReferenceType[]
                        {
                            new OrderLineReferenceType
                            {
                                LineID = "4"
                            }
                        },
                        TaxTotal = new TaxTotalType[]
                        {
                            new TaxTotalType
                            {
                                TaxAmount = new AmountType
                                {
                                    currencyID = "EUR",
                                    Value = 37.5M
                                }
                            }
                        },
                        Item = new ItemType
                        {
                            Name = "Network cable",
                            SellersItemIdentification = new ItemIdentificationType
                            {
                                ID = "JB011"
                            },
                            StandardItemIdentification = new ItemIdentificationType
                            {
                                ID = new IdentifierType
                                {
                                    schemeID = "GTIN",
                                    schemeAgencyID = "9",
                                    Value = "1234567890128"
                                }
                            },
                            CommodityClassification = new CommodityClassificationType[]
                            {
                                new CommodityClassificationType
                                {
                                    ItemClassificationCode = new CodeType
                                    {
                                        listAgencyID = "113",
                                        listID = "UNSPSC",
                                        Value = "12344325"
                                    }
                                },
                                new CommodityClassificationType
                                {
                                    ItemClassificationCode = new CodeType
                                    {
                                        listAgencyID = "2",
                                        listID = "CPV",
                                        Value = "65434564"
                                    }
                                }
                            },
                            ClassifiedTaxCategory = new TaxCategoryType[]
                            {
                                new TaxCategoryType
                                {
                                    ID = new IdentifierType
                                    {
                                        schemeID = "UN/ECE 5305",
                                        schemeAgencyID = "6",
                                        Value = "S"
                                    },
                                    Percent = 20M,
                                    TaxScheme = new TaxSchemeType
                                    {
                                        ID = new IdentifierType
                                        {
                                            schemeID = "UN/ECE 5153",
                                            schemeAgencyID = "6",
                                            Value = "VAT"
                                        }
                                    }
                                }
                            },
                            AdditionalItemProperty = new ItemPropertyType[]
                            {
                                new ItemPropertyType
                                {
                                    Name = "Type",
                                    Value = "Cat5"
                                }
                            }
                        },
                        Price = new PriceType
                        {
                            PriceAmount = new AmountType
                            {
                                currencyID = "EUR",
                                Value = 0.75M
                            },
                            BaseQuantity = new QuantityType
                            {
                                unitCode = "C62",
                                Value = 1M
                            }
                        }
                    }
                }
            };
            doc.Xmlns = new System.Xml.Serialization.XmlSerializerNamespaces(new[]
            {
                new XmlQualifiedName("cac","urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2"),
                new XmlQualifiedName("cbc","urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2"),
            });
            return doc;
        }
        public static InvoiceType Create()
        {
            var doc = new InvoiceType
            {
                UBLVersionID = "2.0",
                CustomizationID = "urn:oasis:names:specification:ubl:xpath:Invoice-2.0:sbs-1.0-draft",
                ProfileID = "bpid:urn:oasis:names:draft:bpss:ubl-2-sbs-invoice-notification-draft",
                ID = "A00095678",
                CopyIndicator = false,
                UUID = "849FBBCE-E081-40B4-906C-94C5FF9D1AC3",
                IssueDate = "2005-06-21",
                InvoiceTypeCode = "SalesInvoice",
                Note = new TextType[]
                {
                    new TextType
                    {
                        Value = "sample"
                    }
                },
                TaxPointDate = "2005-06-21",
                OrderReference = new OrderReferenceType
                {
                    ID = "AEG012345",
                    SalesOrderID = "CON0095678",
                    UUID = "6E09886B-DC6E-439F-82D1-7CCAC7F4E3B1",
                    IssueDate = "2005-06-20"
                },
                AccountingSupplierParty = new SupplierPartyType
                {
                    CustomerAssignedAccountID = "CO001",
                    Party = new PartyType
                    {
                        PartyName = new PartyNameType[]
                        {
                            new PartyNameType
                            {
                                Name = "Consortial"
                            }
                        },
                        PostalAddress = new AddressType
                        {
                            StreetName = "Busy Street",
                            BuildingName = "Thereabouts",
                            BuildingNumber = "56A",
                            CityName = "Farthing",
                            PostalZone = "AA99 1BB",
                            CountrySubentity = "Heremouthshire",
                            AddressLine = new AddressLineType[]
                            {
                                new AddressLineType
                                {
                                    Line = "The Roundabout"
                                }
                            },
                            Country = new CountryType
                            {
                                IdentificationCode = "GB"
                            }
                        },
                        PartyTaxScheme = new PartyTaxSchemeType[]
                        {
                            new PartyTaxSchemeType
                            {
                                RegistrationName = "Farthing Purchasing Consortium",
                                CompanyID = "175 269 2355",
                                ExemptionReason = new TextType[]
                                {
                                    new TextType
                                    {
                                        Value = "N/A"
                                    }
                                },
                                TaxScheme = new TaxSchemeType
                                {
                                    ID = "VAT",
                                    TaxTypeCode = "VAT"
                                }
                            }
                        },
                        Contact = new ContactType
                        {
                            Name = "Mrs Bouquet",
                            Telephone = "0158 1233714",
                            Telefax = "0158 1233856",
                            ElectronicMail = "*****@*****.**"
                        }
                    }
                },
                AccountingCustomerParty = new CustomerPartyType
                {
                    CustomerAssignedAccountID = "XFB01",
                    SupplierAssignedAccountID = "GT00978567",
                    Party = new PartyType
                    {
                        PartyName = new PartyNameType[]
                        {
                            new PartyNameType
                            {
                                Name = "IYT Corporation"
                            }
                        },
                        PostalAddress = new AddressType
                        {
                            StreetName = "Avon Way",
                            BuildingName = "Thereabouts",
                            BuildingNumber = "56A",
                            CityName = "Bridgtow",
                            PostalZone = "ZZ99 1ZZ",
                            CountrySubentity = "Avon",
                            AddressLine = new AddressLineType[]
                            {
                                new AddressLineType
                                {
                                    Line = "3rd Floor, Room 5"
                                }
                            },
                            Country = new CountryType
                            {
                                IdentificationCode = "GB"
                            }
                        },
                        PartyTaxScheme = new PartyTaxSchemeType[]
                        {
                            new PartyTaxSchemeType
                            {
                                RegistrationName = "Bridgtow District Council",
                                CompanyID = "12356478",
                                ExemptionReason = new TextType[]
                                {
                                    new TextType
                                    {
                                        Value = "Local Authority"
                                    }
                                },
                                TaxScheme = new TaxSchemeType
                                {
                                    ID = "UK VAT",
                                    TaxTypeCode = "VAT"
                                }
                            }
                        },
                        Contact = new ContactType
                        {
                            Name = "Mr Fred Churchill",
                            Telephone = "0127 2653214",
                            Telefax = "0127 2653215",
                            ElectronicMail = "*****@*****.**"
                        }
                    }
                },
                Delivery = new DeliveryType[]
                {
                    new DeliveryType
                    {
                        ActualDeliveryDate = "2005-06-20",
                        ActualDeliveryTime = "11:30:00.0Z",
                        DeliveryAddress = new AddressType
                        {
                            StreetName = "Avon Way",
                            BuildingName = "Thereabouts",
                            BuildingNumber = "56A",
                            CityName = "Bridgtow",
                            PostalZone = "ZZ99 1ZZ",
                            CountrySubentity = "Avon",
                            AddressLine = new AddressLineType[]
                            {
                                new AddressLineType
                                {
                                    Line = "3rd Floor, Room 5"
                                }
                            },
                            Country = new CountryType
                            {
                                IdentificationCode = "GB"
                            }
                        }
                    }
                },
                PaymentMeans = new PaymentMeansType[]
                {
                    new PaymentMeansType
                    {
                        PaymentMeansCode = "20",
                        PaymentDueDate = "2005-07-21",
                        PayeeFinancialAccount = new FinancialAccountType
                        {
                            ID = "12345678",
                            Name = "Farthing Purchasing Consortium",
                            AccountTypeCode = "Current",
                            CurrencyCode = "GBP",
                            FinancialInstitutionBranch = new BranchType
                            {
                                ID = "10-26-58",
                                Name = "Open Bank Ltd, Bridgstow Branch ",
                                FinancialInstitution = new FinancialInstitutionType
                                {
                                    ID = "10-26-58",
                                    Name = "Open Bank Ltd",
                                    Address = new AddressType
                                    {
                                        StreetName = "City Road",
                                        BuildingName = "Banking House",
                                        BuildingNumber = "12",
                                        CityName = "London",
                                        PostalZone = "AQ1 6TH",
                                        CountrySubentity = @"London
",
                                        AddressLine = new AddressLineType[]
                                        {
                                            new AddressLineType
                                            {
                                                Line = "5th Floor"
                                            }
                                        },
                                        Country = new CountryType
                                        {
                                            IdentificationCode = "GB"
                                        }
                                    }
                                },
                                Address = new AddressType
                                {
                                    StreetName = "Busy Street",
                                    BuildingName = "The Mall",
                                    BuildingNumber = "152",
                                    CityName = "Farthing",
                                    PostalZone = "AA99 1BB",
                                    CountrySubentity = "Heremouthshire",
                                    AddressLine = new AddressLineType[]
                                    {
                                        new AddressLineType
                                        {
                                            Line = "West Wing"
                                        }
                                    },
                                    Country = new CountryType
                                    {
                                        IdentificationCode = "GB"
                                    }
                                }
                            },
                            Country = new CountryType
                            {
                                IdentificationCode = "GB"
                            }
                        }
                    }
                },
                PaymentTerms = new PaymentTermsType[]
                {
                    new PaymentTermsType
                    {
                        Note = new TextType[]
                        {
                            new TextType
                            {
                                Value = "Payable within 1 calendar month from the invoice date"
                            }
                        }
                    }
                },
                AllowanceCharge = new AllowanceChargeType[]
                {
                    new AllowanceChargeType
                    {
                        ChargeIndicator = false,
                        AllowanceChargeReasonCode = "17",
                        MultiplierFactorNumeric = 0.10M,
                        Amount = new AmountType
                        {
                            currencyID = "GBP",
                            Value = 10.00M
                        }
                    }
                },
                TaxTotal = new TaxTotalType[]
                {
                    new TaxTotalType
                    {
                        TaxAmount = new AmountType
                        {
                            currencyID = "GBP",
                            Value = 17.50M
                        },
                        TaxEvidenceIndicator = true,
                        TaxSubtotal = new TaxSubtotalType[]
                        {
                            new TaxSubtotalType
                            {
                                TaxableAmount = new AmountType
                                {
                                    currencyID = "GBP",
                                    Value = 100.00M
                                },
                                TaxAmount = new AmountType
                                {
                                    currencyID = "GBP",
                                    Value = 17.50M
                                },
                                TaxCategory = new TaxCategoryType
                                {
                                    ID = "A",
                                    TaxScheme = new TaxSchemeType
                                    {
                                        ID = "UK VAT",
                                        TaxTypeCode = "VAT"
                                    }
                                }
                            }
                        }
                    }
                },
                LegalMonetaryTotal = new MonetaryTotalType
                {
                    LineExtensionAmount = new AmountType
                    {
                        currencyID = "GBP",
                        Value = 100.00M
                    },
                    TaxExclusiveAmount = new AmountType
                    {
                        currencyID = "GBP",
                        Value = 90.00M
                    },
                    AllowanceTotalAmount = new AmountType
                    {
                        currencyID = "GBP",
                        Value = 10.00M
                    },
                    PayableAmount = new AmountType
                    {
                        currencyID = "GBP",
                        Value = 107.50M
                    }
                },
                InvoiceLine = new InvoiceLineType[]
                {
                    new InvoiceLineType
                    {
                        ID = "A",
                        InvoicedQuantity = new QuantityType
                        {
                            unitCode = "KGM",
                            Value = 100M
                        },
                        LineExtensionAmount = new AmountType
                        {
                            currencyID = "GBP",
                            Value = 100.00M
                        },
                        OrderLineReference = new OrderLineReferenceType[]
                        {
                            new OrderLineReferenceType
                            {
                                LineID = "1",
                                SalesOrderLineID = "A",
                                LineStatusCode = "NoStatus",
                                OrderReference = new OrderReferenceType
                                {
                                    ID = "AEG012345",
                                    SalesOrderID = "CON0095678",
                                    UUID = "6E09886B-DC6E-439F-82D1-7CCAC7F4E3B1",
                                    IssueDate = "2005-06-20"
                                }
                            }
                        },
                        TaxTotal = new TaxTotalType[]
                        {
                            new TaxTotalType
                            {
                                TaxAmount = new AmountType
                                {
                                    currencyID = "GBP",
                                    Value = 17.50M
                                },
                                TaxEvidenceIndicator = true,
                                TaxSubtotal = new TaxSubtotalType[]
                                {
                                    new TaxSubtotalType
                                    {
                                        TaxableAmount = new AmountType
                                        {
                                            currencyID = "GBP",
                                            Value = 100.00M
                                        },
                                        TaxAmount = new AmountType
                                        {
                                            currencyID = "GBP",
                                            Value = 17.50M
                                        },
                                        TaxCategory = new TaxCategoryType
                                        {
                                            ID = "A",
                                            Percent = 17.5M,
                                            TaxScheme = new TaxSchemeType
                                            {
                                                ID = "UK VAT",
                                                TaxTypeCode = "VAT"
                                            }
                                        }
                                    }
                                }
                            }
                        },
                        Item = new ItemType
                        {
                            Description = new TextType[]
                            {
                                new TextType
                                {
                                    Value = "Acme beeswax"
                                }
                            },
                            Name = "beeswax",
                            BuyersItemIdentification = new ItemIdentificationType
                            {
                                ID = "6578489"
                            },
                            SellersItemIdentification = new ItemIdentificationType
                            {
                                ID = "17589683"
                            },
                            ItemInstance = new ItemInstanceType[]
                            {
                                new ItemInstanceType
                                {
                                    LotIdentification = new LotIdentificationType
                                    {
                                        LotNumberID = "546378239",
                                        ExpiryDate = "2010-01-01"
                                    }
                                }
                            }
                        },
                        Price = new PriceType
                        {
                            PriceAmount = new AmountType
                            {
                                currencyID = "GBP",
                                Value = 1.00M
                            },
                            BaseQuantity = new QuantityType
                            {
                                unitCode = "KGM",
                                Value = 1M
                            }
                        }
                    }
                }
            };
            doc.Xmlns = new System.Xml.Serialization.XmlSerializerNamespaces(new[]
            {
                new XmlQualifiedName("Harry","urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2"),
                new XmlQualifiedName("Sally","urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2"),
                new XmlQualifiedName("Bob","urn:oasis:names:specification:ubl:schema:xsd:Invoice-2"),
            });
            return doc;
        }
        public void SaveImplicitCreatedNorwegianInvoice()
        {
            Func<decimal, AmountType> newAmountType = v => new AmountType { Value = v, currencyID = "NOK" };
            var taxVAT = new TaxSchemeType { ID = "VAT" };
            // Create an invoice using global defaults set above
            InvoiceType doc = new InvoiceType
            {
                CustomizationID = "urn:www.cenbii.eu:transaction:biicoretrdm010:ver1.0",
                ProfileID = "urn:www.cenbii.eu:profile:bii05:ver1.0",
                ID = "123456",
                IssueDate = new DateTime(2009, 11, 12),
                DocumentCurrencyCode = "NOK",
                OrderReference = new OrderReferenceType { ID = "Prosjekt 13" },
                ContractDocumentReference = new DocumentReferenceType[] { new DocumentReferenceType { ID = "K987654321" } },
                AccountingSupplierParty = new SupplierPartyType
                {
                    Party = new PartyType
                    {
                        PartyName = new PartyNameType[] { new PartyNameType { Name = "Leverandør" } },
                        PostalAddress = new AddressType
                        {
                            Postbox = "Postboks 123",
                            StreetName = "Oslogate",
                            BuildingNumber = "1",
                            CityName = "Oslo",
                            PostalZone = "0612",
                            Country = new CountryType { IdentificationCode = "NO" },
                        },
                        PartyTaxScheme = new PartyTaxSchemeType[]
                        {
                            new PartyTaxSchemeType 
                            {
                                CompanyID = "NO999999999MVA",
                                TaxScheme = new TaxSchemeType 
                                { 
                                    ID = new IdentifierType 
                                    { 
                                        schemeID = "UN/ECE 5153",
                                        schemeAgencyID = "6",
                                        Value = "VAT"
                                    } 
                                }
                            }
                        },
                        PartyLegalEntity = new PartyLegalEntityType[] 
                        {
                            new PartyLegalEntityType { CompanyID = "999999999" }
                        },
                        Contact = new ContactType { ID = "O Hansen" },

                    }
                },
                AccountingCustomerParty = new CustomerPartyType
                {
                    Party = new PartyType
                    {
                        PartyIdentification = new [] { new PartyIdentificationType { ID = "456789" } },
                        PartyName = new [] { new PartyNameType { Name = "Kjøper" } },
                        PostalAddress = new AddressType
                        {
                            StreetName = "Testveien",
                            BuildingNumber = "1",
                            CityName = "Frogner",
                            PostalZone = "2012",
                            Country = new CountryType { IdentificationCode = "NO" }
                        },
                        PartyLegalEntity = new PartyLegalEntityType[]
                        {
                            new PartyLegalEntityType { CompanyID = "NO888888888MVA" }
                        },
                        Contact = new ContactType { ID = "Arne Bjarne Baluba" }
                    }
                },
                Delivery = new DeliveryType[]
                {
                    new DeliveryType 
                    {
                        ActualDeliveryDate =  new DateTime(2009,11,25),
                        DeliveryLocation = new LocationType
                        {
                            Address = new AddressType 
                            {
                                StreetName = "Testgata",
                                BuildingNumber = "1",
                                CityName = "Oslo",
                                PostalZone = "0112",
                                Country = new CountryType { IdentificationCode = "NO"}
                            }
                        }
                    }
                },
                PaymentMeans = new PaymentMeansType[]
                {
                    new PaymentMeansType
                    {
                        PaymentMeansCode = "31",
                        PaymentDueDate = new DateTime(2009, 11, 27),
                        PaymentID = new Ubl2.Udt.IdentifierType[] { "1234561" },
                        PayeeFinancialAccount = new FinancialAccountType
                        {
                            ID = "NO9386011117947",
                            FinancialInstitutionBranch = new BranchType
                            {
                                ID = new IdentifierType { schemeID="BIC", Value="DNBANOKK"},
                            }
                        }
                    }
                },
                TaxTotal = new TaxTotalType[]
                {
                    new TaxTotalType 
                    {
                        TaxAmount = newAmountType(962.0M),
                        TaxSubtotal = new TaxSubtotalType[]
                        {
                            new TaxSubtotalType 
                            {
                                TaxableAmount = newAmountType(3400.0M),
                                TaxAmount = newAmountType(850.0M),
                                TaxCategory = new TaxCategoryType 
                                { 
                                    ID = "S" ,
                                    Percent = 25.0M,
                                    TaxScheme = taxVAT
                                }
                            },
                            new TaxSubtotalType
                            {
                                TaxableAmount = newAmountType(800.0M),
                                TaxAmount = newAmountType(112.0M),
                                TaxCategory = new TaxCategoryType
                                {
                                    ID = "AA",
                                    Percent = 8.0M,
                                    TaxScheme = taxVAT
                                }
                            }
                        }
                    }
                },
                LegalMonetaryTotal = new MonetaryTotalType
                {
                    LineExtensionAmount = newAmountType(4200.0M),
                    TaxExclusiveAmount = newAmountType(4200.0M),
                    TaxInclusiveAmount = newAmountType(5162.0M),
                    PayableAmount = newAmountType(5162.0M)
                },
                InvoiceLine = new InvoiceLineType[] 
                { 
                    new InvoiceLineType
                    {
                        ID = "1",
                        InvoicedQuantity = new  Ubl2.Udt.QuantityType { unitCode="NMP", Value=2 },
                        LineExtensionAmount = newAmountType(400.0M),
                        AccountingCost = "200500600",
                        OrderLineReference = new OrderLineReferenceType[]
                        {
                            new OrderLineReferenceType { LineID = "5" }
                        },
                        TaxTotal = new TaxTotalType[]
                        {
                            new TaxTotalType { TaxAmount = newAmountType(100.0M) }
                        },
                        Item = new ItemType
                        {
                            Name = "Testprodukt 1",
                            SellersItemIdentification = new ItemIdentificationType { ID = "12345670" },
                            ClassifiedTaxCategory = new TaxCategoryType[] 
                            {
                                new TaxCategoryType 
                                { 
                                    ID = "S" ,
                                    Percent = 25.0M,
                                    TaxScheme = taxVAT
                                }
                            }
                        },
                        Price = new PriceType { PriceAmount = newAmountType(200.0M) } 
                    },
                    new InvoiceLineType
                    {
                        ID = "2" ,
                        InvoicedQuantity = new QuantityType { unitCode="NAR", Value=20 },
                        LineExtensionAmount = newAmountType(3000.0M) ,
                        AccountingCost = "200900600",
                        OrderLineReference = new OrderLineReferenceType[]
                        {
                            new OrderLineReferenceType { LineID = "7" }
                        },
                        TaxTotal = new TaxTotalType[]
                        {
                            new TaxTotalType { TaxAmount = newAmountType(750.0M) }
                        },
                        Item = new ItemType
                        {
                            Name = "Testprodukt 2",
                            SellersItemIdentification = new ItemIdentificationType { ID = "24683432" },
                            ClassifiedTaxCategory = new TaxCategoryType[] 
                            {
                                new TaxCategoryType 
                                { 
                                    ID = "S",
                                    Percent = 25.0M,
                                    TaxScheme = taxVAT
                                }
                            }
                        },
                        Price = new PriceType { PriceAmount = newAmountType(150.0M) }
                    },
                    new InvoiceLineType
                    {
                        ID = "3",
                        InvoicedQuantity = new QuantityType { unitCode="KGM", Value=8 },
                        LineExtensionAmount = newAmountType(800.0M),
                        AccountingCost = "200600700",
                        OrderLineReference = new OrderLineReferenceType[]
                        {
                            new OrderLineReferenceType { LineID = "8" }
                        },
                        TaxTotal = new TaxTotalType[]
                        {
                            new TaxTotalType { TaxAmount = newAmountType(112.0M) }
                        },
                        Item = new ItemType
                        {
                            Name = "Matprodukt 1",
                            SellersItemIdentification = new ItemIdentificationType { ID = "23456785" },
                            ClassifiedTaxCategory = new TaxCategoryType[] 
                            {
                                new TaxCategoryType 
                                { 
                                    ID = "AA",
                                    Percent = 8.0M,
                                    TaxScheme = taxVAT
                                }
                            }
                        },
                        Price = new PriceType { PriceAmount = newAmountType(100.0M) } 
                    }
                }
            };

            string filename = "SampleImplicitInvoice.xml";
            UblDoc<InvoiceType>.Save(filename, doc);

            // Use schema validation
            string xmlSchemaFilename = @"..\..\..\UBL-2.1\xsd\maindoc\UBL-Invoice-2.1.xsd";
            string preloadToAvoidExceptionFilename = @"..\..\..\UBL-2.1\xsd\common\UBL-xmldsig-core-schema-2.1.xsd";
            XmlSchemaSet invoiceSchemaSet = new XmlSchemaSet();
            // invoiceSchemaSet.Add(null, preloadToAvoidExceptionFilename); // bombs out!
            using (XmlTextReader tr = new XmlTextReader(preloadToAvoidExceptionFilename))
            {
                invoiceSchemaSet.Add(XmlSchema.Read(tr, null));
            }
            invoiceSchemaSet.Add(null, xmlSchemaFilename);
            invoiceSchemaSet.Compile();

            XDocument xDoc = XDocument.Load(filename);
            // throw if invalid
            System.Xml.Schema.Extensions.Validate(xDoc, invoiceSchemaSet, null);
        }