# `RDF.XML.Decoder`
[🔗](https://github.com/rdf-elixir/rdf-xml-ex/blob/v1.2.1/lib/rdf/xml/decoder.ex#L1)

A decoder for RDF/XML serializations to `RDF.Graph`s.

As for all decoders of `RDF.Serialization.Format`s, you normally won't use these
functions directly, but via one of the `read_` functions on the `RDF.XML` format
module or the generic `RDF.Serialization` module.

## Options

- `:base`: allows to specify the base URI to be used in contexts where relative
  URIs are used and no base URI is defined with a `xml:base` definition
- `:bnode_prefix`: allows to specify the prefix which auto-generated blank nodes
  should get (default: `"b"`)

# `decode`

```elixir
@spec decode(
  String.t() | Enumerable.t(),
  keyword()
) :: {:ok, RDF.Graph.t()} | {:error, any()}
```

Decodes an RDF/XML string to a `RDF.Graph`.

The result is returned in an `:ok` tuple or an `:error` tuple in case of an error.

For a description of the available options see the [module documentation](`RDF.XML.Encoder`).

# `decode_from_stream`

```elixir
@spec decode_from_stream(
  Enumerable.t(),
  keyword()
) :: {:ok, RDF.Graph.t()} | {:error, any()}
```

Decodes an RDF/XML stream to a `RDF.Graph`.

For a description of the available options see the [module documentation](`RDF.XML.Encoder`).

---

*Consult [api-reference.md](api-reference.md) for complete listing*
