Overview
Core Component Types (CCT) are the foundational building blocks of the UBL 2.1 type system. They extend XML Schema simple types and provide the base implementation for Unqualified Data Types (UDT). All CCT types are in the namespaceurn:un:unece:uncefact:data:specification:CoreComponentTypeSchemaModule:2.
Type Hierarchy
CctAmountType
A number of monetary units specified in a currency where the unit of the currency is explicit or implied.The monetary amount as a decimal string
Constructor
Methods
Converts the amount to JSON format with
#text for content and @attribute for attributesSets the currency identifier
Sets the currency code list version identifier
Example
XsdDecimal
Reference: Datypic CCT AmountType
CctBinaryObjectType
A set of finite-length sequences of binary octets.The binary content (typically base64 encoded)
Optional attributes for the binary object
The format of the binary content (e.g., “PDF”, “PNG”)
The MIME type of the binary object (e.g., “application/pdf”, “image/png”)
The decoding algorithm (e.g., “base64”)
The character set if MIME type is text
URI where the binary object is located
The filename of the binary object
Constructor
Methods
Converts to JSON format
Sets the format attribute
Sets the MIME code
Sets the encoding code
Sets the character set code
Sets the URI attribute
Sets the filename attribute
Example
XsdNormalizedString
CCTS Properties:
- Unique ID: UNDT000002
- Category Code: CCT
- Representation Term: Binary Object
- Primitive Type: binary
CctCodeType
A character string to identify and distinguish uniquely one instance of an object in an identification scheme from all other objects in the same scheme.The code value
Optional attributes for the code
The identification of a list of codes
The agency that maintains the list of codes
The name of the agency
The name of the code list
The version of the code list
The textual equivalent of the code content
The language identifier
URI where the code list is located
URI where the code list scheme is located
Constructor
Methods
Converts to JSON format
Sets the list identifier
Sets the list agency identifier
Sets the list agency name
Sets the list name
Sets the list version identifier
Sets the textual name/description
Sets the language identifier
Sets the list URI
Sets the list scheme URI
Example
XsdNormalizedString
CctIdentifierType
A character string to identify and distinguish uniquely one instance of an object in an identification scheme from all other objects in the same scheme.The identifier value
Optional attributes for the identifier
The identification scheme (e.g., “GLN”, “DUNS”)
The name of the identification scheme
The agency maintaining the scheme
The name of the agency
The version of the scheme
URI where the scheme data is located
URI where the scheme is located
Constructor
Methods
Converts to JSON format
Sets the scheme identifier
Sets the scheme name
Sets the scheme agency identifier
Sets the scheme agency name
Sets the scheme version identifier
Sets the scheme data URI
Sets the scheme URI
Example
XsdNormalizedString
CctTextType
A character string to identify and distinguish uniquely one instance of an object in an identification scheme from all other objects in the same scheme.The text content
Constructor
Methods
Validates the text content
Converts to JSON format
Sets the language identifier
Sets the language locale identifier
Example
XsdString
CctNumericType
Numeric information that is assigned or determined by calculation, counting, or sequencing. It does not require a unit of quantity or unit of measure.The numeric value as a string
Optional attributes
Whether the number is an integer, decimal, real number, or percentage
Constructor
Methods
Converts to JSON format
Sets the format attribute
Example
XsdDecimal
Reference: Datypic CCT NumericType
CctQuantityType
A counted number of non-monetary units possibly including fractions.The quantity value
Constructor
Methods
Validates the quantity content
Converts to JSON format
Sets the unit code
Sets the unit code list identifier
Sets the unit code list agency identifier
Sets the unit code list agency name
Example
XsdDecimal
CCTS Properties:
- Unique ID: UNDT000018
- Category Code: CCT
- Representation Term: Quantity
- Primitive Type: decimal
CctMeasureType
Numeric information that is assigned or determined by calculation, counting, or sequencing. It does not require a unit of quantity or unit of measure.The measurement value
Constructor
Unlike other CCT types,
CctMeasureType requires the attributes parameter with at least the unitCode property.Methods
Converts to JSON format
Sets the unit code
Sets the unit code list version identifier
Example
XsdDecimal
Reference: Datypic CCT NumericType
Common Patterns
Importing CCT Types
Using as Base Classes
CCT types are typically extended by UDT types, but can be used directly:JSON Serialization
All CCT types implementparseToJson() method:
Attribute Management
CCT types provide both constructor-based and setter-based attribute management:Type Comparison
| CCT Type | Purpose | Required Attributes | Base Type |
|---|---|---|---|
CctAmountType | Monetary amounts | None (currencyID recommended) | XsdDecimal |
CctBinaryObjectType | Binary data | mimeCode | XsdNormalizedString |
CctCodeType | Code values | None | XsdNormalizedString |
CctIdentifierType | Identifiers | None | XsdNormalizedString |
CctTextType | Text strings | None | XsdString |
CctNumericType | Numbers | None | XsdDecimal |
CctQuantityType | Quantities | None (unitCode recommended) | XsdDecimal |
CctMeasureType | Measurements | unitCode | XsdDecimal |
Validation
Some CCT types include content validation:Related Documentation
UDT Types
Unqualified Data Types that extend CCT types
Invoice Builder
Using types in UBL documents
References
- UBL 2.1 Specification
- Datypic UBL 2.1 CCT Schema
- Schema:
CCTS_CCT_SchemaModule-2.1.xsd - Namespace:
urn:un:unece:uncefact:data:specification:CoreComponentTypeSchemaModule:2
CCT types form the bridge between primitive XML Schema types and application-specific UDT types. While you can use CCT types directly, it’s recommended to use UDT types in most cases as they provide more semantic meaning and align with UBL 2.1 specifications.