xmerl_scan(3erl)
πΈ xmerl_scan β Erlang Module Definition (3erl) πΈ
okay so bestie, this is the manual page for xmerl_scan(3erl), and it's literally the interface to the XML parser β XML 1.0 handling and all. Grab a strawberry π and let's go.
β¨ NAME β¨
xmerl_scan β This module is the interface to the XML parser, it handles XML 1.0.
π DESCRIPTION π
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.
π¦ DATA TYPES π¦
document() = xmlElement() | xmlDocument()β The document returned byxmerl_scan:string/[1,2]andxmerl_scan:file/[1,2]. The type of the returned record depends on the value of thedocumentoption passed to the function.global_state()β The global state of the scanner, represented by the#xmerl_scanner{}record.option_list()β Options allow to customize the behaviour of the scanner. See also tutorial on customization functions.
Possible options are:
{acc_fun, Fun}β Call back function to accumulate contents of entity.{continuation_fun, Fun} | {continuation_fun, Fun, ContinuationState}β Call back function to decide what to do if the scanner runs into EOF before the document is complete.{event_fun, Fun} | {event_fun, Fun, EventState}β Call back function to handle scanner events.{fetch_fun, Fun} | {fetch_fun, Fun, FetchState}β Call back function to fetch an external resource.{hook_fun, Fun} | {hook_fun, Fun, HookState}β Call back function to process the document entities once identified.{close_fun, Fun}β Called when document has been completely parsed.{rules, ReadFun, WriteFun, RulesState} | {rules, Rules}β Handles storing of scanner information when parsing.{user_state, UserState}β Global state variable accessible from all customization functions{fetch_path, PathList}βPathListis a list of directories to search when fetching files. If the file in question is not in thefetch_path, the URI will be used as a file name.{space, Flag}β'preserve'(default) to preserve spaces,'normalize'to accumulate consecutive whitespace and replace it with one space.{line, Line}β To specify starting line for scanning in document which contains fragments of XML.{namespace_conformant, Flag}β Controls whether to behave as a namespace conformant XML parser,'false'(default) to not otherwise'true'.{validation, Flag}β Controls whether to process as a validating XML parser:'off'(default) no validation, or validation'dtd'by DTD or'schema'by XML Schema.'false'and'true'options are obsolete (i.e. they may be removed in a future release), if used'false'equals'off'and'true'equals'dtd'.{schemaLocation, [{Namespace,Link}|...]}β Tells explicitly which XML Schema documents to use to validate the XML document. Used together with the{validation,schema}option.{quiet, Flag}β Set to'true'if xmerl should behave quietly and not output any information to standard output (default'false').{doctype_DTD, DTD}β Allows to specify DTD name when it isn't available in the XML document. This option has effect only together with{validation,'dtd' option.{xmlbase, Dir}β XML Base directory. If usingstring/1default is current directory. If usingfile/1default is directory of given file.{encoding, Enc}β Set default character set used (default UTF-8). This character set is used only if not explicitly given by the XML declaration.{document, Flag}β Set to'true'if xmerl should return a complete XML document as anxmlDocumentrecord (default'false').{comments, Flag}β Set to'false'if xmerl should skip comments otherwise they will be returned asxmlCommentrecords (default'true').{default_attrs, Flag}β Set to'true'if xmerl should add to elements missing attributes with a defined default value (default'false').{allow_entities, Flag}β Set to'false'ifxmerl_scanshould fail when there is an ENTITY declaration in the XML document (default'true').xmlDocument() = #xmlDocument{}β The record definition is found inxmerl.hrl.xmlElement() = #xmlElement{}β no extra description in the source, bestie; it's just the record type.
π EXPORTS π
accumulate_whitespace(T::string(), S::global_state(), X3::atom(), Acc::string()) -> {Acc, T1, S1}
Function to accumulate and normalize whitespace.
cont_state(S::global_state()) -> global_state()
Equivalent to cont_state(ContinuationState, S).
cont_state(X::ContinuationState, S::global_state()) -> global_state()
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.
event_state(S::global_state()) -> global_state()
Equivalent to event_state(EventState, S).
event_state(X::EventState, S::global_state()) -> global_state()
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.
fetch_state(S::global_state()) -> global_state()
Equivalent to fetch_state(FetchState, S).
fetch_state(X::FetchState, S::global_state()) -> global_state()
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.
file(Filename::string()) -> {xmlElement(), Rest}
Types: Rest = list()
Equivalent to file(Filename, []).
file(Filename::string(), Options::option_list()) -> {document(), Rest}
Types: Rest = list()
Parse file containing an XML document
hook_state(S::global_state()) -> global_state()
Equivalent to hook_state(HookState, S).
hook_state(X::HookState, S::global_state()) -> global_state()
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.
rules_state(S::global_state()) -> global_state()
Equivalent to rules_state(RulesState, S).
rules_state(X::RulesState, S::global_state()) -> global_state()
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.
string(Text::list()) -> {xmlElement(), Rest}
Types: Rest = list()
Equivalent to string(Text, []).
string(Text::list(), Options::option_list()) -> {document(), Rest}
Types: Rest = list()
Parse string containing an XML document
user_state(S::global_state()) -> global_state()
Equivalent to user_state(UserState, S).
user_state(X::UserState, S::global_state()) -> global_state()
For controlling the UserState, to be used in a user function. See tutorial on customization functions.
π AUTHORS π
<>
The page literally lists the author as <> β iconic mystery energy, no cap π»
xoxo, bestie π β cute sign-off from the footer: source/version is xmerl 1.3.31.1 and the manual is xmerl_scan(3erl); date? the original footer doesn't list one, so that's the tea ββ¨
π¦ where this page comes from
- ubuntu noble: erlang-manpages 1:25.3.2.8+dfsg-1ubuntu4 Β· Apache-2.0
- ubuntu noble: erlang-manpages 1:25.3.2.8+dfsg-1ubuntu4.8 Β· Apache-2.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms