4. The method of claim 3, wherein the data structure further includes pointers, each pointer linking one of the items to the corresponding index associated therewith; and wherein the step of editing the hierarchical document further comprises the step of traversing the data structure using the pointers to access the contents of the items.
3. A method for editing a document in a computer system, the steps of the method comprising: storing in a memory a data structure representing the document as a hierarchical document, the hierarchical document comprising starttags and endtags and leaf contents between ones of the starttags and endtags, the data structure including starttag, endtag and leaf items representing a corresponding one of the starttags, endtags, and leaf contents; each of the starttag and endtag items representing the starttags and endtags having a corresponding index associated therewith, the data structure further including an index offset for each of the starttag and endtag items, each index offset indicating an offset to a corresponding complementary starttag or endtag item in the hierarchical document; displaying the hierarchical document and issuing commands for editing the hierarchical document; and editing the hierarchical document in response to the issued commands, including traversing the data structure, both forward and backward, using the index offsets to skip over ones of the items in the data structure without having to inspect the contents of the skipped items.