How do I fix my namespace issues in my XML export file from UBL XSD

0
I am trying to generate a XML file in UBL. I've imported the following UBL-Invoice-2.1.XSD file: https://docs.oasis-open.org/ubl/os-UBL-2.1/xsd/maindoc/UBL-Invoice-2.1.xsd   I've also downloaded all the other .XSD files in the maindoc and common folders at the following link: https://docs.oasis-open.org/ubl/os-UBL-2.1/xsd/ The import goes well however when I export a XML file I get issues with namespaces.  <ns2:UBLVersionID xmlns:ns2="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2">2.1</ns2:UBLVersionID> I am getting ns2: and a long string with the namespace. This is not supposed to happen. What there is supposed to be is: <cbc:UBLVersionID>2.1</cbc:UBLVersionID> An example file how it is supposed to look can be found here: https://docs.oasis-open.org/ubl/os-UBL-2.1/xml/UBL-Invoice-2.1-Example.xml   Does anyone have any ideas how I can fix this?    
asked
1 answers
0

My entire exported XML file:

 

<?xml version="1.0" encoding="utf-8"?>
<ns1:Invoice xmlns:ns1="urn:oasis:names:specification:ubl:schema:xsd:Invoice-2">
    <ns2:UBLVersionID
        xmlns:ns2="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2">2.1</ns2:UBLVersionID>
    <ns2:CustomizationID
        xmlns:ns2="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2">urn:www.cenbii.eu:transaction:biitrns010:ver2.0:extended:urn:www.peppol.eu:bis:peppol4a:ver2.0:extended:urn:www.simplerinvoicing.org:si:si-ubl:ver1.1.x
        RECHTSTREEKS UIT VOORBEELD GEKOPIEERD</ns2:CustomizationID>
    <ns2:ProfileID xmlns:ns2="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2">urn:www.cenbii.eu:profile:bii04:ver2.0
        RECHTSTREEKS UIT VOORBEELD GEKOPIEERD</ns2:ProfileID>
    <ns2:ID xmlns:ns2="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2">
        testdata</ns2:ID>
    <ns2:IssueDate xmlns:ns2="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2">
        2024-04-25</ns2:IssueDate>
    <ns2:InvoiceTypeCode
        xmlns:ns2="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2">1</ns2:InvoiceTypeCode>
    <ns2:DocumentCurrencyCode
        xmlns:ns2="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2">EUR</ns2:DocumentCurrencyCode>
    <ns3:OrderReference
        xmlns:ns3="urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2">
        <ns2:ID xmlns:ns2="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2">
            HIERMOETIETSKOMEN</ns2:ID>
    </ns3:OrderReference>
    <ns3:AccountingSupplierParty
        xmlns:ns3="urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2">
        <ns3:Party>
            <ns3:PartyName>
                <ns2:Name
                    xmlns:ns2="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2">testdata</ns2:Name>
            </ns3:PartyName>
            <ns3:PostalAddress>
                <ns2:StreetName
                    xmlns:ns2="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2">
                    test</ns2:StreetName>
                <ns2:BuildingNumber
                    xmlns:ns2="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2">
                    1</ns2:BuildingNumber>
                <ns2:CityName
                    xmlns:ns2="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2">
                    test</ns2:CityName>
                <ns2:PostalZone
                    xmlns:ns2="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2">Postcode</ns2:PostalZone>
                <ns3:Country>
                    <ns2:IdentificationCode
                        xmlns:ns2="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2"
                        listID="ISO3166-1:Alpha2" listAgencyID="6">NL</ns2:IdentificationCode>
                </ns3:Country>
            </ns3:PostalAddress>
            <ns3:PartyTaxScheme>
                <ns2:CompanyID
                    xmlns:ns2="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2"
                    schemeID="NL:VAT" schemeAgencyID="ZZZ">test</ns2:CompanyID>
                <ns3:TaxScheme>
                    <ns2:ID
                        xmlns:ns2="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2"
                        schemeID="UN/ECE 5153" schemeAgencyID="6">test</ns2:ID>
                </ns3:TaxScheme>
            </ns3:PartyTaxScheme>
            <ns3:PartyLegalEntity>
                <ns2:CompanyID
                    xmlns:ns2="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2"
                    schemeID="NL:KVK">test</ns2:CompanyID>
            </ns3:PartyLegalEntity>
            <ns3:Contact>
                <ns2:ElectronicMail
                    xmlns:ns2="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2">
                    test</ns2:ElectronicMail>
            </ns3:Contact>
        </ns3:Party>
    </ns3:AccountingSupplierParty>
    <ns3:AccountingCustomerParty
        xmlns:ns3="urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2">
        <ns3:Party>
            <ns3:PartyName>
                <ns2:Name
                    xmlns:ns2="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2">
                    flopi7</ns2:Name>
            </ns3:PartyName>
            <ns3:PostalAddress>
                <ns2:StreetName
                    xmlns:ns2="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2">
                    test</ns2:StreetName>
                <ns2:BuildingNumber
                    xmlns:ns2="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2">
                    2</ns2:BuildingNumber>
                <ns2:CityName
                    xmlns:ns2="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2">
                    test</ns2:CityName>
                <ns2:PostalZone
                    xmlns:ns2="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2">test</ns2:PostalZone>
            </ns3:PostalAddress>
            <ns3:PartyLegalEntity />
        </ns3:Party>
    </ns3:AccountingCustomerParty>
    <ns3:PaymentMeans
        xmlns:ns3="urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2">
        <ns2:PaymentMeansCode
            xmlns:ns2="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2"
            listID="UNCL4461">test</ns2:PaymentMeansCode>
        <ns3:PayeeFinancialAccount>
            <ns2:ID xmlns:ns2="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2">
                test</ns2:ID>
            <ns3:FinancialInstitutionBranch>
                <ns3:FinancialInstitution>
                    <ns2:ID
                        xmlns:ns2="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2">
                        test</ns2:ID>
                </ns3:FinancialInstitution>
            </ns3:FinancialInstitutionBranch>
        </ns3:PayeeFinancialAccount>
    </ns3:PaymentMeans>
    <ns3:PaymentTerms
        xmlns:ns3="urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2">
        <ns2:Note xmlns:ns2="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2">Ttest</ns2:Note>
    </ns3:PaymentTerms>
    <ns3:TaxTotal
        xmlns:ns3="urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2">
        <ns2:TaxAmount
            xmlns:ns2="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2"
            currencyID="EUR">test</ns2:TaxAmount>
        <ns3:TaxSubtotal>
            <ns2:TaxableAmount
                xmlns:ns2="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2"
                currencyID="EUR">test</ns2:TaxableAmount>
            <ns2:TaxAmount
                xmlns:ns2="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2"
                currencyID="EUR">test</ns2:TaxAmount>
            <ns3:TaxCategory>
                <ns2:ID
                    xmlns:ns2="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2"
                    schemeID="UNCL5305">S</ns2:ID>
                <ns2:Percent
                    xmlns:ns2="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2">
                    21</ns2:Percent>
                <ns3:TaxScheme>
                    <ns2:ID
                        xmlns:ns2="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2"
                        schemeID="UN/ECE 5153" schemeAgencyID="6">test</ns2:ID>
                </ns3:TaxScheme>
            </ns3:TaxCategory>
        </ns3:TaxSubtotal>
    </ns3:TaxTotal>
    <ns3:LegalMonetaryTotal
        xmlns:ns3="urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2">
        <ns2:LineExtensionAmount
            xmlns:ns2="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2"
            currencyID="EUR">test</ns2:LineExtensionAmount>
        <ns2:TaxExclusiveAmount
            xmlns:ns2="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2"
            currencyID="EUR">test</ns2:TaxExclusiveAmount>
        <ns2:TaxInclusiveAmount
            xmlns:ns2="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2"
            currencyID="EUR">test</ns2:TaxInclusiveAmount>
        <ns2:PayableAmount
            xmlns:ns2="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2"
            currencyID="EUR">test</ns2:PayableAmount>
    </ns3:LegalMonetaryTotal>
    <ns3:InvoiceLine
        xmlns:ns3="urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2">
        <ns2:ID xmlns:ns2="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2">1</ns2:ID>
        <ns2:InvoicedQuantity
            xmlns:ns2="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2"
            unitCode="ZZ">1</ns2:InvoicedQuantity>
        <ns2:LineExtensionAmount
            xmlns:ns2="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2"
            currencyID="EUR">test</ns2:LineExtensionAmount>
        <ns3:TaxTotal>
            <ns2:TaxAmount
                xmlns:ns2="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2"
                currencyID="EUR">test</ns2:TaxAmount>
        </ns3:TaxTotal>
        <ns3:Item>
            <ns2:Name
                xmlns:ns2="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2">Atestn</ns2:Name>
            <ns3:SellersItemIdentification>
                <ns2:ID
                    xmlns:ns2="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2">
                    test</ns2:ID>
            </ns3:SellersItemIdentification>
            <ns3:ClassifiedTaxCategory>
                <ns2:ID
                    xmlns:ns2="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2">
                    S</ns2:ID>
                <ns3:TaxScheme>
                    <ns2:ID
                        xmlns:ns2="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2"
                        schemeAgencyID="6">test</ns2:ID>
                </ns3:TaxScheme>
            </ns3:ClassifiedTaxCategory>
        </ns3:Item>
        <ns3:Price>
            <ns2:PriceAmount
                xmlns:ns2="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2"
                currencyID="EUR">test</ns2:PriceAmount>
            <ns2:BaseQuantity
                xmlns:ns2="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2"
                unitCode="ZZ">1</ns2:BaseQuantity>
        </ns3:Price>
    </ns3:InvoiceLine>
</ns1:Invoice>

 

answered