Crane's RELAX-NG schemas for OASIS UBL

G. Ken Holman

Crane Softwrights Ltd.

$Date: 2010/08/30 20:47:38 $(UTC)


Table of Contents

1. Introduction
2. Installation
3. Integration and use
4. Restriction
Bibliography

1. Introduction

This is a package of RELAX-NG compact syntax schemas [RELAX-NG] suitable for validating and directed editing of OASIS Universal Business Language (UBL) [UBLTC] XML instances.

This release supports instances of UBL 2.0 [UBL 2.0] and the UBL Schema Generation Task Group (SGTG) snapshot draft of UBL 2.1 [UBL SGTG 2.1] with the time stamp of 20100830-2010z, exclusive of the content of the extension point.

Support for the nXML major mode [nXML] for Emacs is included.

2. Installation

Unzipping the package creates the base directory with one RELAX-NG compact schema for each UBL document, plus the ns-UBL-schemas.xml association between namespaces and schemas suitable for directed editing tools such as Emacs with nXML. To engage this file in nXML, add the following to your schemas.xml file of locating rules:

  <include rules="ns-UBL-schemas.xml"/>

The versions/ subdirectory has all of the individually-versioned RELAX-NG schemas, each with one modification from those published by the UBL committee: the optional UBLVersionID has a hardwired element text value being the UBL version.

The aggregate document schema titled "UBL-AllModels.rnc" allows any UBL instance to be validated with the corresponding internally-referenced RELAX-NG document model. Note, however, the magnitude of this aggregate schema may prove to exceed many processing capacities.

3. Integration and use

To engage validating or directed editing of a UBL instance, point the application to the appropriate RNC file in the base directory. Alternatively, pointing an application aware of the namespace association file will automatically engage the required RNC file from the base directory.

Each RNC file in the base directory will engage one or more modified schemas accommodating the available versions of the document type. The unmodified versions are created from using the Sun MSV RELAX-NG converter [RNGCONV] and James Clark's Trang [Trang]. The modification ensures that when the UBLVersionID element is present it must be populated with the version number of one of the available versions. Simply populating the element will ensure the remainder of the document is constrained accordingly.

For example, consider this Emacs/nXML example of an instance fragment that properly uses proposed UBL 2.1 elements:

<Invoice xmlns="urn:...>
  <cbc:UBLVersionID>2.1</cbc:UBLVersionID>
  <cbc:CustomizationID>urn:X-Crane</cbc:CustomizationID>
  <cbc:ProfileID>urn:X-Crane:SimpleInvoice</cbc:ProfileID>
  <cbc:ID>A123</cbc:ID>
  <cbc:CopyIndicator>false</cbc:CopyIndicator>
  <cbc:IssueDate>2010-03-31</cbc:IssueDate>
  <cbc:InvoiceDueDate>2010-04-30</cbc:InvoiceDueDate>
  <cbc:Note>Example invoice; not bona fide.</cbc:Note>
  <cbc:DocumentCurrencyCode>CAD</cbc:DocumentCurrencyCode>
  ...

Simply editing the version identifier to 2.0, and doing nothing else, highlights the proposed InvoiceDueDate as an unknown element in error:

<Invoice xmlns="urn:...>
  <cbc:UBLVersionID>2.0</cbc:UBLVersionID>
  <cbc:CustomizationID>urn:X-Crane</cbc:CustomizationID>
  <cbc:ProfileID>urn:X-Crane:SimpleInvoice</cbc:ProfileID>
  <cbc:ID>A123</cbc:ID>
  <cbc:CopyIndicator>false</cbc:CopyIndicator>
  <cbc:IssueDate>2010-03-31</cbc:IssueDate>
  <cbc:InvoiceDueDate>2010-04-30</cbc:InvoiceDueDate>
  <cbc:Note>Example invoice; not bona fide.</cbc:Note>
  <cbc:DocumentCurrencyCode>CAD</cbc:DocumentCurrencyCode>
  ...

Of course if you wish to hardwire the validation of any particular version of a UBL schema you can directly point to the versioned name in the versions/ subdirectory.

4. Restriction

At this time, due to a shortcoming of the RNGCONV tool, the content of the extension point is not validated even though the original XSD schemas for UBL 2.1 define a signature extension. Hopefully this restriction will be lifted in the future with the advent of more precise tools.

Bibliography

[nXML] James Clark nXML mode home page

[RELAX-NG] James Clark, Makoto Murata ISO/IEC 19757-2 RELAX-NG (Regular Language for XML)

[UBL SGTG 2.1] Jon Bosak, Tim McGrath, G. Ken Holman UBL Schema Generation Task Group snapshot draft for UBL 2.1 (time stamp 20100830-2010z), OASIS UBL SGTG snapshot 2010-08-30

[UBLTC] Jon Bosak, Tim McGrath OASIS UBL Technical Committee 2001