Creating Extensions With UBL Naming and Design Rules

G. Ken Holman

Crane Softwrights Ltd.

$Date: 2015/05/26 14:56:03 $(UTC)


Table of Contents

1. Introduction
1.1. Acknowledgement
1.2. Demonstration files
1.3. Demonstration invocation
2. Modeling the information
3. Expressing the model in a common form
4. Checking the model for completeness
5. Creating the runtime validation artefacts
6. Using the schemas to validate
7. Context/value association files
Bibliography

1. Introduction

The OASIS Universal Business Language [UBL-2.1] defines a wide range of business document types incorporating a rich suite of business object structures. Nevertheless, it may be necessary in your work to create your own business documents where there is no business document in OASIS, and yet exploit the business object structures in the OASIS common library. Moreover, you may need to augment the existing XML document models with additional business objects or other constructs of your own, and yet not violate the document constraints assumed by other users of standard UBL for that existing document model. The documents are modeled using the UN/CEFACT Core Component Technical Specification [CCTS] methodology. The UBL Naming and Design Rules (NDR) [UBL NDR 3.0] formally define the rules of converting a CCTS model of a business document into validation artefacts.

The "Genericode to UBL NDR" package freely available from the Crane web site [gc2ublndr] includes the latest version of this paper and a demonstration environment in which additional document structures and document extension structures are created and used in a UBL environment.

Consider the example of a return authorization request and response pair of business documents. These documents are not modeled as part of UBL, yet you might need such documents in your interactions with your trading partners. Using business objects from the UBL common library, say for example the identification of parties, will help in the construction of your additional documents so that your back end is dealing the same way with the same business objects found in all documents. Having schemas for these additional documents is as important as having schemas for the UBL documents.

Consider also the example of the existing UBL invoice. When writing an invoice for a particular trading partner you may need to include the information from a timesheet. In the UBL 2.1 library there are no timesheet constructs. Yet when you submit your invoice, your trading partner is expecting to receive in that invoice a day-by-day and task-by-task breakdown of the hours incurred. An extension structure can be designed and implemented as a set of schema fragments in which this information can be captured for any UBL invoice (or any other UBL document for that matter). This non-standard structure is a descendant of the standardized extension point found at the beginning of the UBL document-level invoice structure (and the beginning of every document-level structure in UBL).

The one trading partner expecting the timesheet information needs to be assured the information supplied is correctly structured, thus they would incorporate the extension schema fragments in their environment, ready to validate the incoming instances treating the timesheet information as integral information and not foreign content. Other trading partners have no interest in such details, so they would not bother incorporating the schema fragments in their environment. Nevertheless, they are already equipped to receive the augmented document as the standardized structures blindly accept unrecognized foreign content that is correctly used under the extension point.

Note

The demonstration also illustrates and mimics the creation of the UBL main document and common library structures with these tools. This may be of more interest to non-UBL projects than to UBL users. The additional document structures and document extension structures can be created with this environment and then moved to your existing UBL environment without the need to actually recreate the UBL standard structures.

Note

The OASIS Business Document Exchange (BDXR) TC is a user of the UBL NDR to create the Business Document Envelope Version 1.0 and the artefacts in support of that effort are created using these tools.

1.1. Acknowledgement

Many thanks to Stephen Green for identifying the need for this paper and the impetus to adapt an existing software project to accommodate these identified requirements.

1.2. Demonstration files

The distribution includes a fully-contained turnkey demonstration environment with nothing additional to be installed.

The current version of this environment [gc2ublndr] unpacks to create the following files, starting with the stylesheet and the documentation in the base directory:

Crane-gc2ublndr/CreatingExtensionsWithUBLNDR.html
Crane-gc2ublndr/readme-Crane-checkgc4ublndr.txt
Crane-gc2ublndr/readme-Crane-gc2ublndr.txt
Crane-gc2ublndr/Crane-checkgc4ublndr-obfuscated.xsl
Crane-gc2ublndr/Crane-gc2ublndr-obfuscated.xsl

