# `SefazDanfe.Mdfe.Data`
[🔗](https://github.com/devaction-labs/sefaz_danfe/blob/v0.1.0/lib/sefaz_danfe/mdfe/data.ex#L1)

The data of a DAMDFE, read from the `mdfeProc` SEFAZ authorized (with the closeout appended, once it
is registered): what the PDF is drawn from.

Pure: it takes the XML (`SefazNfe.Builder.parse_mdfe/2`) and answers a map with string keys that
the JSON encoder takes as is. Every value is already presented the Brazilian way
(`SefazDanfe.Format`) and is `nil` when the XML does not have it: nothing is computed or
invented. The blocks follow the DAMDFE of the MOC (Anexo II): the identification of the document
and its `protocol`, the `emitter`, the `cargo`, the road modal (`road`: RNTRC, the tractor vehicle
and its drivers), the `loading_municipalities` and the `documents` by unloading municipality.

`opts` takes `:closed` (default `false`): the DAMDFE of a closed MDF-e says so.

# `t`

```elixir
@type t() :: %{required(String.t()) =&gt; term()}
```

# `from_xml`

```elixir
@spec from_xml(String.t(), keyword()) :: {:ok, t()} | {:error, term()}
```

The DAMDFE data of the `mdfeProc` (or the `MDFe`) in `xml`; `{:error, reason}` when it cannot be read.

---

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