Search code examples
xmlxsdedi

OIOUBL namespace for BuyersItemIdentification in invoice


Our invoice numbers does not always match our suppliers, so I have added BuyersItemIdentification

<?xml version="1.0" encoding="utf-8"?>
<Invoice xsi:schemaLocation="urn:oasis:names:specification:ubl:schema:xsd:Invoice-2 UBL-Invoice-2.0.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="urn:oasis:names:specification:ubl:schema:xsd:Invoice-2" xmlns:cac="urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2" xmlns:cbc="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2" xmlns:ccts="urn:oasis:names:specification:ubl:schema:xsd:CoreComponentParameters-2" xmlns:sdt="urn:oasis:names:specification:ubl:schema:xsd:SpecializedDatatypes-2" xmlns:udt="urn:un:unece:uncefact:data:specification:UnqualifiedDataTypesSchemaModule:2">
<cbc:UBLVersionID>2.0</cbc:UBLVersionID>
<cbc:CustomizationID>OIOUBL-2.02</cbc:CustomizationID>
<cbc:ProfileID schemeID="urn:oioubl:id:profileid-1.2" schemeAgencyID="320">urn:www.nesubl.eu:profiles:profile5:ver2.0</cbc:ProfileID>

...

<cac:Item>
    <cbc:Description>Jakke, Allen</cbc:Description>
    <cbc:Name>Clique Jakke, Allen</cbc:Name>
    <cac:SellersItemIdentification>
        <cbc:ID schemeID="n/a">020957-99_L</cbc:ID>
    </cac:SellersItemIdentification>
    <cac:BuyersItemIdentification>
        <cbc:ID schemeID="n/a">JAKKEL</cbc:ID>
    </cac:BuyersItemIdentification>
</cac:Item>

But when I validate on http://www.oioubl.net/validator/ I get the message

The structure of the XmlDocument is NOT valid.

Source:System.Xml

Message:The element 'Item' in namespace 'urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2' has invalid child element 'BuyersItemIdentification' in namespace 'urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2'. List of possible elements expected: 'ManufacturersItemIdentification, StandardItemIdentification, CatalogueItemIdentification, AdditionalItemIdentification, CatalogueDocumentReference, ItemSpecificationDocumentReference, OriginCountry, CommodityClassification, TransactionConditions, HazardousItem, ClassifiedTaxCategory, AdditionalItemProperty, ManufacturerParty, InformationContentProviderParty, OriginAddress, ItemInstance' in namespace 'urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2'.

As far as I can read BuyersItemIdentification is a valid child of Item.


Solution

  • Looking at the schema, cac:BuyersItemIdentification should come before cac:SellersItemIdentification, which is why it is invalid. I would expect that if they are swapped, it will validate successfully.

    <?xml version="1.0" encoding="utf-8"?>
    <Invoice xsi:schemaLocation="urn:oasis:names:specification:ubl:schema:xsd:Invoice-2 UBL-Invoice-2.0.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="urn:oasis:names:specification:ubl:schema:xsd:Invoice-2" xmlns:cac="urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2" xmlns:cbc="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2" xmlns:ccts="urn:oasis:names:specification:ubl:schema:xsd:CoreComponentParameters-2" xmlns:sdt="urn:oasis:names:specification:ubl:schema:xsd:SpecializedDatatypes-2" xmlns:udt="urn:un:unece:uncefact:data:specification:UnqualifiedDataTypesSchemaModule:2">
    <cbc:UBLVersionID>2.0</cbc:UBLVersionID>
    <cbc:CustomizationID>OIOUBL-2.02</cbc:CustomizationID>
    <cbc:ProfileID schemeID="urn:oioubl:id:profileid-1.2" schemeAgencyID="320">urn:www.nesubl.eu:profiles:profile5:ver2.0</cbc:ProfileID>
    
    ...
    
    <cac:Item>
        <cbc:Description>Jakke, Allen</cbc:Description>
        <cbc:Name>Clique Jakke, Allen</cbc:Name>
       <cac:BuyersItemIdentification>
            <cbc:ID schemeID="n/a">JAKKEL</cbc:ID>
        </cac:BuyersItemIdentification>
        <cac:SellersItemIdentification>
            <cbc:ID schemeID="n/a">020957-99_L</cbc:ID>
        </cac:SellersItemIdentification>
    </cac:Item>