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)
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.
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.
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, []).
Parse file containing an XML document
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.
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
Equivalent to user_state(UserState, S).
For controlling the UserState, to be used in a user function. See tutorial on customization functions.
Types
-type document() :: xmlElement() | xmlDocument().
-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()}.
-type xmlDocument() :: #xmlDocument{content :: term()}.
Functions
accumulatewhitespace(T,S,,Acc)
Function to accumulate and normalize whitespace.
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.
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.
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
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.
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
Equivalent to user_state(UserState, S).
-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.