1. A method for storing a document, the method comprising: storing a content stream representation of the document comprising an ordered stream of code representations for primitive elements of the document, each code representation of a primitive element having an index that indicates the order in the content stream of the primitive element representation; and storing an object representation of the document comprising a set of object nodes arranged in a tree structure, each object node referencing a range of indices in the content stream.