The method of coding a hierarchized document comprises, for at least one element contained in the document:
a step (200, 210, 220) of creating at least one pattern which describes at least structural information of said element and
a step (230, 330) of selecting use, or not, of at least one of the created patterns, said selection depending on the efficiency of a coding operation of a set of instances of the created pattern, said coding operation implementing said created pattern.
Preferentially, the method comprises a step of creating at least two patterns which describe at least structural information of said element and a step of selecting a pattern from among the created patterns, on the basis of the efficiency of each coding operation of a set of instances of the created patterns, by implementing one of the created patterns