Loading TOC...

MarkLogic Server 11.0 Product Documentation
fn:unparsed-text

fn:unparsed-text(
   $href as xs:string,
   [$encoding as xs:string]
) as xs: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:unparsed-text("http://marklogic.com/test.xml","UTF-8")

Stack Overflow iconStack Overflow: Get the most useful answers to questions from the MarkLogic community, or ask your own question.