Module genxml_paths

.

Copyright © 2024, Fred Youhanaie

Behaviours: gen_xml.

Authors: Fred Youhanaie (fyrlang@anydata.co.uk).

Description

A simple gen_xml callback module that produces the XML paths in the document. This similar to the xmlstarlet el command, see https://xmlstar.sourceforge.net/docs.php.

The module will print the nested XML tags as / separated paths, showing the structure of the document.

Function Index

handle_begin/3The callback function for begin tags.
handle_end/2The callback function for end tags.
handle_text/2The callback function for text elements.
print/1Helper function to scan an entire XML document.

Function Details

handle_begin/3

handle_begin(Tag::atom(), Attr::list(), Tags::list()) -> list()

The callback function for begin tags.

Each call prints the paths collected so far.

The attributes are ignored.

handle_end/2

handle_end(Tag::atom(), Tags::list()) -> list()

The callback function for end tags.

We remove the first (inner tag) from the list.

handle_text/2

handle_text(Text::string(), Tags::list()) -> list()

The callback function for text elements.

No action is performed with these elements.

print/1

print(File::file:filename()) -> gen_xml:read_ret()

Helper function to scan an entire XML document.


Generated by EDoc