---
schema_version: "1"
id: 7799abb3902781585620d2be470590ae77bb0c5eb84c0a15f5adeb92ed719fbb
title: docTypeAsString
collection: mulesoft
version: current
locale: en-us
portal_url: https://docs.salesforce.com/mulesoft/current/en-us/dataweave/2.9/dw-dtd-functions-doctypeasstring.md
canonical_url: https://docs.mulesoft.com/dataweave/2.9/dw-dtd-functions-doctypeasstring
source_site: docs.mulesoft.com
content_type: documentation
content_hash: 399e0c444861d418bdec207e36ae60722abd9bf3e88b62889809325b5496d998
description: MuleSoft Documentation Site
release: "2.9"
latest: false
---
---
product: DataWeave
version: 2.9
---

# docTypeAsString

> For the full documentation index, see: https://docs.mulesoft.com/llms.txt

## docTypeAsString(docType: DocType): String

Transforms a `DocType` value to a string representation.

_Introduced in DataWeave version 2.5.0._

### Parameters

<table><colgroup><col> <col> <col></colgroup><thead><tr><th>Name</th><th>Type</th><th>Description</th></tr></thead><tbody><tr><td><p><code>docType</code></p></td><td><p>DocType</p></td><td><p>The <code>DocType</code> value to transform to a string.</p></td></tr></tbody></table>

### Example

This example transforms a `DocType` value that includes a `systemId` to a string representation.

#### Source

```DataWeave
%dw 2.0
import * from dw::xml::Dtd
output application/json
---
docTypeAsString({rootName: "cXML", systemId: "http://xml.cxml.org/schemas/cXML/1.2.014/cXML.dtd"})
```

#### Output

```Json
"cXML SYSTEM http://xml.cxml.org/schemas/cXML/1.2.014/cXML.dtd"
```

### Example

This example transforms a `DocType` value that includes a `publicId` and `systemId` to a string
representation.

#### Source

```DataWeave
%dw 2.0
import * from dw::xml::Dtd
output application/json
---
docTypeAsString({rootName: "html", publicId: "-//W3C//DTD XHTML 1.0 Transitional//EN", systemId: "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"})
```

#### Output

```Json
"html PUBLIC -//W3C//DTD XHTML 1.0 Transitional//EN http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"
```
