View Source xmerl_scan (xmerl v1.4)

This module is the interface to the XML parser, it handles XML 1.0. The XML parser is activated through xmerl_scan:string/[1,2] or xmerl_scan:file/[1,2]. It returns records of the type defined in xmerl.hrl. See also tutorial on customization functions.

Summary

Functions

accumulatewhitespace(T,S,,Acc)

For controlling the ContinuationState, to be used in a continuation function, and called when the parser encounters the end of the byte stream. See tutorial on customization functions.

For controlling the EventState, to be used in an event function, and called at the beginning and at the end of a parsed entity. See tutorial on customization functions.

For controlling the FetchState, to be used in a fetch function, and called when the parser fetch an external resource (eg. a DTD). See tutorial on customization functions.

Equivalent to file(Filename, []).

Parse file containing an XML document

For controlling the HookState, to be used in a hook function, and called when the parser has parsed a complete entity. See tutorial on customization functions.

For controlling the RulesState, to be used in a rules function, and called when the parser store scanner information in a rules database. See tutorial on customization functions.

Equivalent to string(Text, []).

Parse string containing an XML document

For controlling the UserState, to be used in a user function. See tutorial on customization functions.

Types

Link to this type

document()

View Source (not exported)
-type document() :: xmlElement() | xmlDocument().
Link to this type

global_state()

View Source (not exported)
-type global_state() ::
    #xmerl_scanner{encoding :: term(),
                   standalone :: term(),
                   environment :: term(),
                   declarations :: term(),
                   doctype_name :: term(),
                   doctype_DTD :: term(),
                   comments :: term(),
                   document :: term(),
                   default_attrs :: term(),
                   rules :: term(),
                   keep_rules :: term(),
                   namespace_conformant :: term(),
                   xmlbase :: term(),
                   xmlbase_cache :: term(),
                   fetch_path :: term(),
                   filename :: term(),
                   validation :: term(),
                   schemaLocation :: term(),
                   space :: term(),
                   event_fun :: term(),
                   hook_fun :: term(),
                   acc_fun :: term(),
                   fetch_fun :: term(),
                   close_fun :: term(),
                   continuation_fun :: term(),
                   rules_read_fun :: term(),
                   rules_write_fun :: term(),
                   rules_delete_fun :: term(),
                   user_state :: term(),
                   fun_states :: term(),
                   entity_references :: term(),
                   text_decl :: term(),
                   quiet :: term(),
                   col :: term(),
                   line :: term(),
                   common_data :: term(),
                   allow_entities :: term()}.
Link to this type

option_list()

View Source (not exported)
-type option_list() :: [{atom(), term()}].
Link to this type

xmlDocument()

View Source (not exported)
-type xmlDocument() :: #xmlDocument{content :: term()}.
-type xmlElement() ::
    #xmlElement{name :: term(),
                expanded_name :: term(),
                nsinfo :: term(),
                namespace :: term(),
                parents :: term(),
                pos :: term(),
                attributes :: term(),
                content :: term(),
                language :: term(),
                xmlbase :: term(),
                elementdef :: term()}.

Functions

accumulatewhitespace(T,S,,Acc)

Function to accumulate and normalize whitespace.

Link to this function

cont_state(Xmerl_scanner)

View Source

Equivalent to cont_state(ContinuationState, S).

For controlling the ContinuationState, to be used in a continuation function, and called when the parser encounters the end of the byte stream. See tutorial on customization functions.

Link to this function

event_state(Xmerl_scanner)

View Source

Equivalent to event_state(EventState, S).

For controlling the EventState, to be used in an event function, and called at the beginning and at the end of a parsed entity. See tutorial on customization functions.

Link to this function

fetch_state(Xmerl_scanner)

View Source

Equivalent to fetch_state(FetchState, S).

For controlling the FetchState, to be used in a fetch function, and called when the parser fetch an external resource (eg. a DTD). See tutorial on customization functions.

Equivalent to file(Filename, []).

-spec file(Filename :: string(), Options :: option_list()) ->
        {document(), Rest :: list()} | {error, Reason :: term()}.

Parse file containing an XML document

Link to this function

hook_state(Xmerl_scanner)

View Source

Equivalent to hook_state(HookState, S).

For controlling the HookState, to be used in a hook function, and called when the parser has parsed a complete entity. See tutorial on customization functions.

Link to this function

rules_state(Xmerl_scanner)

View Source

Equivalent to rules_state(RulesState, S).

For controlling the RulesState, to be used in a rules function, and called when the parser store scanner information in a rules database. See tutorial on customization functions.

Equivalent to string(Text, []).

Parse string containing an XML document

Link to this function

user_state(Xmerl_scanner)

View Source

Equivalent to user_state(UserState, S).

Link to this function

user_state(UserState, S)

View Source
-spec user_state(UserState :: term(), S :: global_state()) -> global_state().

For controlling the UserState, to be used in a user function. See tutorial on customization functions.