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

# 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"
```
