Copyright © 2024, Fred Youhanaie
Authors: Fred Youhanaie (fyrlang@anydata.co.uk
).
A set of functions to process XML
files. See the overview doc
for further details.
To start the process of parsing the XML file, the callback module
should call the read/3
function. While read/3
is scanning the
XML file it will call the appropriate handler functions.
The callback module should provide three callback functions:
handle_begin/3
will be called whenever a start tag is
encountered,handle_end/2
will be called whenever an end tag is
encountered.handle_text/2
will be called whenever character data is
seen.read_ret() = {fatal_error, term(), term(), term(), term()} | {ok, State::term()} | {error, Reason::term()}
attr_map/1 | Return a map corresponding to the list of attributes from xmerl. |
read/3 | Read in a valid XML file and process its elements using the supplied callback module. |
attr_map(Attr::list()) -> map()
Return a map corresponding to the list of attributes from xmerl.
We extract the attribute names and values, and ignore the rest.
The attribute names are returned as atoms and the values as strings.read(Filename::string(), CB_module::atom(), CB_state::term()) -> read_ret()
Read in a valid XML file and process its elements using the supplied callback module.
We expect the file to be a valid XML document, no validation is performed here. However, the supplied callback module can perform its own validation during the scan.
We return success/failure result. In case of success, the handler's final state is returned. The failure reason may originate from thexmerl_sax_parser
module.
Generated by EDoc