Contact Us 1-800-596-4880

docTypeAsString

docTypeAsString(docType: DocType): String

Transforms a DocType value to a string representation.

Introduced in DataWeave version 2.5.0.

Parameters

Name Type Description

docType

DocType

The DocType value to transform to a string.

Example

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

Source

%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

"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

%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

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