Close

Relief for ODA Team in Ukraine

Learn more
ODA Drawings SDK
Working with the xs:hexBinary Element Type

The xs:hexBinary type of element in the XML schema is for writing an array of N count bytes. Elements of this type have the required "oda:countBytes = "name | value" " attribute. The element that is referenced by "oda:countBytes" (if it does not contain a number) must be marked with the oda: "isCondition = "" " attribute.

An xs:hexBinary element can have the following attributes:

  • oda:countBytes="name | value" — Indicates the length value of the written byte array or the name of the element whose number (integer) was placed in the cache. For example:
    
    pFiler->wrInt16(size);
    pFiler->wrBytes (buffer, size);
    pFiler->wrString(str);
    pFiler->wrInt32(element);
    pFiler->wrBytes(buffer_2, 10);
    pFiler->wrInt8(bSize);
    pFiler->wrBytes(buffer_3, bSize*size);
    
    <xs:element name="Size" type="xs:short" oda:isCondition=""/>
    <xs:element name="binaryArray" type="xs:hexBinary" oda:countBytes="Size"/>
    <xs:element name="str" type="xs:string"/>
    <xs:element name="someElement" type="xs:int"/>
    <xs:element name="binaryData" type="xs:hexBinary" oda:countBytes="10"/>
    <xs:element name="bSize" type="xs:byte " oda:isCondition=""/>
    <xs:element name="binaryData_2" type="xs:hexBinary" oda:countBytes="Size* bSize "/>
      
  • oda:reduceIn="numeric value" — Reduces the value taken from the "name" attribute (or from the cache by key) by the number indicated in "oda:reduceIn".
  • oda:increaseIn="numeric value" — Increases the value taken from the "name" attribute (or from the cache by key) by the number indicated in "oda:increaseIn". For example:
    
    int bitLen = pFiler->rdInt32();
    int len = bitLen / 8;
    pFiler->rdBytes(tmpData.asArrayPtr(), len);
    int bitLen_2 = pFiler->rdInt32();
    int len_2 = bitLen_2 * 2;
    pFiler->rdBytes(tmpData.asArrayPtr(), len_2);
    
    <xs:element name=" bitLen" type="xs:int" oda:isCondition=""/>
    <xs:element name="tmpData1" type="xs:hexBinary" oda:countBytes=" bitLen" oda:reduceIn="8"/>
    <xs:element name=" bitLen_2" type="xs:int" oda:isCondition=""/>
    <xs:element name="tmpData2" type="xs:hexBinary" oda:countBytes=" bitLen_2" oda:increaseIn="2"/>
      

See Also

Working with the XML Scheme for Revision Control

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