Skip to content

Commit

Permalink
minor bump for new option to exclude namespaces
Browse files Browse the repository at this point in the history
  • Loading branch information
bennyhat committed Oct 8, 2020
1 parent 3bcc1a4 commit 8f34fa4
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 1 deletion.
6 changes: 6 additions & 0 deletions lib/xml_json/badgerfish.ex
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ defmodule XmlJson.BadgerFish do
iex> XmlJson.BadgerFish.serialize(%{"alice" => %{"$" => "bob"}})
{:ok, "<alice>bob</alice>"}
iex> XmlJson.BadgerFish.serialize(%{"alice" => %{"$" => "bob", "@xmlns" => %{"$" => "https://default.example.com"}}}, exclude_namespaces: true)
{:ok, "<alice>bob</alice>"}
"""
def serialize(object, opts \\ [])
def serialize(object, opts), do: Serializer.serialize(object, merge_default_options(opts))
Expand All @@ -37,6 +40,9 @@ defmodule XmlJson.BadgerFish do
iex> XmlJson.BadgerFish.deserialize("<alice>bob</alice>")
{:ok, %{"alice" => %{"$" => "bob"}}}
iex> XmlJson.BadgerFish.deserialize("<alice xmlns=\\"https://default.example.com\\">bob</alice>", exclude_namespaces: true)
{:ok, %{"alice" => %{"$" => "bob"}}}
"""
def deserialize(xml, opts \\ [])
def deserialize(xml, opts), do: Deserializer.deserialize(xml, merge_default_options(opts))
Expand Down
6 changes: 6 additions & 0 deletions lib/xml_json/parker.ex
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ defmodule XmlJson.Parker do
## Examples
iex> XmlJson.Parker.serialize(%{"alice" => "bob"})
{:ok, "<root><alice>bob</alice></root>"}
iex> XmlJson.Parker.serialize(%{"alice" => "bob"}, preserve_root: "alice")
{:ok, "<alice>bob</alice>"}
Expand All @@ -31,6 +34,9 @@ defmodule XmlJson.Parker do
## Examples
iex> XmlJson.Parker.deserialize("<alice>bob</alice>")
{:ok, "bob"}
iex> XmlJson.Parker.deserialize("<alice>bob</alice>", preserve_root: true)
{:ok, %{"alice" => "bob"}}
Expand Down
2 changes: 1 addition & 1 deletion mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ defmodule XmlJson.MixProject do
def project do
[
app: :xml_json,
version: "0.1.1",
version: "0.2.0",
elixir: "~> 1.10",
start_permanent: Mix.env() == :prod,
deps: deps(),
Expand Down

0 comments on commit 8f34fa4

Please sign in to comment.