Overview
UBL Extensions allow you to add custom content to UBL documents. The extension system consists of two main components:- UBLExtensions - Container for multiple extension entries
- UBLExtensionType - Individual extension with metadata and content
UBLExtensions
The main container class for managing extension entries in a UBL document.Constructor
A single extension for private use. Can be added using the constructor or the
addUBLExtension() method.Methods
addUBLExtension()
Add an individual extension to the container.Extension instance or parameters object to add to the extensions container.
getDianUblExtension()
Retrieve the first extension from the container (commonly used for DIAN extensions).UBLExtensionType in the container, or null if no extensions exist.
Example:
UBLExtensionType
Represents a single extension with metadata and content.Constructor
Parameters
An identifier for the extension assigned by the creator.UBL Field:
cbc:IDA name for the extension assigned by the creator.UBL Field:
cbc:NameIdentifier for the agency that maintains the extension.UBL Field:
ext:ExtensionAgencyIDName of the agency that maintains the extension.UBL Field:
ext:ExtensionAgencyNameVersion identifier for the extension.UBL Field:
ext:ExtensionVersionIDURI for the agency that maintains the extension.UBL Field:
ext:ExtensionAgencyURIURI for the extension.UBL Field:
ext:ExtensionURICode indicating why the extension is being included.UBL Field:
ext:ExtensionReasonCodeDescription of the reason for including the extension.UBL Field:
ext:ExtensionReasonThe actual extension content. This is where custom data is stored.UBL Field:
ext:ExtensionContentMethods
setExtensionContent()
Set or update the extension content.Extension content instance (e.g., DianExtensions or custom content).
getExtensionContent()
Retrieve the extension content.Usage Examples
Creating a Basic Extension
Adding Multiple Extensions
Using Extensions in a Document
The
extensionContent parameter is required for UBLExtensionType. All extension content must extend the AnyExtensionContent base class.Related
- DIAN Extensions - Colombian tax authority extension system
- Invoice Document - Using extensions in invoices