Changes

Jump to navigation Jump to search
536 bytes added ,  20:59, 12 March 2013
no edit summary
This [[Module Library|XQuery Module]] contains functions for handling ''streamable'' items.
In contrast to standard XQuery items, a streamable items may take up much less space, because they item only contain contains a reference to the actual data. The data itself will only be retrieved if it is required requested by another an expression, or if an the item is to be serialized. Serialization of Hence, a streamable items takes constant spaceitem only uses a few bytes, and no additional memory is occupied during serialization.
The following BaseX functions return streamable items:
|-
| '''Summary'''
|Returns a materialized instance of the specified {{Code|$item}}.:<br />If * if an item is streamable, its content value will be retrieved, and a new item containing its data the value will be returned. Other* other, non-streamable items will simply be passed through.Materialization is helpful if a value is to be processed more than once. It is even mandatory if the value needs to be retrieved before other actions, such as the deletion of a resource, take place.|-| '''Example'''|In the following example, a file will be deleted before its content is returned. To avoid a "file not found" error, the content will first be materialized:<pre class="brush:xquery">let $file := 'data.txt'let $data := stream:materialize(file:read-text($file))return (file:delete($file), $data)</pre>
|}
Bureaucrats, editor, reviewer, Administrators
13,550

edits

Navigation menu