简体   繁体   English

如何使用Mule和DataWeave定义DOCTYPE生成XML文档?

[英]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: 我想创建一个DataWeave转换,生成一个包含DOCTYPE的XML文档,如下所示:

<?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. 到目前为止,我还没有在DataWeave文档中找到它。 How can I accomplish this in DWL? 如何在DWL中完成此操作?

I'm using Mule 3.7.2 EE and Anypoint Studio 5.3.0. 我正在使用Mule 3.7.2 EE和Anypoint Studio 5.3.0。

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. 当遇到这种情况时,我会首先输出一个简单的占位符(比如plc或其他东西,然后在数据编织后使用groovy脚本用<!DOCTYPE标记替换该占位符)。

Hope it helps. 希望能帮助到你。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM