Flexible Representation and Querying of Heterogeneous Structured Documents