Note that the saxon9h3.jar directory includes a copy of the free saxon9he.jar file and its necessary notices, downloaded from Saxon [Saxon] Home Edition (HE) XSLT processor package at http://saxon.sf.net:

Crane-gc2ublndr/saxon9he/saxon9he.jar
Crane-gc2ublndr/saxon9he/notices/CERN.txt
Crane-gc2ublndr/saxon9he/notices/JAMESCLARK.txt
Crane-gc2ublndr/saxon9he/notices/LICENSE.txt
Crane-gc2ublndr/saxon9he/notices/THAI.txt
Crane-gc2ublndr/saxon9he/notices/UNICODE.txt

The UBL directory includes everything needed to recreate the UBL schema constructs and to run the demonstration that creates an additional document schema and a document extension schema:

Crane-gc2ublndr/ubl/config-myext.xml
Crane-gc2ublndr/ubl/config-rar.xml
Crane-gc2ublndr/ubl/config-ubl-2.1-ext.xml
Crane-gc2ublndr/ubl/config-ubl-2.1.xml
Crane-gc2ublndr/ubl/createMyExt.bat
Crane-gc2ublndr/ubl/createMyExt.sh
Crane-gc2ublndr/ubl/createRAR.bat
Crane-gc2ublndr/ubl/createRAR.sh
Crane-gc2ublndr/ubl/createUBL.bat
Crane-gc2ublndr/ubl/createUBL.sh
Crane-gc2ublndr/ubl/doall.bat
Crane-gc2ublndr/ubl/doall.sh
Crane-gc2ublndr/ubl/UBL-2.1-CVA-Skeleton.cva

The mod/ directory contains the serialization of the document models in genericode, and the subdirectories contain the additional document and document extension models in OpenOffice ODS format:

Crane-gc2ublndr/ubl/mod/mydoc/MyRARequestResponse.ods
Crane-gc2ublndr/ubl/mod/myext/MyTimesheetExtension.ods
Crane-gc2ublndr/ubl/mod/MyRARequestResponse-Entities-rows.xml
Crane-gc2ublndr/ubl/mod/MyRARequestResponse-Entities.gc
Crane-gc2ublndr/ubl/mod/MyTimesheetExtension-Entities-rows.xml
Crane-gc2ublndr/ubl/mod/MyTimesheetExtension-Entities.gc
Crane-gc2ublndr/ubl/mod/UBL-Entities-2.1.gc
Crane-gc2ublndr/ubl/mod/UBL-Signature-Entities-2.1.gc

