# CV302

Source: https://xmlvalid.com/rules/CV302

> ItemCode … does not exist in CodeType EInvoiceTypes: the e-invoice type (InvoiceTypeCode) is 01 (invoice), 02 (credit note), 03 (debit note), 04 (refund note), or 11 to 14 for the self-billed ones.

- Level: error
- Rule sets: MyInvois validations of LHDN (Malaysia) MyInvois SDK of 25 September 2026
- Context: `/*`
- Test: `$type = my:codes('type')`

> ItemCode … does not exist in CodeType CurrencyCodes: the document currency (cbc:DocumentCurrencyCode) is not in MyInvois's currency codes.

- Level: error
- Rule sets: MyInvois validations of LHDN (Malaysia) MyInvois SDK of 25 September 2026
- Context: `/*`
- Test: `$currency = ('', my:codes('currency'))`

> ItemCode … does not exist in CodeType PaymentMethods: the payment mode (PaymentMeansCode) is one of 01 to 08.

- Level: error
- Rule sets: MyInvois validations of LHDN (Malaysia) MyInvois SDK of 25 September 2026
- Context: `/*`
- Test: `every $p in cac:PaymentMeans/cbc:PaymentMeansCode satisfies normalize-space($p) = my:codes('payment')`

> ItemCode … does not exist in CodeType MSICSubCategoryCodes: the MSIC code (cbc:IndustryClassificationCode) is not in the Malaysia Standard Industrial Classification codes.

- Level: error
- Rule sets: MyInvois validations of LHDN (Malaysia) MyInvois SDK of 25 September 2026
- Context: `/*/cac:AccountingSupplierParty/cac:Party | /*/cac:AccountingCustomerParty/cac:Party`
- Test: `$msic = ('', my:codes('msic'))`

> ItemCode … does not exist in CodeType CountryCodes: a country is an ISO 3166-1 three-letter code, such as MYS (the …'s address).

- Level: error
- Rule sets: MyInvois validations of LHDN (Malaysia) MyInvois SDK of 25 September 2026
- Context: `/*/cac:AccountingSupplierParty/cac:Party | /*/cac:AccountingCustomerParty/cac:Party`
- Test: `$country = ('', my:codes('country'))`

> ItemCode … does not exist in CodeType StateCodes: a state (cbc:CountrySubentityCode) is one of 01 to 17 (the …'s address).

- Level: error
- Rule sets: MyInvois validations of LHDN (Malaysia) MyInvois SDK of 25 September 2026
- Context: `/*/cac:AccountingSupplierParty/cac:Party | /*/cac:AccountingCustomerParty/cac:Party`
- Test: `$state = ('', my:codes('state'))`

> ItemCode … does not exist in CodeType ClassificationCodes: a line's classification is one of 001 to 045.

- Level: error
- Rule sets: MyInvois validations of LHDN (Malaysia) MyInvois SDK of 25 September 2026
- Context: `/*/cac:InvoiceLine`
- Test: `every $c in $classes satisfies normalize-space($c) = my:codes('classification')`

> ItemCode … does not exist in CodeType UnitTypes: the unit of measure (unitCode) is a UN/ECE Recommendation 20 code from MyInvois's list.

- Level: error
- Rule sets: MyInvois validations of LHDN (Malaysia) MyInvois SDK of 25 September 2026
- Context: `/*/cac:InvoiceLine`
- Test: `$unit = ('', my:codes('unit'))`

> ItemCode … does not exist in CodeType CountryCodes: the country of origin is an ISO 3166-1 three-letter code.

- Level: error
- Rule sets: MyInvois validations of LHDN (Malaysia) MyInvois SDK of 25 September 2026
- Context: `/*/cac:InvoiceLine`
- Test: `$origin = ('', my:codes('country'))`

> ItemCode … does not exist in CodeType TaxTypes: the tax type (cac:TaxCategory/cbc:ID) is 01 to 06, or E for a tax exemption.

- Level: error
- Rule sets: MyInvois validations of LHDN (Malaysia) MyInvois SDK of 25 September 2026
- Context: `cac:TaxSubtotal`
- Test: `$category = ('', my:codes('tax'))`

## Why it fails

- A code written by its name or with spaces (Kuala Lumpur instead of 14, MY instead of MYS).
- A unit of measure from another list, such as PCS or UNIT; MyInvois takes UN/ECE Recommendation 20 codes (C62 for one, HUR for an hour).
- A classification without its leading zeros (3 instead of 003).

## How to fix it

- Take the code from the code tables of the MyInvois SDK (Codes): classification, MSIC, state, country, currency, tax type, payment mode and unit of measure.

Validate a document against these rules: https://xmlvalid.com/validate
