MarkLogic Server 11.0 Product Documentation
fn.unparsedText

fn.unparsedText(
   href as String,
   [encoding as String]
) as String?

Summary

Reads a file stored in the database as either text or binary file and returns its contents as a string.

Parameters
href The $href is a string containing a URI reference. It must identify a resource that can be read as text. If the URI is a relative URI then it is resolved relative to the base URI from the static context.
encoding If $encoding parameter is present and the URI points to a "text" file, the encoding is ignored since all the files are in UTF-8 in the database. However, if the URI points to a binary file, then an attempt is made to convert it from the specified encoding and the string value of the results of the conversion is returned. If the conversion fails, an exception is returned. The $encoding parameter must be passed when the URI resolves to a binary resource. An automatic encoding detector will be used if the value auto is specified. If $encoding is not present, the encoding defaults to UTF-8.

Example

fn.unparsedText("http://marklogic.com/test.xml","UTF-8");
Powered by MarkLogic Server | Terms of Use | Privacy Policy