# `XMAVLink.Parser`
[🔗](https://github.com/fancydrones/xmavlink/blob/main/lib/mavlink/parser.ex#L1)

Parse a mavlink xml file into an idiomatic Elixir representation:

%{
    version: 2,
    dialect: 0,
    enums: [
      %{
        name: :mav_autopilot,
        description: "Micro air vehicle...",
        entries: [
          %{
            value: 0,
            name: :mav_autopilot_generic,         (use atoms for identifiers)
            description: "Generic autopilot..."
            params: [                             (only used by commands)
              %{
                  index: 0,
                  description: ""
               },
               ... more entry params
            ]
           },
           ... more enum entries
        ]
       },
      ... more enums
    ],
    messages: [
      %{
        id: 0,
        name: "optical_flow",
        description: "Optical flow...",
        fields: [
          %{
              type: "uint16_t",
              ordinality: 1,
              name: "flow_x",
              units: "dpixels",                   (note: string not atom)
              description: "Flow in pixels..."
           },
           ... more message fields
        ]
       },
      ... more messages
    ]
 }

# `entry_description`

```elixir
@type entry_description() :: %{
  value: integer() | nil,
  name: atom(),
  description: String.t(),
  params: [param_description()]
}
```

# `enum_description`

```elixir
@type enum_description() :: %{
  name: atom(),
  bitmask: boolean(),
  description: String.t(),
  entries: [entry_description()]
}
```

# `field_description`

```elixir
@type field_description() :: %{
  type: String.t(),
  ordinality: integer(),
  omit_arg: boolean(),
  is_extension: boolean(),
  constant_val: String.t() | nil,
  name: String.t(),
  enum: String.t(),
  display: :bitmask | nil,
  print_format: String.t() | nil,
  units: atom() | nil,
  description: String.t()
}
```

# `mavlink_definition`

```elixir
@type mavlink_definition() :: %{
  version: String.t(),
  dialect: String.t(),
  enums: [enum_description()],
  messages: [message_description()]
}
```

# `message_description`

```elixir
@type message_description() :: %{
  id: integer(),
  name: String.t(),
  description: String.t(),
  has_ext_fields: boolean(),
  fields: [field_description()]
}
```

# `param_description`

```elixir
@type param_description() :: %{index: integer(), description: String.t()}
```

# `parse_option`

```elixir
@type parse_option() ::
  {:max_xml_file_bytes, parser_limit()}
  | {:max_include_depth, parser_limit()}
  | {:max_include_files, parser_limit()}
```

# `parse_options`

```elixir
@type parse_options() :: [parse_option()]
```

# `parser_limit`

```elixir
@type parser_limit() :: pos_integer() | :infinity
```

# `combine_definitions`

# `merge_enums`

# `parse_mavlink_xml`

```elixir
@spec parse_mavlink_xml(String.t()) :: mavlink_definition() | {:error, String.t()}
```

# `xmlAttribute`
*macro* 

# `xmlAttribute`
*macro* 

# `xmlElement`
*macro* 

# `xmlElement`
*macro* 

# `xmlText`
*macro* 

# `xmlText`
*macro* 

---

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