simple_xml_parser v0.0.1 SimpleXmlParser.Utils.PureXmlParser
The module can parse pure xml strings
Link to this section Summary
Types
A node object from parser, contains: node name, content, attributes.
Functions
Generate a structure that preserve xml hierarchy and help to parse it to another types
Link to this section Types
A node object from parser, contains: node name, content, attributes.
Link to this section Functions
Generate a structure that preserve xml hierarchy and help to parse it to another types
Examples
Parse a primitive object:
iex> SimpleXmlParser.Utils.PureXmlParser.parse("<return>Hello!</return>")
{:return, "Hello!", []}
Parse an object with attributes:
iex> SimpleXmlParser.Utils.PureXmlParser.parse("<return id='1'></return>")
{:return, [], [id: "1"]}
Parse a complex object:
iex> "<return><childs><child>1</child></childs></return>"
...> |> SimpleXmlParser.Utils.PureXmlParser.parse()
{:return, [{:childs, [{:child, "1", []}], []}], []}
iex> "<return><childs><child>1</child><child>2</child></childs></return>"
...> |> SimpleXmlParser.Utils.PureXmlParser.parse()
{:return, [{:childs, [{:child, "1", []}, {:child, "2", []}], []}], []}