Module xmltree

   % Example xml:
  
    <?xml version="1.0" encoding="UTF-8" ?>
    <root id="1">
      <ele id="2"/>
      <ele id="3">vvv\nxxx\n</ele>
    </root>
  
  
   # Usage example
   1> xmltree:file(L).
   {root,[{id,<<"1">>}],
        [{ele,[{id,<<"2">>}],[]},
         {ele,[{id,<<"3">>}],<<"vvv\nxxx\n">>}]}
  
   2> Rules = {root, [{id,integer}], [{ele, [{id,integer}], string}]},
   2> xmltree:string(L, Rules).
   {root,[{id,1}],
      [{ele,[{id,2}],[]},{ele,[{id,3}],"vvv\nxxx\n"}]}

Authors: Serge Aleynikov (saleyn@gmail.com).

Description

Parse XML into a hierarchical Erlang term
   % Example xml:
  
    <?xml version="1.0" encoding="UTF-8" ?>
    <root id="1">
      <ele id="2"/>
      <ele id="3">vvv\nxxx\n</ele>
    </root>
  
  
   # Usage example
   1> xmltree:file(L).
   {root,[{id,<<"1">>}],
        [{ele,[{id,<<"2">>}],[]},
         {ele,[{id,<<"3">>}],<<"vvv\nxxx\n">>}]}
  
   2> Rules = {root, [{id,integer}], [{ele, [{id,integer}], string}]},
   2> xmltree:string(L, Rules).
   {root,[{id,1}],
      [{ele,[{id,2}],[]},{ele,[{id,3}],"vvv\nxxx\n"}]}

Function Index

file/1
file/2
string/1
string/2
xml/1
xml/2

Function Details

file/1

file(Filename) -> any()

file/2

file(Filename, RulesFile) -> any()

string/1

string(XmlS) -> any()

string/2

string(XmlS, Rules) -> any()

xml/1

xml(XmlElement) -> any()

xml/2

xml(XmlElement, ChildRules) -> any()