> For the complete documentation index, see [llms.txt](https://alex-robenko.gitbook.io/commsdsl-specification/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://alex-robenko.gitbook.io/commsdsl-specification/namespaces.md).

# Namespaces

In addition to splitting into [multiple files](/commsdsl-specification/multiple_files.md), **CommsDSL** provides namespaces to help in definition of big protocols. It is possible to define [fields](/commsdsl-specification/fields.md), [messages](https://github.com/arobenko/commsdsl-specification/tree/80d590547595a3afebebee6c2363c035e99f5c06/fields/messages.md), [interfaces](/commsdsl-specification/interfaces.md), and [frames](/commsdsl-specification/frames.md) in a separate namespace. The code generator must use this information to define relevant classes in a separate namespace(s) (if such feature is provided by the language) or introduce relevant prefixes into the names to avoid name clashes.

The namespace is defined using **\<ns>** node with single **name** property. It can contain all the mentioned [previously](/commsdsl-specification/schema_def.md) nodes.

```
<?xml version="1.0" encoding="UTF-8"?>
<schema ...>
    <ns name="myns">
        <fields>
            ...
        </fields>

        <message ...>
        </message>

        <messages>
            <message ... />
            <message ... />
        </messages>

        <interface ...>
        </interface>

        <interfaces>
            <interface ... />
            <interface ... />
        </interfaces>

        <frame ...>
        </frame>

        <frames>
            <frame ... />
            <frame ... />
        </frames>
    </ns>
</schema>
```

The namespace (**\<ns>**) can also contain other namespaces:

```
<?xml version="1.0" encoding="UTF-8"?>
<schema ...>
    <ns name="myns">
        <ns name="subns1">
            <fields>
                ...
            </fields>
        </ns>

        <ns name="subns2">
            <message ... />
            <message ... />
        </ns>
    </ns>
</schema>
```
