Namecheap.Parser (Namecheap v0.2.1) View Source
Converts Namecheap API responses into structs of our native format. This is the default parser.
Link to this section Summary
Functions
Takes raw XML data from a Namecheap response and converts it into
a Namecheap.Response
struct.
Attempts to parse a single node into a native struct.
Returns a native struct, or {:unimplemented, node}
on failure.
All element names and attributes must be lowercase.
Link to this section Functions
Specs
parse_document(body :: String.t()) :: {:ok, Namecheap.Response.t()}
Takes raw XML data from a Namecheap response and converts it into
a Namecheap.Response
struct.
Specs
parse_entity(node :: Floki.html_node()) :: struct() | {:unimplemented, Floki.html_node()}
Attempts to parse a single node into a native struct.
Returns a native struct, or {:unimplemented, node}
on failure.
All element names and attributes must be lowercase.
Example
iex(1)> Namecheap.Parser.parse_entity({"domaincheckresult", [{"domain", "tribes.host"}], []})
%Namecheap.DomainCheckResult{domain: "tribes.host", ...}