Back to articles list
- 4 minutes read

Vertabelo XML Version 2.3

The XML file format for Vertabelo has changed to version 2.3. Read this article to find out what is new.

Vertabelo keeps its models in XML format; if you need, you can download the files and extract information from them. Previously, we used XML version 2.1, as discussed in this article. We’ve switched to XML 2.3, and a couple of changes took place. These changes make no difference for most Vertabelo users. Vertabelo automatically converts the old XML version to the new one upon import or export.

All of our ORM tools – VertabeloPropel, VertabeloSqlalchemy or the Vertabelo plugin for jOOQ, all of which are available on GitHub – have been updated to work with the newer XML version as well.

What if you want to parse Vertabelo’s XML files? Read this article to find out what has changed. You may also want to download the current XSD file.

New XML Elements

There are a number of new elements used in XML version 2.3. Let’s take a look at them:

  • Information on the database engine – the XSD now includes the database engine, providing its name and version:

    <xsd:complexType name="DatabaseEngine">
      <xsd:sequence>
        <xsd:element name="Name" type="xsd:string"/>
        <xsd:element name="Version" type="xsd:string"/>
      </xsd:sequence>
    </xsd:complexType>
    

    Below, we see what the XML information might look like when we choose PostgreSQL 9.x as our database engine:

    <DatabaseEngine>
        <Name>postgresql</Name>
        <Version>9.x</Version>
    </DatabaseEngine>
    

  • New fields (name, description and DefaultAdditionalProperties) are added to DatabaseModel – In these fields, the whole database model can be named and described. Additional default properties are also listed:

    <xsd:element name="DatabaseModel">
      <xsd:complexType>
       <xsd:sequence>
         <xsd:element name="Name" type="xsd:string"/>
         <xsd:element name="Description" type="xsd:string"/>
         <xsd:element name="DatabaseEngine" type="DatabaseEngine"/>
         …
         <xsd:element name="DefaultAdditionalProperties"
     type="DefaultAdditionalProperties" minOccurs="0" maxOccurs="1"/>
       </xsd:sequence>
       <xsd:attribute name="VersionId" type="xsd:string"/>
      </xsd:complexType>
    </xsd:element>
    

    For instance, if we enter the following information in Vertabelo, the XML will look like the code below:

    <DatabaseModel VersionId="2.3">
    <Name>Sample model</Name>
    <Description>This is a sample model to demonstrate the changes in
    Vertabelo XSD.
    </Description>
    … 
    </DatabaseModel>
    

Model details

Removed Elements

Some elements, present in previous XSD versions, have now been removed:

  • ModelGid and ModelVersionGid – These elements were used for backward compatibility.
  • HasMinValue and HasMaxValue have been removed from Sequence because they were redundant – you can provide the desired values using MinValue, MaxValue. The HasCache tag has been renamed to UseCache.

Updated Elements

A number of elements that have been updated may require some explanation. Let’s analyze them in detail.

  • Tag nesting for tables and views has been changed. In the previous version, we would specify each under a separate tag, as shown here:

      <AlternateKeys>
      <AlternateKey>
      ...
        <Columns>
          <Column>name</Columns>
        </Columns>
        <Columns>
          <Column>name2</Columns>
        </Columns>
        ...
      </AlternateKey>
    </AlternateKeys>
    

    In XML 2.3, these columns are grouped under a single tag:

      <AlternateKeys>
      <AlternateKey>
      ...
      <Columns>
        <Column>name</Column>
        <Column>name2</Column>
      </Columns>
      ...
      </AlternateKey>
    </AlternateKeys>
    

    Similarly, views are now grouped under a single field, Dependencies. Instead of:

    <View>
      ...
      <Dependencies>
        <View>name</View>
      </Dependencies>
      <Dependencies>
        <View>name2</View>
      </Dependencies>
      ...
    </View>
    

    They are now handled in the following way:

    <View>
      ...
      <Dependencies>
        <View>name</View>
        <View>name2</View>
      </Dependencies>
      ...
    </View>
    

  • The tag name ControlPointsType has been changed to Type:

    <xsd:complexType name="ReferenceDisplayInfo">
      <xsd:sequence>
      <xsd:element name="Color" type="xsd:string"/>
      <xsd:element name=";Type" type="ControlPointsType"/>
      ...
      </xsd:sequence>
      <xsd:attribute name="Id" type="xsd:ID"/>
    </xsd:complexType>
    

  • Primary keys have been moved. In XSD 2.1, primary keys were defined in specific columns using a boolean field:

    <xsd:complexType name="Column">
      <xsd:sequence>
      ...
      <xsd:element name="PK" type="xsd:boolean"/>
      ...
      </xsd:sequence>
      <!   ...   >
    </xsd:complexType>
    

    The above looked like this in the previous XML version:

    <Column Id="c1">
      <!   ...   >
      <PK>true</PK>
      <!   ...   >
    </Column>
    <Column Id="c2">
      <!   ...   >
      <PK>true</PK>
      <!   ...   >
    </Column>
    

    Now, primary keys are defined for the entire table:

    <xsd:complexType name="Table">
      <xsd:sequence>
      ...
      <xsd:element name="PrimaryKey" type="PrimaryKey" minOccurs="0" 
      maxOccurs="1"/>
      ...
      </xsd:sequence>
      <xsd:attribute name="Id" type="xsd:ID"/>
    </xsd:complexType>
    

    They are now presented this way in the XML file:

    <Table Id="t1">
      ...
      <Columns>
          <Column Id="c1">
              ...
          </Column>
          <Column Id="c2">
              ...
          </Column>
              ...  
      </Columns>
      <PrimaryKey>
          <Name>pk1</Name>
          <Columns>
              <Column>c1</Column>
              <Column>c2</Column>
          </Columns>
      </PrimaryKey>
      ...
    </Table>
    

  • Providing the table name in TableDisplayInfo used to be voluntary. It is now mandatory:

    <xsd:complexType name="TableDisplayInfo">
      <xsd:sequence>
        ...
        <xsd:element name="Table" type="xsd:IDREF" minOccurs="1"
        maxOccurs="1"/>
        ...
      </xsd:sequence>
      <xsd:attribute name="Id" type="xsd:ID"/>
    </xsd:complexType>
    

  • The tags ReferenceDisplays, ReferenceDisplay and ControlPoint are now organized under a separate node called ControlPoints.
  • Tag nesting for columns on an index has changed. This is comparable to the way column names are now handled. Instead of:

    <Index>
      ...
       <Columns>
          <Column>name</Column>
          <Ascending>true</Ascending>
      </Columns>
      <Columns>
          <Column>name2</Column>
          <Ascending>true</Ascending>
      </Columns>
      ...
    </Index>
    

    They are now specified like this:

    <Index>
      ...
      <Columns>
        <Column>
            <Name>name</Name>
            <Ascending>true</Ascending>
        </Column>
        <Column>
            <Name>name2</Name>
            <Ascending>true</Ascending>
        </Column>
      </Columns>
      ...
    </Index>
    

  • Property Identifiers have changed. Properties used to be identified by their names, following the way they were presented to the user in Vertabelo (e.g. “Character set”). Now, they are represented by codes (e.g. “character_set”) created by replacing all spaces with underscores and using lowercase only.

If you want to know more, you can take a look at the two XSD versions by downloading the XSD 2.1 file and comparing it with XSD 2.3.


go to top