Drawings SDK Developer Guide > Using Drawings Revision Control > Working with the XML Scheme for DRC > Example of Working with the XML Scheme
Example of Working with the XML Scheme

This topic contains examples of working with the XML scheme.

Example 1


void ExTestClassVersionHexBinary::dwgOutFields(OdDbDwgFiler* pFiler) const
{
  pFiler->wrUInt8(len_1);
  pFiler->wrUInt8(len_6);
  if (lastKnownVersion > 2)
    pFiler->wrUInt8(len_7);
  pFiler->wrUInt8(len_8);

  pFiler->wrBytes(pArr_1, len_1);

  if (lastKnownVersion < 3)
  {
    pFiler->wrUInt8(len_2);
    pFiler->wrBytes(pArr_2, len_2);
  }
  if (lastKnownVersion < 3)
  {
    pFiler->wrUInt8(len_3);
    pFiler->wrBytes(pArr_3, len_3);
  }
  if (lastKnownVersion < 4)
  {
    pFiler->wrUInt8(len_4);
    pFiler->wrBytes(pArr_4, len_4);
  }
  if (lastKnownVersion > 4)
  {
    pFiler->wrUInt8(len_5);
    pFiler->wrBytes(pArr_5, len_5);
  }
  if (lastKnownVersion < 4)
  {
    pFiler->wrBytes(pArr_6, len_6);
  }
  if (lastKnownVersion > 2)
  {
    pFiler->wrBytes(pArr_7, len_7);
  }
  pFiler->wrBytes(pArr_8, len_8);
}

<xs:complexType name="ExTestClassVersionHexBinary" oda:version="5">
  <xs:sequence>
    <xs:element name="len_1" type="xs:byte" oda:isCondition=""/>
    <xs:element name="len_6" type="xs:byte" oda:isCondition=""/>
    <xs:element name="len_7" type="xs:byte" oda:isCondition="" oda:addInVersion="3" oda:default="30"/>
    <xs:element name="len_8" type="xs:byte" oda:isCondition=""/>
		
    <xs:element name="arr1" type="xs:hexBinary" oda:countBytes="len_1"/>
		
    <xs:element name="len_2" type="xs:byte" oda:isCondition="" oda:deletedInVersion="3"/>
    <xs:element name="arr2" type="xs:hexBinary" oda:countBytes="len_2" oda:deletedInVersion="3"/>
		
    <xs:element name="len_3" type="xs:byte" oda:isCondition="" oda:deletedInVersion="3"/>
    <xs:element name="arr3" type="xs:hexBinary" oda:countBytes="len_3" oda:deletedInVersion="3"/>
		
    <xs:element name="len_4" type="xs:byte" oda:isCondition="" oda:deletedInVersion="4"/>
    <xs:element name="arr4" type="xs:hexBinary" oda:countBytes="len_4" oda:deletedInVersion="4"/>
		
    <xs:element name="len_5" type="xs:byte" oda:isCondition="" oda:addInVersion="5" oda:default="15"/>
    <xs:element name="arr5" type="xs:hexBinary" oda:countBytes="len_5" oda:addInVersion="5" oda:default="14"/>
		
    <xs:element name="arr6" type="xs:hexBinary" oda:countBytes="len_6" oda:deletedInVersion="4"/>
		
    <xs:element name="arr7" type="xs:hexBinary" oda:countBytes="len_7" oda:addInVersion="3" oda:default="14"/>
		
    <xs:element name="arr1" type="xs:hexBinary" oda:countBytes="len_8"/>
  </xs:sequence>
</xs:complexType>

Example 2


void ExTestClassVersionArray::dwgOutFields(OdDbDwgFiler* pFiler) const
{
  pFiler->wrInt8(m_var8_1);
  pFiler->wrInt8(m_var8_2);
  for (OdInt8 i = 0; i < m_var8_2; ++i)
    pFiler->wrInt8(m_var8_array_1.at(i));
  if (lastKnownVersion > 2)
  {
    for (OdInt8 i = 0; i < 5; ++i)
      pFiler->wrInt8(m_var8_array_2.at(i));

    pFiler->wrInt8(m_var8_3);
    for (OdInt8 i = 0; i < m_var8_3; ++i)
      pFiler->wrInt8(m_var8_array_3.at(i));
  }
  if (lastKnownVersion > 3)
  {
    pFiler->wrInt8(m_var8_4);
    for (OdInt8 i = 0; i < m_var8_4; ++i)
    {
      pFiler->wrInt8(m_var8_array_4.at(i));
      pFiler->wrInt8(m_var8_array_5.at(i));
    }
  }
  if (lastKnownVersion < 3)
  {
    pFiler->wrInt16(m_var16_1);
    for (OdInt16 i = 0; i < m_var16_1; ++i)
      pFiler->wrInt16(m_var16_array_1.at(i));
  }
  if (lastKnownVersion > 5)
  {
    pFiler->wrInt16(m_var16_2);
    for (OdInt16 i = 0; i < m_var16_2; ++i)
      pFiler->wrInt16(m_var16_array_2.at(i));
  }
  if (lastKnownVersion < 6)
  {
    pFiler->wrInt16(m_var16_3);
    for (OdInt16 i = 0; i < m_var16_3; ++i)
    {
      pFiler->wrInt16(m_var16_array_3.at(i));
      pFiler->wrInt16(m_var16_array_4.at(i));
    }
  }
  if (lastKnownVersion > 3)
  {
    if (lastKnownVersion < 6)
    {
      pFiler->wrInt32(m_var32_1);
      for (OdInt16 i = 0; i < m_var32_1; ++i)
        pFiler->wrInt32(m_var32_array_1.at(i));
    }
  }
  pFiler->wrInt32(m_var32_2);
  for (OdInt16 i = 0; i < m_var32_2; ++i)
    pFiler->wrInt32(m_var32_array_2.at(i));
  
  if(lastKnownVersion > 2)
    pFiler->wrInt32(m_var32_3);
  if (lastKnownVersion > 3)
  {
    for (OdInt16 i = 0; i < m_var32_3; ++i)
      pFiler->wrInt32(m_var32_array_3.at(i));
  }
  if (lastKnownVersion < 6)
  {
    pFiler->wrInt32(m_var32_4);
    for (OdInt16 i = 0; i < m_var32_4; ++i)
      pFiler->wrInt32(m_var32_array_4.at(i));
  }
}


