Delivery location postal address requires exactly one country code

Error FX-SCH-A-000824 Factur-X

Element 'ram:CountryID' must occur exactly 1 times.

Mandatory rule: As long as it is violated, the invoice is invalid and will be rejected by validators.
What is wrong

In ram:PostalTradeAddress, ram:CountryID does not occur exactly once. The rule requires exactly one such element.

What the rule means

ram:CountryID specifies the country of the postal address. Exactly one element ensures that the address contains the expected country value.

Please include exactly one country code in the delivery location’s postal address

The delivery location’s postal address is missing ram:CountryID, or the element occurs more than once. You can adjust the XML so that it contains exactly one element.

What to do
  1. Find ram:PostalTradeAddress in ShipToTradeParty.
  2. Make sure the postal address contains exactly one ram:CountryID element.
  3. Regenerate the invoice and check it again.
What it looks like
✗ Triggers the message
<ram:PostalTradeAddress/>
✓ Correct
<ram:PostalTradeAddress>
  <ram:CountryID/>
</ram:PostalTradeAddress>
Technical details

The XPath test counts the direct ram:CountryID elements in ram:PostalTradeAddress and requires exactly one.

Where the rule applies

Applies to the postal address under ram:PostalTradeAddress of ShipToTradeParty.

Context (rule/@context)
/rsm:CrossIndustryInvoice/rsm:SupplyChainTradeTransaction/ram:ApplicableHeaderTradeDelivery/ ram:ShipToTradeParty/ram:SpecifiedLegalOrganization/ram:PostalTradeAddress
Test expression (assert/@test)
count(ram:CountryID)=1