RustyXML.Builder protocol (RustyXML v0.2.3)

Copy Markdown View Source

Protocol for converting Elixir data structures to XML.

Drop-in replacement for Saxy.Builder.

Manual Implementation

defimpl RustyXML.Builder, for: MyStruct do
  import RustyXML.XML

  def build(%MyStruct{name: name, id: id}) do
    element("person", [{"id", to_string(id)}], [
      element("name", [], [name])
    ])
  end
end

Summary

Types

t()

All the types that implement this protocol.

Functions

Convert a term to an XML element structure suitable for RustyXML.encode!/1.

Types

t()

@type t() :: term()

All the types that implement this protocol.

Functions

build(term)

@spec build(term()) ::
  RustyXML.XML.element() | String.t() | [RustyXML.XML.element() | String.t()]

Convert a term to an XML element structure suitable for RustyXML.encode!/1.