Patent ID: 8381097

Claim:
A method of binary coding of a structured document comprising at least a plurality of data items to code, the method comprising performing, by a computer, the steps of: determining at least one first parameter of a first coding scheme, said first parameter being a coding length; determining at least one second parameter of at least one second coding scheme according to said at least one first parameter of said first coding scheme, said first and said at least one second coding scheme being of the same type, wherein determining the second parameter comprises: initializing a counting table with coding length values less than the first parameter; counting a number of data items that can be respectively coded with each coding length value of the counting table; evaluating a respective coding cost associated with each particular coding length value of the counting table, based on the number of items that can be coded with the respective coding length value; and determining the second parameter as the coding length value associated with the smallest coding cost, and wherein the method further comprises: obtaining at least one item of data of said at least one plurality of data items; evaluating a coding efficiency of said at least one item of data according to said first and said at least one second coding schemes, wherein the coding efficiency is based on the respective coding cost of coding said at least one item of data; comparing said coding efficiency of said first and said at least one second coding schemes for coding said at least one item of data; and coding said data item according to the at least one second coding scheme, if said data item can be coded more efficiently by said second coding scheme.