<xs:complexType name="ExTestClassVersionArray" oda:version="7">
  <xs:sequence>
    <xs:element name="m_var8_1" type="xs:byte"/>
    <xs:element name="m_var8_2" type="xs:byte" oda:isCondition=""/>
    <oda:array name="m_var8_2">
      <xs:element name="m_var8_array_1" type="xs:byte"/>
    </oda:array>
		
    <oda:array name="Unknown" oda:addInVersion="3" oda:default="5">
      <xs:element name="m_var8_array_2" type="xs:byte" oda:addInVersion="3" oda:default="0"/>
    </oda:array>
		
    <xs:element name="m_var8_3" type="xs:byte" oda:isCondition="" oda:addInVersion="3" oda:default="4"/>
    <oda:array name="m_var8_3" oda:addInVersion="3" oda:default="5">
      <xs:element name="m_var8_array_3" type="xs:byte" oda:addInVersion="3" oda:default="1"/>
    </oda:array>
		
    <xs:element name="m_var8_4" type="xs:byte" oda:isCondition="" oda:addInVersion="4" oda:default="4"/>
    <oda:array name="m_var8_4" oda:addInVersion="4" oda:default="4">
      <xs:element name="m_var8_array_4" type="xs:byte" oda:addInVersion="4" oda:default="2"/>
      <xs:element name="m_var8_array_5" type="xs:byte" oda:addInVersion="4" oda:default="3"/>
    </oda:array>	
		
    <xs:element name="m_var16_1" type="xs:short" oda:isCondition="" oda:deletedInVersion="3"/>
    <oda:array name="m_var16_1" oda:deletedInVersion="3">
      <xs:element name="m_var16_1_array1" type="xs:short" oda:deletedInVersion="3"/>
    </oda:array>
		
    <xs:element name="m_var16_2" type="xs:short" oda:isCondition="" oda:addInVersion="6" oda:default="7"/>
    <oda:array name="m_var16_2" oda:addInVersion="6" oda:default="7">
      <xs:element name="m_var16_2_array_2" type="xs:short" oda:addInVersion="6" oda:default="10"/>
    </oda:array>
		
    <xs:element name="m_var16_3" type="xs:short" oda:isCondition="" oda:deletedInVersion="6"/>
    <oda:array name="m_var16_3" oda:deletedInVersion="6">
      <xs:element name="m_var16_3_array" type="xs:short" oda:deletedInVersion="6"/>
      <xs:element name="m_var16_4_array" type="xs:short" oda:deletedInVersion="6"/>
    </oda:array>
		
    <xs:element name="m_var32_1" type="xs:int" oda:isCondition="" oda:addInVersion="4" oda:default="8" oda:deletedInVersion="6"/>
    <oda:array name="m_var32_1" oda:addInVersion="4" oda:default="8" oda:deletedInVersion="6">
      <xs:element name="m_var8_array_3" type="xs:int" oda:addInVersion="4" oda:default="20" oda:deletedInVersion="6"/>
    </oda:array>
		
    <xs:element name="m_var32_2" type="xs:int" oda:isCondition=""/>
    <oda:array name="m_var32_2">
      <xs:element name="m_var32_2_array" type="xs:int"/>
    </oda:array>
		
    <xs:element name="m_var32_3" type="xs:int" oda:isCondition="" oda:addInVersion="3" oda:default="8"/>
    <oda:array name="m_var32_3" oda:addInVersion="4" oda:default="8">
      <xs:element name="m_var32_3_array" type="xs:int" oda:addInVersion="4" oda:default="24"/>
    </oda:array>
		
    <xs:element name="m_var32_4" type="xs:int" oda:isCondition="" oda:deletedInVersion="6"/>
    <oda:array name="m_var32_4" oda:deletedInVersion="6">
      <xs:element name="m_var32_4_array" type="xs:int" oda:deletedInVersion="6"/>
    </oda:array>
		
  </xs:sequence>
</xs:complexType>

See Also

Working with the XML Scheme for Revision Control

Copyright © 2002 – 2021. Open Design Alliance. All rights reserved.