The schema library as presented has several problems for runtime implementation
high processing overhead due to large library of dependencies.
Fragility in version management do to impact of potential version changes of any of the dependent imports.
A large number of optional fields in the schema obscures the potential simplicity of the actual Australian minimum common data set implementation.
Excessive use of attributes on core data types (eg every amount field has currency attribute but it's redundant because the schema already defines a default currency for the invoice)
Therefore, lets make a simple single root XSD that defines the structure of the Australian implementation as per the semantic model.
Use the set of sample files as a guidance for what's in / what's out. But check the Semantic model PDF too - to make sure there's a schema element for everything in there (but no more).
Use a single namespace only - that of the Core Invoice
Lets have all elements with name default unqualified (now that it's a single root we don't need all those namespace prefixes.
Include the description annotation but not all the other gook in the xsd files. (see example below)
<xsd:sequence>
<xsd:element ref="cbc:CityName" minOccurs="0" maxOccurs="1">
<xsd:annotation>
<xsd:documentation>
<dbc:Component>
<dbc:InformationElement>City</dbc:InformationElement>
</dbc:Component>
<ccts:Component>
<ccts:ComponentType>BBIE</ccts:ComponentType>
<ccts:DictionaryEntryName>Address. City Name. Name</ccts:DictionaryEntryName>
<ccts:Definition>The name of a city, town, or village.</ccts:Definition>
<ccts:Cardinality>0..1</ccts:Cardinality>
<ccts:ObjectClass>Address</ccts:ObjectClass>
<ccts:PropertyTerm>City Name</ccts:PropertyTerm>
<ccts:RepresentationTerm>Name</ccts:RepresentationTerm>
<ccts:DataType>Name. Type</ccts:DataType>
<ccts:AlternativeBusinessTerms>LocalityName</ccts:AlternativeBusinessTerms>
<ccts:Examples>Hong Kong </ccts:Examples>
</ccts:Component>
</xsd:documentation>
</xsd:annotation>
should be more like
<xsd:sequence>
<xsd:element ref="CityName" minOccurs="0" maxOccurs="1">
<xsd:annotation>
<xsd:documentation>
The name of a city, town, or village.
</xsd:documentation>
</xsd:annotation>
And then please modify all the sample XML in the testsets directory so that they validate against our new schema - I expect that'll mostly just mean removing namespace declarations and prefixes and most of the attributes. Lets put our new XML samples in a /xml_testsets subdirectory in our /docs folder - leaving the originals unchanged and still validating against the big schema library.
Copied from original issue: ausdigital/billing-semantics#3
Closing this - decided not to do it. Preferred approach is to leave the UBL XML un-touched so that interoperability is maintained. Instead focus on a lossless transform to a simple JSON representation
From @onthebreeze on December 5, 2016 11:1
Refer to #2
The schema library as presented has several problems for runtime implementation
Therefore, lets make a simple single root XSD that defines the structure of the Australian implementation as per the semantic model.
should be more like
Lets put our new Schema in our docs directory at https://github.com/ausdigital/billing-semantics/tree/master/docs
And then please modify all the sample XML in the testsets directory so that they validate against our new schema - I expect that'll mostly just mean removing namespace declarations and prefixes and most of the attributes. Lets put our new XML samples in a /xml_testsets subdirectory in our /docs folder - leaving the originals unchanged and still validating against the big schema library.
Copied from original issue: ausdigital/billing-semantics#3