In this paper we propose an automatic mechanism for annotating XML documents. This mechanism relies on a simple data model whose main features are: (1) a modeling of XML documents as trees composed of elements that are possibly distributed over a network, (2) a composition operator to create new documents from existing ones, and (3) an inference algorithm for automatically deriving the annotation of composite documents from the annotations of their components. We illustrate the features of the model with an application to eLearning resources.