XML parsing library in Erlang
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
c_src
include
src
test
.gitignore
.travis.yml
CHANGELOG.md
LICENSE
Makefile
README.md
rebar.config

README.md

exml

Build Status

exml is an Erlang library helpful with parsing XML streams and doing some basic XML structures manipulation.

Building

exml is a rebar-compatible OTP application, run make or ./rebar compile in order to build it.

As a requirement, development headers for expat library are required.

Using

exml can parse both XML streams as well as single XML documents at once.

To parse a whole XML Document:

{ok, Parser} = exml:parse(<<"<my_xml_doc/>">>).

To generate an XML document from Erlang terms:

Xml = {xmlel,<<"foo">>,
        [{<<"attr1">>,<<"bar">>}], % Attributes
        [{xmlcdata,"Some Value"}] %Elements
      }.
exml:to_list(Xml).

Which results in

<foo attr1='bar'>Some Value</foo>

exml:to_binary/1 works similarly.

For an example of using the streaming API, so test/exml_stream_tests.erl