To work with class versions, the next attributes are used:
All classes (<xs:complexType> tag) must have an "oda:version="value" " attribute, where the value >= 1. When a new schema is released with some classes that are changed, they must increase their own "oda:version" attribute. Elements, conditions, and arrays that are added or deleted from this class must have the "oda:addInVersion/oda:deletedInVersion" attribute. For example:
OdResult LineExample::dwgInFields(OdDbDwgFiler* pFiler)
{
m_NC = pFiler->rdInt32();
if(version < 3)
m_NG = pFiler->rdInt32();
m_strPoint = pFiler->rdPoint2d();
m_endPoint = pFiler->rdPoint2d();
}
<xs:complexType name=" LineExample " oda:version="4">
<xs:sequence>
<xs:element name="m_NC" type="xs:int "/>
<xs:element name="m_NG" type="xs:int " oda:deletedInVersion="3"/>
<xs:element name="m_strPoint" type="OdGePoint2d"/>
<xs:element name="m_endPoint" type="OdGePoint2d"/>
</xs:sequence>
</xs:complexType>
Below is a new version of the class.
OdResult LineExample::dwgInFields(OdDbDwgFiler* pFiler)
{
m_NC = pFiler->rdInt32();
if(version < 3)
m_NG = pFiler->rdInt32();
m_strPoint = pFiler->rdPoint2d();
m_endPoint = pFiler->rdPoint2d();
if(version > 4)
m_color = pFiler->rdInt32();
}
<xs:complexType name=" LineExample " oda:version="5">
<xs:sequence>
<xs:element name="m_NC" type="xs:int "/>
<xs:element name="m_NG" type="xs:int " oda:deletedInVersion="3"/>
<xs:element name="m_strPoint" type="OdGePoint2d"/>
<xs:element name="m_endPoint" type="OdGePoint2d"/>
<xs:element name="m_color" type="xs:int " oda:addInVersion="5" oda:default="0"/>
</xs:sequence>
</xs:complexType>
You can also use the combination of "oda:addInVersion" and "oda:deletedInVersion" attributes when a tag was first added and then deleted in later versions. For example:
<xs:element name="m_var8" type="xs:int" oda:addInVersion="4" oda:default="20" oda:deletedInVersion="6"/>
The difference between the oda:default attribute for an element, array, or condition is the following:
Working with the XML Scheme for Revision Control
Copyright © 2002 – 2020. Open Design Alliance. All rights reserved.
|