This module contains helper functions for working with XML data format.
To use this module, you must import it to your DataWeave code, for example,
by adding the line import * from dw::util::Xml
to the header of your
DataWeave script.
Functions
docTypeAsString
docTypeAsString(docType: DocType): String
Transforms a DocType
declaration to a string representation.
Parameters
Name | Type | Description |
---|---|---|
docType |
DocType |
The DocType to transform to a string. |
Example
This example transforms a DocType
with a systemId
to a string representation.
Source
1
2
3
4
5
%dw 2.0
import * from dw::util::Xml
output application/json
---
docTypeAsString({rootName: "cXML", systemId: "http://xml.cxml.org/schemas/cXML/1.2.014/cXML.dtd"})
Output
1
"cXML SYSTEM http://xml.cxml.org/schemas/cXML/1.2.014/cXML.dtd"
Example
This example transforms a DocType
with publicId
and systemId
to a string representation.
Source
1
2
3
4
5
%dw 2.0
import * from dw::util::Xml
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
1
"html PUBLIC -//W3C//DTD XHTML 1.0 Transitional//EN http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"
Types
DocType
Represents a DOCType declaration that is part of an XML file.
Definition
1
{ rootName: String, publicId?: String, systemId?: String, internalSubset?: String }