cbc cac
Forum topic: Submitted by epoca on Tue, 2009-07-14 13:21. Last updated on Wed, 2009-07-15 20:34.
hi ,
a very basic question:
what does cbc and cac mean in UBL (e.g <cbc:IssueDate>) ?
hi ,
a very basic question:
what does cbc and cac mean in UBL (e.g <cbc:IssueDate>) ?
Namespace prefixes are used to disambiguate UBL elements
In an XML document element names and attribute names can either be a simple name without a colon, or they can be a complex name created by combining a URI string and a simple name.
All elements in UBL are named in the complex name style.
The name of the element in your example is in fact:
{urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2}IssueDate
... but limitations in XML syntax do not allow this syntax to be used with angle brackets.
To get around the limitations, the XML committee created "XML namespaces".
At the top of the UBL example instances you will see declarations of namespace prefixes to URI strings.
An element prefix can be any simple name or nothing, while an attribute prefix can only be a simple name. A non-emtpy prefix is followed by a colon ":". All attributes in UBL are in no namespace, therefore no prefixes are used in any attributes.
So, I could say:
xmlns:ken="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2"
.... and then I would be able to say:
<ken:IssueDate>
.... and this would be a reference to the appropriately named UBL entity:
{urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2}IssueDate
But it would be confusing if the UBL documentation used different prefixes in different documents, so by convention only (not by rule) the committee uses:
xmlns:cbc="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2"
<cbc:IssueDate>
Another convention is to use the default namespace for the document element, so in the examples you will also see:
xmlns="urn:oasis:names:specification:ubl:schema:xsd:Invoice-2"
<Invoice
Unfortunately the UBL examples in UBL 2.0 inappropriately (but not incorrectly) declare namespace prefixes that are never used.
Below is the start of the UBL-Invoice-2.0-Example.xml instance with the document element start tag cleaned up.
The formal specification of XML Namespaces can be found here:
http://www.w3.org/TR/REC-xml-names/
I hope this helps.
. . . . . . . . . . . Ken
<?xml version="1.0" encoding="UTF-8"?>
<Invoice 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">
<cbc:UBLVersionID>2.0</cbc:UBLVersionID>
<cbc:CustomizationID>urn:oasis:names:specification:ubl:xpath:Invoice-2.0:sbs-1.0-draft</cbc:CustomizationID>
<cbc:ProfileID>bpid:urn:oasis:names:draft:bpss:ubl-2-sbs-invoice-notification-draft</cbc:ProfileID>
<cbc:ID>A00095678</cbc:ID>
<cbc:CopyIndicator>false</cbc:CopyIndicator>
<cbc:UUID>849FBBCE-E081-40B4-906C-94C5FF9D1AC3</cbc:UUID>
<cbc:IssueDate>2005-06-21</cbc:IssueDate>
<cbc:InvoiceTypeCode>SalesInvoice</cbc:InvoiceTypeCode>
<cbc:Note>sample</cbc:Note>
...