It is one object of the present invention to perform data compression to encode
the structure part of a document in a tree local language, such as XML or ASN. 1.
A data compression apparatus for encoding data and for compressing the encoded
data comprises: a grammar rule 12 for a tree local language in which data
are represented by a labeled tree structure; an encoder 11 for reading a
document written in the tree local language, for dividing the document into a structure
part and contents, and for encoding the structure part using the grammar rule 12;
and a compressor 13 for compressing the contents of the document extracted
by the encoder 11, and for encoding the compressed contents.