发票中的BuyersItemIdentification的OIOUBL名称空间

时间:2017-06-14 12:15:08

标签: xml xsd edi

我们的发票编号并不总是与我们的供应商匹配,因此我添加了 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>

但是当我在http://www.oioubl.net/validator/上验证时,我收到了消息

XmlDocument的结构无效。

来源:的System.Xml

消息:元素&#39;项目&#39; in namespace&#39; urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2&#39;具有无效的子元素&#39; BuyersItemIdentification&#39; in namespace&#39; urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2&#39;。 预期可能元素的列表:&#39; ManufacturersItemIdentification,StandardItemIdentification,CatalogueItemIdentification,AdditionalItemIdentification,CatalogueDocumentReference, ItemSpecificationDocumentReference,OriginCountry,CommodityClassification,TransactionConditions,HazardousItem,ClassifiedTaxCategory,AdditionalItemProperty,ManufacturerParty,InformationContentProviderParty,OriginAddress,ItemInstance&#39;在 namespace&#39; urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2&#39;。

据我所知,BuyersItemIdentification是Item的有效子项。

1 个答案:

答案 0 :(得分:1)

查看schemacac:BuyersItemIdentification应该在cac:SellersItemIdentification之前,这就是它无效的原因。我希望如果它们被交换,它将成功验证。

<?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>