Navigation
Guide That Contains This Content
[+] Expand All
[-] Collapse All

    document() Function (slax Namespace)

    Namespaces

    http://xml.libslax.org/slax

    SLAX Syntax

    string slax:document(url, <options>)

    Release Information

    Function introduced in version 1.1 of the SLAX language, which is supported in Junos OS Release 12.2 and later releases.

    Description

    Read data from a file or URL. The data can be encoded in any character set and can be BASE64 encoded. The default character set is "utf‑8". Optional arguments specify the character encoding scheme and the encoding format, and define the replacement string for non-XML control characters. Table 1 lists the available options.

    Parameters

    options
    —

    (Optional) Specify the character encoding scheme and format of the data, and define the replacement string for non-XML control characters.

    url
    —

    File or URL from which to read data.

    Table 1: Options for slax:document Function

    Option

    Description

    <encoding> string

    Character encoding scheme. For example "ascii" or "utf-8".

    <format> string

    "base64" for BASE64-encoded data.

    <non-xml> string

    String used to replace non-XML control characters. If the value is an empty string, non-XML characters are removed.

    Return Value

    string
    —

    String representing the data.

    Usage Examples

    var $data = slax:document($url);
    
    var $options := {
        <encoding> "ascii";
        <format> "base64";
        <non-xml> "#";
    }
    var $data2 = slax:document($url, $options);

    Published: 2013-03-05