%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"})
DataWeave
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 |
The |
Example
This example transforms a DocType
value that includes a systemId
to a string representation.
Source
Output
"cXML SYSTEM http://xml.cxml.org/schemas/cXML/1.2.014/cXML.dtd"
Json
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"})
DataWeave
Output
"html PUBLIC -//W3C//DTD XHTML 1.0 Transitional//EN http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"
Json