Patent ID: 7844632

Claim:
A method comprising: receiving a first instruction to generate a copy of a subtree of an XML tree that is stored in memory, wherein the subtree comprises a plurality of nodes; in response to receiving the first instruction: creating a new node that represents a copy of the subtree; and causing the new node to reference a root node of the subtree; wherein at least a subset of the plurality of nodes are not copied as a result of the first instruction; after creating the new node, receiving a second instruction to access one or more first nodes of the copy; in response to receiving the second instruction, using the new node to access one or more first nodes of the subtree that correspond to the one or more first nodes of the copy; after receiving the second instruction, receiving, from an application, a third instruction to modify one or more second nodes of the copy, wherein the one or more second nodes of the copy have not yet been generated; and in response to receiving the third instruction: generating a copy of at least each node of the subtree that corresponds to the one or more second nodes of the copy, and modifying the one or more second nodes of the copy without modifying any node in the subtree that corresponds to a node of the one or more second nodes of the copy.