Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I produce an XML document with a DOCTYPE defined using Mule and DataWeave?

I'd like to create a DataWeave transformation that produces an XML document that includes a DOCTYPE like so:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html 
 PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
  <head><!-- etc. --></head>
  <body><!-- etc. --></body>
</html>

I haven't been able to find it in the DataWeave documentation so far. How can I accomplish this in DWL?

I'm using Mule 3.7.2 EE and Anypoint Studio 5.3.0.

like image 332
Ryan Hoegg Avatar asked Dec 29 '25 02:12

Ryan Hoegg


1 Answers

I've been experimenting some, without any luck. I cant seem to set any custom output that aren't real elements.

When struck with this, I would output a simple placeholder at first (like plc or something, and then use a groovy script after data weave to replace that placeholder with the <!DOCTYPE tag.

Hope it helps.

like image 193
Emil Avatar answered Dec 31 '25 00:12

Emil