XML Schema Importer¶
ALFA allows XML Schemas to be imported as ALFA models.
ALFA models are significantly more succinct and expressive than XSD Schemas.
Using fragment, definitions imported from XSD Schemas into ALFA
can be extended with assert
statements, used in service definitions etc.
Conversions¶
This is not an exhausting list of conversion rules, but at a high-level the followin conversions apply.
- XSD ComplexType imported as ALFA trait definition. This enables XSD type inheritance
using trait
includes
feature. - XSD SimpleType enumerations are imported as ALFA enum.
- XSD ComplexType choices are imported as ALFA union.
- All XSD Annotation documentation tags are imported as documentation nodes.
- All XSD native types and constraints are fully converted to ALFA types and constraints.
ALFA uses a JAXB Plugin and the import is performed via the XJC Maven plugin. The generated model is fully self-contained in a single file.
Please contact info@schemarise.com for further information.
Example¶
Given the following XSD Schema snippet:
<xs:complexType name="SecuritiesTransactionReport2">
<xs:annotation>
<xs:documentation source="Name" xml:lang="EN">SecuritiesTransactionReport2</xs:documentation>
<xs:documentation source="Definition" xml:lang="EN">Details of the securities transaction report.</xs:documentation>
</xs:annotation>
<xs:sequence>
<xs:element name="TxId" type="Max52Text">
<xs:annotation>
<xs:documentation source="Name" xml:lang="EN">TransactionIdentification</xs:documentation>
<xs:documentation source="Definition" xml:lang="EN">Unique and unambiguous identification of the transaction.</xs:documentation>
</xs:annotation>
</xs:element>
<xs:element name="ExctgPty" type="LEIIdentifier">
<xs:annotation>
<xs:documentation source="Name" xml:lang="EN">ExecutingParty</xs:documentation>
<xs:documentation source="Definition" xml:lang="EN">Identification of the entity executing the transaction.
Usage:
For legal entities, use the legal entity identifier. For non-legal entities, this field shall be populated with an identifier as specified in the local regulation.</xs:documentation>
</xs:annotation>
</xs:element>
<xs:element name="SubmitgPty" type="LEIIdentifier">
<xs:annotation>
<xs:documentation source="Name" xml:lang="EN">SubmittingParty</xs:documentation>
<xs:documentation source="Definition" xml:lang="EN">Entity submitting the transaction report to the competent authority. </xs:documentation>
</xs:annotation>
</xs:element>
<xs:element maxOccurs="1" minOccurs="0" name="TechAttrbts" type="RecordTechnicalData2">
<xs:annotation>
<xs:documentation source="Name" xml:lang="EN">TechnicalAttributes</xs:documentation>
<xs:documentation source="Definition" xml:lang="EN">Data used for exchanges between national competent authorities, not to be used by reporting entities.</xs:documentation>
</xs:annotation>
</xs:element>
<xs:element maxOccurs="unbounded" minOccurs="0" name="SplmtryData" type="SupplementaryData1">
<xs:annotation>
<xs:documentation source="Name" xml:lang="EN">SupplementaryData</xs:documentation>
<xs:documentation source="Definition" xml:lang="EN">Additional information that can not be captured in the structured fields and/or any other specific block.</xs:documentation>
</xs:annotation>
</xs:element>
</xs:sequence>
</xs:complexType>
The following ALFA model is generated:
trait SecuritiesTransactionReport2 {
# Unique and unambiguous identification of the transaction.
TxId : string(1, 52) ?
/#
Identification of the entity executing the transaction.
Usage:
For legal entities, use the legal entity identifier. For non-legal entities, this field shall be populated with an identifier as specified in the local regulation.
#/
ExctgPty : string("[A-Z0-9]{18,18}[0-9]{2,2}") ?
# Entity submitting the transaction report to the competent authority.
SubmitgPty : string("[A-Z0-9]{18,18}[0-9]{2,2}") ?
# Data used for exchanges between national competent authorities, not to be used by reporting entities.
TechAttrbts : RecordTechnicalData2 ?
# Additional information that can not be captured in the structured fields and/or any other specific block.
SplmtryData : list< SupplementaryData1 > ?
}