Exmerl
Elixir wrapper for xmerl_*
Install / Use
/learn @pwoolcoc/ExmerlREADME
Exmerl
A wrapper for the xmerl_* suite of modules, though at the moment all you can do is parse and use xpaths to select nodes.
Usage
Currently it is possible to parse XML from a file or string using either from_file/1,2,
from_string/1,2 or parse/1,2. They all accept an optional Keyword
list as the second argument. Possible options can be found in the erlang
documentation for the xmerl_* modules.
iex(1)> # you can pass parse/1,2 a filename or an xml string
iex(2)> Exmerl.parse("test.xml")
{{:xmlElement, :root, :root, [], {:xmlNamespace,...
...
...
iex(3)> {doc, rest} = Exmerl.from_string("""<?xml version="1.0" encoding="utf-8" ?><rootnode>Test</rootnode>""")
{{:xmlElement, :root, :root, [], {:xmlNamespace,...
...
...
You can traverse the document by using xpath selectors, and the
Exmerl.XPath.find function. find/2,3,4,5 takes an XML document (or a
{doc, rest} pair as shown above), an xpath selector, and optional
node, parent, and a Keyword list of options. find will accept a
{doc,rest} pair to make it easier to pipe the output of parse into
find:
iex(1)> Exmerl.parse("test.xml") |>
...(1)> Exmerl.XPath.find("//some-node-name")
{[{:xmlElement, ...
...
...
In this case, instead of returning [result_term], it will return
{[result_term], [rest]}.
Related Skills
node-connect
343.1kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
90.0kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
343.1kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
qqbot-media
343.1kQQBot 富媒体收发能力。使用 <qqmedia> 标签,系统根据文件扩展名自动识别类型(图片/语音/视频/文件)。
