What is MIME type "text/x-cddl"?

A MIME type is a string that tells browsers and other tools how to handle a particular kind of file.

text/x-cddl is a MIME type for files written in the Concise Data Definition Language. It marks plain text files that describe data structures in a clear, human-readable way.

Its main use is to define schemas and validation rules for custom data formats. Developers use it to help tools understand how data is structured, ensuring that configurations and protocols follow the expected format.

The files that use this MIME type commonly have the extension CDDL. This helps systems and developers quickly identify and process these schema definitions.

For more technical details, see resources like RFC 8610.

Associated file extensions

Usage Examples

HTTP Header

When serving content with this MIME type, set the Content-Type header:


    Content-Type: text/x-cddl    
  

HTML

In HTML, you can specify the MIME type in various elements:


    <a href="file.dat" type="text/x-cddl">Download file</a>    
  

Server-side (Node.js)

Setting the Content-Type header in Node.js:


    const http = require('http');    
    
    http.createServer((req, res) => {    
      res.setHeader('Content-Type', 'text/x-cddl');    
      res.end('Content here');    
    }).listen(3000);    
  

Associated file extensions

FAQs

What is the purpose of the text/x-cddl MIME type?

This MIME type identifies files written in Concise Data Definition Language (CDDL). These files, usually containing the .cddl extension, are used to define data structures and validate formats like CBOR and JSON.

Is text/x-cddl the standard MIME type for CDDL files?

Not exactly; the official IANA-registered type defined in RFC 8610 is text/cddl. The text/x-cddl variation is an experimental or legacy identifier used by some systems before the standard was finalized.

How do I open a file sent with the text/x-cddl content type?

Since CDDL is a human-readable format, you can view these files in any text editor such as Notepad, Visual Studio Code, or Sublime Text. The file contains plain text rules describing how data should be structured.

How do I configure Apache to serve .cddl files correctly?

To associate the extension with this MIME type, add the line AddType text/x-cddl .cddl to your .htaccess file or main Apache configuration. If you want to adhere strictly to standards, you might prefer using AddType text/cddl .cddl instead.

What is the difference between text/x-cddl and application/json?

While application/json contains actual data objects, text/x-cddl contains the schema or rules that describe what that data should look like. Developers use CDDL to ensure that a JSON or CBOR file follows the correct format.

Will web browsers execute text/x-cddl files?

No, browsers will typically display the file as plain text because of the text/ prefix. They do not natively parse or visualize the schema logic; that requires specialized development tools or validators.

General FAQ

What is a MIME type?

A MIME (Multipurpose Internet Mail Extensions) type is a standard that indicates the nature and format of a document, file, or assortment of bytes. MIME types are defined and standardized in IETF's RFC 6838.

MIME types are important because they help browsers and servers understand how to process a file. When a browser receives a file from a server, it uses the MIME type to determine how to display or handle the content, whether it's an image to display, a PDF to open in a viewer, or a video to play.

MIME types consist of a type and a subtype, separated by a slash (e.g., text/html, image/jpeg, application/pdf). Some MIME types also include optional parameters.

How do I find the MIME type for a file?

You can check the file extension or use a file identification tool such as file --mime-type on the command line. Many programming languages also provide libraries to detect MIME types.

Why are multiple MIME types listed for one extension?

Different applications and historical conventions may use alternative MIME identifiers for the same kind of file. Showing them all helps ensure compatibility across systems.