# Metadata for XML

## NDI Metadata and XML

While NDI metadata is formatted as XML[^1], there are some differences between XML used for NDI metadata frames and a more conventional stand-alone XML file. This page discusses how XML standards apply to NDI metadata frames.

## XML Prolog

**NDI metadata frames should not contain an XML prolog**. Each NDI Metadata frame can be assumed to have the following prolog, indicating XML version 1.0 compliance and UTF-8 encoding.

```xml
<?xml version="1.0" encoding="UTF-8"?>
```

## XML Syntax

NDI metadata frames should be "[Well Formed](#user-content-fn-2)[^2]" XML documents with correct syntax. Please check the following:

* [x] Metadata should contain exactly one root element.
* [x] XML elements must have a closing tag
* [x] XML tags are case sensitive
* [x] XML elements must be properly nested
* [x] XML attribute values must be quoted

## XML Root Element

As a "Well Formed" XML document, an NDI metadata frame can only have one root element. If there is a need to pass more than one XML element in an NDI metadata frame, the root element should be set to `<ndi_metadata_group>` and the required XML elements can be passed as children to this root element.&#x20;

{% hint style="info" %}
See the [documentation](https://docs.ndi.video/all/developing-with-ndi/metadata-elements#less-than-ndi_metadata_group-greater-than-element) for the `<ndi_metadata_group>` element for example usage.
{% endhint %}

## XML Comments

XML comments are allowed but **discouraged** in NDI metadata frames.

## XML Namespaces

XML namespaces are **not supported** in NDI metadata frames.

## XML Element Names

With the exception of element names defined in this document, no XML element passed in a metadata frame to the NDI SDK should begin with the string `ndi` or `ntk` (or any permutation of capitalization, eg: `Ndi`).

[^1]: Extensible Markup Language is a markup language and file format for storing, transmitting, and reconstructing data. It defines a set of rules for encoding documents in a format that is both human-readable and machine-readable.

[^2]: A well-formed document in XML is a document that "adheres to the syntax rules specified by the XML 1.0 specification in that it must satisfy both physical and logical structures.
