In the case of progressive documents, the content is only structured at the time of use. This makes it possible to structure elements of any depth. The use of the documents is described by the following example.
A book is stored as shown in the following XML.
The XML object of the book contains exactly one name (the title of the book), one author and one publication date. Moreover, the object can contain any number of links to similar books.
A progressive document is now structured from this information.
The information of the book is to be displayed directly, whilst the information of similar books is to only be available when needed. For this purpose, the XML method “book” is created with the following content.
This method creates the root element “object” with the attributes “title”, “author” and “release”. Under the element “object”, there are elements of the type “similar” in the number of similar books. So that these elements are only structured when needed, the attributes “pro:mode” und “pro:href” are necessary. The namespace extension xmlns:pro="http://onionworks.net/2004/xml/progressive" is needed for this.
The attribute “pro:mode” can contain the values “replace” or “embed”. The value “replace” leads to the element being overwritten. The value “embed” however leads to the new data being attached. The link to the object to be opened (created with the method “c.xlink”) and its method is to be transferred to the attribute “pro:href”.
The data of the first similar book is now available and can be used.