Copyright © 2024, Fred Youhanaie
Behaviours: gen_xml
.
Authors: Fred Youhanaie (fyrlang@anydata.co.uk
).
A simple gen_xml
callback module to count the tags.
The module will return count of the element tags found in the XML document.
The state variable for this handler should be a map
. When
calling read/2
, it is recommended to supply an empty map as the
initial value, i.e. #{}
, although a map with preset values will
not be rejected.
Tag
does not exist a new entry will be
created. If a non-numeric entry exists for the Tag
, the
increment operation will cause an exception!
handle_begin/3 | The callback function for begin tags. |
handle_end/2 | The callback function for end tags. |
handle_text/2 | The callback function for text elements. |
start/1 | Helper function to scan an entire XML document. |
handle_begin(Tag::atom(), Attr::list(), Counts::map()) -> map()
The callback function for begin tags.
Each call increments the count for the corresponding Tag
.
handle_end(Tag::atom(), Counts::map()) -> map()
The callback function for end tags.
No action is performed with end tags.handle_text(Text::string(), Counts::map()) -> map()
The callback function for text elements.
No action is performed with these elements.start(File::string()) -> gen_xml:read_ret()
Helper function to scan an entire XML document.
Generated by EDoc