livery_s3_xml (livery_s3 v0.1.0)

View Source

Minimal XML parsing for S3 responses.

S3 returns XML for bucket/object listings, versioning, multipart, batch delete, and error bodies. Rather than pull in the xmerl record headers, this parses into a light {Tag, Attrs, Children} tree via xmerl_sax_parser and offers a few navigation helpers (child/2, children/2, text/2). Tags are local names as binaries; namespaces are dropped (S3 uses a single default namespace).

Summary

Functions

First child element named Name, or undefined.

All child elements named Name.

Concatenated direct text content of an element.

Parse an XML binary into the root element tree.

Text content of the first child named Name, or undefined.

Types

node_()

-type node_() :: tree() | {text, binary()}.

tree()

-type tree() :: {binary(), [{binary(), binary()}], [node_()]}.

Functions

child(Tree, Name)

-spec child(tree(), binary()) -> tree() | undefined.

First child element named Name, or undefined.

children(Tree, Name)

-spec children(tree(), binary()) -> [tree()].

All child elements named Name.

node_text/1

-spec node_text(tree()) -> binary().

Concatenated direct text content of an element.

parse(Bin)

-spec parse(binary()) -> {ok, tree()} | {error, term()}.

Parse an XML binary into the root element tree.

text(Tree, Name)

-spec text(tree(), binary()) -> binary() | undefined.

Text content of the first child named Name, or undefined.