A document encoding apparatus for encoding a structured document, comprising: a detection unit adapted to detect attribute values in the structured document; and an acquisition unit adapted to acquire digit counts after a decimal point of the attribute values detected by said detection unit, characterized by further comprising: a transformation unit adapted to transform the attribute values detected by said detection unit into value character strings that represent integer values by manipulating decimal point positions of the attribute values in accordance with a maximum digit count determined in accordance with a required value precision (S405, S406); a determination unit adapted to determine whether or not each of the integer values represented by the value character strings falls within an integer range in which a k-byte integer expresses values, wherein the number of bytes of an encoding result obtained by encoding a value as a floating-point number according to IEEE754 is more than the k-byte integer; a first encoding unit adapted to encode, according to an integer encoding method, the value character strings which represent the integer values falling within the integer range and the maximum digit count; and a second encoding unit adapted to encode, as a floating-point number according to IEEE754, the attribute values constituting a transformation source of the value character strings which represent the integer values falling outside the integer range. a detection unit adapted to detect attribute values in the structured document; and an acquisition unit adapted to acquire digit counts after a decimal point of the attribute values detected by said detection unit, characterized by further comprising: a transformation unit adapted to transform the attribute values detected by said detection unit into value character strings that represent integer values by manipulating decimal point positions of the attribute values in accordance with a maximum digit count determined in accordance with a required value precision (S405, S406); a determination unit adapted to determine whether or not each of the integer values represented by the value character strings falls within an integer range in which a k-byte integer expresses values, wherein the number of bytes of an encoding result obtained by encoding a value as a floating-point number according to IEEE754 is more than the k-byte integer; a first encoding unit adapted to encode, according to an integer encoding method, the value character strings which represent the integer values falling within the integer range and the maximum digit count; and a second encoding unit adapted to encode, as a floating-point number according to IEEE754, the attribute values constituting a transformation source of the value character strings which represent the integer values falling outside the integer range. a transformation unit adapted to transform the attribute values detected by said detection unit into value character strings that represent integer values by manipulating decimal point positions of the attribute values in accordance with a maximum digit count determined in accordance with a required value precision (S405, S406); a determination unit adapted to determine whether or not each of the integer values represented by the value character strings falls within an integer range in which a k-byte integer expresses values, wherein the number of bytes of an encoding result obtained by encoding a value as a floating-point number according to IEEE754 is more than the k-byte integer; a first encoding unit adapted to encode, according to an integer encoding method, the value character strings which represent the integer values falling within the integer range and the maximum digit count; and a second encoding unit adapted to encode, as a floating-point number according to IEEE754, the attribute values constituting a transformation source of the value character strings which represent the integer values falling outside the integer range.