Patent ID: 8001127

Claim:
A method comprising the computer-implemented steps of: storing, in an index, text strings for simple elements and offset information for complex elements, wherein storing comprises: storing, in the index, a single text string of each of one or more simple elements contained within an XML document that is managed by a database management system and that is indexed by the index, and storing, in the index, offset information of each of one or more complex elements contained within the XML document, wherein the offset information indicates where each of the one or more complex elements is located within the XML document; receiving a request for an XML fragment, wherein the request includes an XML path expression; in response to receiving the request: using the index to identify a node that the XML path expression identifies; wherein the node resides in the XML document; wherein the XML document is stored within one or more base structures managed by the database management system; determining whether the node is for a simple element, wherein a simple element is an element (a) with no attributes or children elements and (b) whose value is a single text string; and in response to determining that the node is for a simple element, performing the steps of: constructing the XML fragment for the node based on information contained in the index without accessing the one or more base structures, wherein constructing the XML fragment includes creating a start tag, creating an end tag, and reading the single text string of the simple element from the index, wherein the XML fragment comprises the start tag, the single text string of the simple element, and the end tag; and providing the XML fragment in response to the request; wherein the steps are performed by one or more computing devices.