XSD to XLSX Conversion (XSD2XLSX): for documentation and better readability

Exchanging messages between systems is mostly implemented using XML files, which are specified with xml schema definitions, i.e. XSD files. In order to have the parties involved to agree on what data is transmitted there are often Excel sheets (XLSX) used for documentation. Both, the XSD and the Excel file can become quite big and changes have to be done for both files, which is then is often not happening. In order to support the documentation of the XSD, I used Python libraries to parse the XSD and to create the Excel/XLSX file (XSD2XLSX).

Libraries used are xlsxwriter and ElementTree. (See also the Machine Learning example where the xlsxwriter is used.)

A big benefit can be achieved if you hold all documentation in the XSD and then just generate Excel (or other) formats for discussion with business analysts.

Try out the XSD2XLSX mapping yourself.

Contact us to set up a customized solution for your needs

It is a good practice to have clear ownership of data structures. So you can declare the XSD the master and generate documentation from it and also import it into your development tool.

Here is the XSD source:

<?xml version=”1.0″ encoding=”UTF-8″?>
<xs:schema xmlns:xs=”http://www.w3.org/2001/XMLSchema” elementFormDefault=”qualified” attributeFormDefault=”unqualified”>
<xs:element name=”order”>
<xs:annotation>
<xs:documentation>purchase order only</xs:documentation>
</xs:annotation>
<xs:complexType>
<xs:sequence>
<xs:element name=”account”>
<xs:annotation>
<xs:documentation>account number with maximum length of 15</xs:documentation>
</xs:annotation>
<xs:simpleType>
<xs:restriction base=”xs:string”>
<xs:maxLength value=”15″/>
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name=”order_item” type=”order_item_type” maxOccurs=”100″/>
<xs:element name=”affiliate” minOccurs=”0″>
<xs:annotation>
<xs:documentation>reference to a sales partner</xs:documentation>
</xs:annotation>
<xs:simpleType>
<xs:restriction base=”xs:string”>
<xs:maxLength value=”250″/>
<xs:enumeration value=”one enum”/>
<xs:enumeration value=”another enum”/>
</xs:restriction>
</xs:simpleType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:complexType name=”order_item_type”>
<xs:all>
<xs:element name=”material_number”>
<xs:annotation>
<xs:documentation>reference to catalogue</xs:documentation>
</xs:annotation>
<xs:simpleType>
<xs:restriction base=”xs:string”>
<xs:maxLength value=”20″/>
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name=”amount” type=”xs:integer”/>
</xs:all>
</xs:complexType>
</xs:schema>