The val/ directory contains an environment with test instances and invocations to validate the test instances (note that this is essentially the same as in the UBL distribution except that the XSLT scripts invoke the saxon9he already part of this distribution:

Crane-gc2ublndr/ubl/val/CatalogManager.properties
Crane-gc2ublndr/ubl/val/InvoiceExt.xml
Crane-gc2ublndr/ubl/val/InvoiceExtBad.xml
Crane-gc2ublndr/ubl/val/MyRARequest.xml
Crane-gc2ublndr/ubl/val/MyRARequestBad.xml
Crane-gc2ublndr/ubl/val/MyRAResponse.xml
Crane-gc2ublndr/ubl/val/MyRAResponseBad.xml
Crane-gc2ublndr/ubl/val/resolver.jar
Crane-gc2ublndr/ubl/val/test.bat
Crane-gc2ublndr/ubl/val/test.sh
Crane-gc2ublndr/ubl/val/UBL-DefaultDTQ-2.1.xsl
Crane-gc2ublndr/ubl/val/validate.bat
Crane-gc2ublndr/ubl/val/validate.sh
Crane-gc2ublndr/ubl/val/w3cschema-cygwin.sh
Crane-gc2ublndr/ubl/val/w3cschema.bat
Crane-gc2ublndr/ubl/val/w3cschema.sh
Crane-gc2ublndr/ubl/val/xercesImpl.jar
Crane-gc2ublndr/ubl/val/xjparse.jar
Crane-gc2ublndr/ubl/val/xslt.bat
Crane-gc2ublndr/ubl/val/xslt.sh

The xsd/ and xsdrt/ directories contain copies of the UBL 2.1 schema fragments that are not created by this demonstration environment (note that a custom version of the UBL-ExtensionContentDataType-2.1.xsd file is included, hand-crafted to point to the generated extension environment of the demonstration):

Crane-gc2ublndr/ubl/xsd/common/CCTS_CCT_SchemaModule-2.1.xsd
Crane-gc2ublndr/ubl/xsd/common/UBL-CommonExtensionComponents-2.1.xsd
Crane-gc2ublndr/ubl/xsd/common/UBL-CoreComponentParameters-2.1.xsd
Crane-gc2ublndr/ubl/xsd/common/UBL-ExtensionContentDataType-2.1-original.xsd
Crane-gc2ublndr/ubl/xsd/common/UBL-ExtensionContentDataType-2.1.xsd
Crane-gc2ublndr/ubl/xsd/common/UBL-QualifiedDataTypes-2.1.xsd
Crane-gc2ublndr/ubl/xsd/common/UBL-UnqualifiedDataTypes-2.1.xsd
Crane-gc2ublndr/ubl/xsd/common/UBL-XAdESv132-2.1.xsd
Crane-gc2ublndr/ubl/xsd/common/UBL-XAdESv141-2.1.xsd
Crane-gc2ublndr/ubl/xsd/common/UBL-xmldsig-core-schema-2.1.xsd
Crane-gc2ublndr/ubl/xsdrt/common/CCTS_CCT_SchemaModule-2.1.xsd
Crane-gc2ublndr/ubl/xsdrt/common/UBL-CommonExtensionComponents-2.1.xsd
Crane-gc2ublndr/ubl/xsdrt/common/UBL-CoreComponentParameters-2.1.xsd
Crane-gc2ublndr/ubl/xsdrt/common/UBL-ExtensionContentDataType-2.1-original.xsd
Crane-gc2ublndr/ubl/xsdrt/common/UBL-ExtensionContentDataType-2.1.xsd
Crane-gc2ublndr/ubl/xsdrt/common/UBL-QualifiedDataTypes-2.1.xsd
Crane-gc2ublndr/ubl/xsdrt/common/UBL-UnqualifiedDataTypes-2.1.xsd
Crane-gc2ublndr/ubl/xsdrt/common/UBL-XAdESv132-2.1.xsd
Crane-gc2ublndr/ubl/xsdrt/common/UBL-XAdESv141-2.1.xsd
Crane-gc2ublndr/ubl/xsdrt/common/UBL-xmldsig-core-schema-2.1.xsd

1.3. Demonstration invocation

The createUBL.bat and createUBL.sh invocations produce the base UBL validation artefacts related to the business objects. The hand-crafted and UN/CEFACT schema fragments are not recreated by this process, they are simply copied from the latest UBL 2.1 distribution.

One hand-crafted UBL schema artefact that needs to be modified, and has been modified in this demonstration, is the one that imports all of the extension document apex schema fragments. The original version is included in this package and shows only the committee-standardized signature extension being imported. The modified fragment (using the original fragment's UBL-ExtensionContentDataType-2.1.xsd file name) contains an additional import directive for the timesheet extension. No other changes are needed for this fragment, only the addition of import directives.

The createMyExt.bat and createMyExt.sh invocations produce the document extension schema fragments.

The createRAR.bat and createRAR.sh invocations produce the additional document schema fragments.

The doall.bat and doall.sh invocations run all three creation and testing scripts.

The demonstration artefacts can then be generated and tested by the single invocation of "doall" from the ubl/ directory, based on either being in a Windows environment:

cd ubl
doall.bat

... or being in a Linux/BSD/Unix environment:

cd ubl
sh doall.sh

The final test demonstrates that the artefacts were correctly created and engaged. This test shows the three error-free instances not to have errors, and the three invalid instances (named "Bad") to have expected validation errors (note the test is run once with the fully-commented schemas and once with the runtime schemas):

############################################################
Validating InvoiceExt.xml
############################################################
============== Phase 1: XSD schema validation ==============
No schema validation errors.
============ Phase 2: XSLT code list validation ============
No code list validation errors.

############################################################
Validating InvoiceExtBad.xml
############################################################
============== Phase 1: XSD schema validation ==============
Attempting validating, namespace-aware parse
Error:file:///T:/Crane-gc2ublndr-test/ubl/val/
InvoiceExtBad.xml:14:19:cvc-complex-type.2.4.a: Invalid
 content was found starting with element 'mxa:Taskx'. One of
 '{"urn:X-MyCompany:xsd:MyTimesheetExtension:
AggregateComponents":Task}' is expected.
Parse succeeded (1.653) with 1 error and no warnings.

############################################################
Validating MyRARequest.xml
############################################################
============== Phase 1: XSD schema validation ==============
No schema validation errors.
============ Phase 2: XSLT code list validation ============
No code list validation errors.

############################################################
Validating MyRARequestBad.xml
############################################################
============== Phase 1: XSD schema validation ==============
Attempting validating, namespace-aware parse
Error:file:///T:/Crane-gc2ublndr-test/ubl/val/
MyRARequestBad.xml:15:29:cvc-complex-type.2.4.a: Invalid
 content was found starting with element
 'rqb:RequestedQuantityx'. One of '{"urn:X-MyCompany:xsd:
MyRARequestResponse:BasicComponents":RequestedQuantity}' is
 expected.
Parse succeeded (1.622) with 1 error and no warnings.

############################################################
Validating MyRAResponse.xml
############################################################
============== Phase 1: XSD schema validation ==============
No schema validation errors.
============ Phase 2: XSLT code list validation ============
No code list validation errors.

############################################################
Validating MyRAResponseBad.xml
############################################################
============== Phase 1: XSD schema validation ==============
Attempting validating, namespace-aware parse
Error:file:///T:/Crane-gc2ublndr-test/ubl/val/
MyRAResponseBad.xml:19:27:cvc-complex-type.2.4.a: Invalid
 content was found starting with element
 'rsb:GrantedQuantityx'. One of '{"urn:X-MyCompany:xsd:
MyRARequestResponse:BasicComponents":GrantedQuantity}' is
 expected.
Parse succeeded (1.642) with 1 error and no warnings.

############################################################
Validating InvoiceExt.xml
############################################################
============== Phase 1: XSD schema validation ==============
No schema validation errors.
============ Phase 2: XSLT code list validation ============
No code list validation errors.

############################################################
Validating InvoiceExtBad.xml
############################################################
============== Phase 1: XSD schema validation ==============
Attempting validating, namespace-aware parse
Error:file:///T:/Crane-gc2ublndr-test/ubl/val/
InvoiceExtBad.xml:14:19:cvc-complex-type.2.4.a: Invalid
 content was found starting with element 'mxa:Taskx'. One of
 '{"urn:X-MyCompany:xsd:MyTimesheetExtension:
AggregateComponents":Task}' is expected.
Parse succeeded (1.202) with 1 error and no warnings.

############################################################
Validating MyRARequest.xml
############################################################
============== Phase 1: XSD schema validation ==============
No schema validation errors.
============ Phase 2: XSLT code list validation ============
No code list validation errors.

############################################################
Validating MyRARequestBad.xml
############################################################
============== Phase 1: XSD schema validation ==============
Attempting validating, namespace-aware parse
Error:file:///T:/Crane-gc2ublndr-test/ubl/val/
MyRARequestBad.xml:15:29:cvc-complex-type.2.4.a: Invalid
 content was found starting with element
 'rqb:RequestedQuantityx'. One of '{"urn:X-MyCompany:xsd:
MyRARequestResponse:BasicComponents":RequestedQuantity}' is
 expected.
Parse succeeded (1.352) with 1 error and no warnings.

############################################################
Validating MyRAResponse.xml
############################################################
============== Phase 1: XSD schema validation ==============
No schema validation errors.
============ Phase 2: XSLT code list validation ============
No code list validation errors.

############################################################
Validating MyRAResponseBad.xml
############################################################
============== Phase 1: XSD schema validation ==============
Attempting validating, namespace-aware parse
Error:file:///T:/Crane-gc2ublndr-test/ubl/val/
MyRAResponseBad.xml:19:27:cvc-complex-type.2.4.a: Invalid
 content was found starting with element
 'rsb:GrantedQuantityx'. One of '{"urn:X-MyCompany:xsd:
MyRARequestResponse:BasicComponents":GrantedQuantity}' is
 expected.
Parse succeeded (1.272) with 1 error and no warnings.

2. Modeling the information

The UBL Naming and Design Rules (NDR) [UBL NDR 3.0] are designed to accommodate both additional document and document extension requirements, for any project that embraces these rules, not just UBL (though UBL is used in this document as an example implementation of the UBL NDR). In both situations of additional documents and document extensions it is important and useful to utilize standardized constructs where available and to only build custom constructs where they do not currently exist in the standardized common library. When it is necessary to create one's own constructs, following the principles of the NDR ensures the constructs are compatibly designed. Compatibly-designed constructs would be more easily contemplated by the integrated into a future version of the project.

The collaborative tool used by committee members to express the model is an online Google spreadsheet, with conventions for indicating ABIE, BBIE and ASBIE components and their UBL NDR values modeled according to UN/CEFACT Core Component Technical Specification [CCTS].

Adding to your suite additional documents that exploit the common library involves creating a document-level aggregate business information entity (ABIE) construct that contains both association business information entity (ASBIE) constructs (that each point to an ABIE), and basic business information entity (BBIE) constructs (that are atomic indivisible values of a given data type). This structure is identical to that of the main documents of the suite, except that in an additional document only the common ABIE and BBIE constructs are obtained from the common library using the common namespaces. Novel ABIE and BBIE constructs are placed in a supplementary library using supplementary namespaces. Should the additional document ever in the future get incorporated into the common suite, then the supplemental constructs would likewise be incorporated into the common library.

To accommodate custom extensions inside a standardized document, every UBL NDR document model begins with an optional extension point. Under this extension point there can be any number of extensions, complete with optional metadata about each extension. Each extension must then contain any arbitrary content and it is included without violating the standardized document constraints of UBL. Nevertheless, when exchanging the document with a trading partner who is expecting to find your arbitrary content, it is useful to augment the document schemas with the constraints of the extension for when the extension is present.

Adding to your suite an extension that augments an existing document involves creating an apex ABIE that contains both ASBIE and BBIE constructs. This structure is very similar to that of additional documents (in their own way the same as the main documents), including the use of supplementary library where needed in addition to the common library. The sole difference is that where an additional document has its own extension point at the beginning of the structure, an extension does not, itself, have an extension point.

How you develop your model is not material to the set of tools in this package, as it relies on you expressing your model contents in an independent fashion using an open specification (see Section 3, “Expressing the model in a common form”). In the UBL TC a number of members use UML to model the relationships graphically.

In this demonstration environment, the MyRARequestResponse.ods spreadsheet has an illustration of the model for a pair of additional documents, a return authorization request and a return authorization response, using the common library. The MyTimesheetExtension.ods spreadsheet has an illustration of the model for an arbitrary document extension, that being the timesheet in this demonstration scenario.

3. Expressing the model in a common form

OASIS genericode [genericode] is the specification of an XML vocabulary to express sparsely-populated tables. Originally developed to express the information associated with code lists (e.g. currency code lists, country code lists, etc.), genericode is ideally suited to express the sparsely-populated table of CCTS information associated with document models using the UBL NDR 3.0.

Crane's genericode export package [ods2ublgc] contains a skeleton UBL NDR spreadsheet in ODS format. The UBL committee has also published an online Google spreadsheet empty skeleton model with which to create CCTS models of documents. These tools were used to create the two spreadsheets in the demonstration environment of this package.

If you choose to use any other means to model the UBL NDR information in your documents, the tools in this environment rely on you expressing the model contents in genericode XML so that this environment is independent of the original modeling expression. You must use the same value labels as the column headers used in the proforma ODS spreadsheet.

4. Checking the model for completeness

However the model's genericode expression is created, it should be checked for completeness before attempting to produce the runtime validation artefacts. The Crane-checkgc4ublndr-obfuscated.xsl stylesheet reads the same configuration file and genericode inputs used for creating the artefacts. This stylesheet reports on any inconsistencies or incomplete information that would be needed to produce a proper set of outputs.

See the UBL NDR checker stylesheet documentation for the invocation parameters available for processing.

5. Creating the runtime validation artefacts

When using UBL NDR, the runtime validation artefacts are W3C XML Schemas [XSD] for a document's structural constraints and OASIS Context/value Association files [CVA] for a document's value constraints. The Crane-gc2ublndr-obfuscated.xsl stylesheet reads a configuration file and genericode inputs and produces those validation artefacts related to the model (which are not all of the artefacts needed to validate UBL instances).

Important note:

The schema generator does not validate that the model expressed in genericode is self consistent and conforms to the UBL NDR 3.0 rules. If there are errors in this expression of the model, there will be errors in the generated schemas. The corollary is that if you find errors in the generated schemas, these are likely to be caused by errors in the expression of the model. Of course if there are no corresponding errors in the model according to the running of the model checker, then there is a problem with the generator.

See the Translating genericode to UBL NDR stylesheet documentation for the invocation parameters available for processing.

6. Using the schemas to validate

The val/ directory contains a copy of the UBL validation tools, and six test instances: two being a UBL sample invoice document with a (thematically irrelevant) timesheet extension and four being a custom document exploiting the UBL common library definition of a party. In each pair of documents, one of the documents has no constraint violations and validates without error, while the other has misspelled element names in order to trigger a validation error to prove the schemas are in play.

In each of these example instances, note the careful use of namespaces and their associated prefixes. Remember, of course, the prefixes chosen are inconsequential and need not be the same as the prefixes used in the schemas.

The test invoice documents InvoiceExt.xml and InvoiceExtBad.xml begin with a timesheet extension that use both common and foreign constructs:

<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"
 xmlns:ext="urn:oasis:names:specification:ubl:schema:xsd:CommonExtensionComponents-2"
 xmlns:mxd="urn:X-MyCompany:xsd:MyTimesheetExtension"
 xmlns:mxa="urn:X-MyCompany:xsd:MyTimesheetExtension:AggregateComponents"
 xmlns:mxb="urn:X-MyCompany:xsd:MyTimesheetExtension:BasicComponents">
  <ext:UBLExtensions>
    <ext:UBLExtension>
      <!-- standardized extension metadata inserted here if desired -->
      <!-- followed by the extension content with a foreign apex construct -->
      <ext:ExtensionContent>
        <mxd:Timesheet>
          <cbc:StartDate>2011-10-01</cbc:StartDate>
          <cbc:EndDate>2011-10-31</cbc:EndDate>
          <mxa:TimesheetParty>
            <mxa:TimesheetEntry>
              <cbc:Date>2011-10-12</cbc:Date>
              <mxb:HoursNumeric>4</mxb:HoursNumeric>
              <mxa:Task>
                <cbc:Description>Teleconference</cbc:Description>
                <mxb:HoursNumeric>1</mxb:HoursNumeric>
              </mxa:Task>
              <mxa:Task>
                <cbc:Description>Development</cbc:Description>
                <mxb:HoursNumeric>3</mxb:HoursNumeric>
              </mxa:Task>
            </mxa:TimesheetEntry>
            <cac:Party>
              <cac:PartyIdentification>
                <cbc:ID>Ken</cbc:ID>
              </cac:PartyIdentification>
            </cac:Party>
          </mxa:TimesheetParty>
        </mxd:Timesheet>
      </ext:ExtensionContent>
    </ext:UBLExtension>
  </ext:UBLExtensions>
  <cbc:UBLVersionID>2.0</cbc:UBLVersionID>
  <!-- remaining invoice content continues here -->

The custom documents MyRARequest.xml and MyRARequestBad.xml are short and contain both common and foreign constructs:

<ReturnAuthorizationRequest
  xmlns="urn:X-MyCompany:xsd:MyReturnAuthorizationRequest"
  xmlns:rqa="urn:X-MyCompany:xsd:MyRARequestResponse:AggregateComponents"
  xmlns:rqb="urn:X-MyCompany:xsd:MyRARequestResponse:BasicComponents"
  xmlns:cac="urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2"
  xmlns:cbc="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2">
  <rqb:RequestDate>2011-11-15</rqb:RequestDate>
  <rqa:RequestingParty>
    <cac:Contact>
      <cbc:ElectronicMail>joeBloggs@example.com</cbc:ElectronicMail>
    </cac:Contact>
  </rqa:RequestingParty>
  <rqa:ReturnRequested>
    <rqb:RequestedQuantity>3</rqb:RequestedQuantity>
    <cac:OrderLineReference>
      <cbc:LineID>1</cbc:LineID>
      <cac:OrderReference>
        <cbc:ID>20111110-0112</cbc:ID>
      </cac:OrderReference>
    </cac:OrderLineReference>
  </rqa:ReturnRequested>
</ReturnAuthorizationRequest>
<ReturnAuthorizationRequest
  xmlns="urn:X-MyCompany:xsd:MyReturnAuthorizationRequest"
  xmlns:rqa="urn:X-MyCompany:xsd:MyRARequestResponse:AggregateComponents"
  xmlns:rqb="urn:X-MyCompany:xsd:MyRARequestResponse:BasicComponents"
  xmlns:cac="urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2"
  xmlns:cbc="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2">
  <rqb:RequestDate>2011-11-15</rqb:RequestDate>
  <rqa:RequestingParty>
    <cac:Contact>
      <cbc:ElectronicMail>joeBloggs@example.com</cbc:ElectronicMail>
    </cac:Contact>
  </rqa:RequestingParty>
  <rqa:ReturnRequested>
    <rqb:RequestedQuantityx>3</rqb:RequestedQuantityx>
    <cac:OrderLineReference>
      <cbc:LineID>1</cbc:LineID>
      <cac:OrderReference>
        <cbc:ID>20111110-0112</cbc:ID>
      </cac:OrderReference>
    </cac:OrderLineReference>
  </rqa:ReturnRequested>
</ReturnAuthorizationRequest>

The custom documents MyRAResponse.xml and MyRAResponseBad.xml are short and contain both common and foreign constructs:

<ReturnAuthorizationResponse
  xmlns="urn:X-MyCompany:xsd:MyReturnAuthorizationResponse"
  xmlns:rsa="urn:X-MyCompany:xsd:MyRARequestResponse:AggregateComponents"
  xmlns:rsb="urn:X-MyCompany:xsd:MyRARequestResponse:BasicComponents"
  xmlns:cac="urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2"
  xmlns:cbc="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2">
  <cbc:ResponseDate>2011-11-15</cbc:ResponseDate>
  <rsb:ReturnGrantedIndicator>true</rsb:ReturnGrantedIndicator>
  <rsa:AuthorizingParty>
    <cac:PartyIdentification>
      <cbc:ID>EMP0987</cbc:ID>
    </cac:PartyIdentification>
  </rsa:AuthorizingParty>
  <rsa:RequestDocumentReference>
    <cbc:ID>17134</cbc:ID>
  </rsa:RequestDocumentReference>
  <rsa:ReturnGranted>
    <rsb:GrantedQuantity>2</rsb:GrantedQuantity>
    <rsa:ReturnRequested>
      <rsb:RequestedQuantity>3</rsb:RequestedQuantity>
      <cac:OrderLineReference>
        <cbc:LineID>1</cbc:LineID>
        <cac:OrderReference>
          <cbc:ID>20111110-0112</cbc:ID>
        </cac:OrderReference>
      </cac:OrderLineReference>
    </rsa:ReturnRequested>
  </rsa:ReturnGranted>
</ReturnAuthorizationResponse>
<ReturnAuthorizationResponse
  xmlns="urn:X-MyCompany:xsd:MyReturnAuthorizationResponse"
  xmlns:rsa="urn:X-MyCompany:xsd:MyRARequestResponse:AggregateComponents"
  xmlns:rsb="urn:X-MyCompany:xsd:MyRARequestResponse:BasicComponents"
  xmlns:cac="urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2"
  xmlns:cbc="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2">
  <cbc:ResponseDate>2011-11-15</cbc:ResponseDate>
  <rsb:ReturnGrantedIndicator>true</rsb:ReturnGrantedIndicator>
  <rsa:AuthorizingParty>
    <cac:PartyIdentification>
      <cbc:ID>EMP0987</cbc:ID>
    </cac:PartyIdentification>
  </rsa:AuthorizingParty>
  <rsa:RequestDocumentReference>
    <cbc:ID>17134</cbc:ID>
  </rsa:RequestDocumentReference>
  <rsa:ReturnGranted>
    <rsb:GrantedQuantityx>2</rsb:GrantedQuantityx>
    <rsa:ReturnRequested>
      <rsb:RequestedQuantity>3</rsb:RequestedQuantity>
      <cac:OrderLineReference>
        <cbc:LineID>1</cbc:LineID>
        <cac:OrderReference>
          <cbc:ID>20111110-0112</cbc:ID>
        </cac:OrderReference>
      </cac:OrderLineReference>
    </rsa:ReturnRequested>
  </rsa:ReturnGranted>
</ReturnAuthorizationResponse>

7. Context/value association files

This environment will create an OASIS context/value association file [CVA] for every configuration file entry of type "CVA". Typically there will be only zero or one such file in the configuration, as all such files will perform the same analysis on the input genericode files.

When present, the CVA configuration file entry specifies the URI of a skeleton CVA file used as a proforma output document. This skeleton file is not schema-valid using the OASIS CVA XSD schemas because they contain unrecognized attributes named NDRDataType=. This environment recognizes these invalid NDRDataType= attributes and replaces each one with the valid address= attribute using an XSLT match pattern of XPath addresses.

The addresses that are populated in the address= attribute are distilled from the input genericode file, finding all BBIE items with a data type value byte-for-byte identical to the NDRDataType= value. The addresses enumerate all of the BBIE elements of the given NDR data type, in a union match pattern.

An example from UBL 2.1 is for the data type "Currency_ Code. Type". The input skeleton CVA file contains the schema-invalid element:

      <Context values="Currency-2.0 Currency-2.1" metadata="cctsV2.01-code"
               NDRDataType="Currency_ Code. Type"/>

The output populated CVA file contains the corresponding schema-valid element:

      <Context values="Currency-2.0 Currency-2.1" metadata="cctsV2.01-code"
               address="cbc:CurrencyCode | cbc:DocumentCurrencyCode | 
                        cbc:PaymentAlternativeCurrencyCode | 
                        cbc:PaymentCurrencyCode | cbc:PricingCurrencyCode | 
                        cbc:RequestedInvoiceCurrencyCode | 
                        cbc:SourceCurrencyCode | cbc:TargetCurrencyCode | 
                        cbc:TaxCurrencyCode"/>

Bibliography

[CCTS] Core Components Technical Specification Version 2.01 - 15 November 2003

[CVA] G. Ken Holman Context Value Association files

[ods2ublgc] Crane Softwrights Ltd. OpenOffice spreadsheet export to genericode

[gc2ublndr] Crane Softwrights Ltd. Genericode to UBL NDR artefacts

[Saxon] Michael Kay Saxon

[UBL NDR 3.0] UBL Naming and Design Rules Version 3.0 04 February 2015. OASIS Committee Specification Draft. http://docs.oasis-open.org/ubl/UBL-NDR/v3.0/UBL-NDR-v3.0.html.

[UBL-2.1] Universal Business Language Version 2.1. 04 November 2013. OASIS Standard. http://docs.oasis-open.org/ubl/os-UBL-2.1/UBL-2.1.html.

[XSD] Henry S. Thomson, et al.XML Schema Part 1: Structures Second Edition 2004-03-18