Skip to content

ToXML

将实体变量序列化为XML字符串。

业务属性

属性含义说明输入限定示例值
enable是否启用该控件,未启用时不编译是否编译选择值启用
name控件返回值命名控件输出值变量名常量xml
text与控件关联的文本设计页控件显示常量toXml
param实体变量流程变量#{object}
rootName根节点常量root

使用示例

使用LuaScript控件定义一个实体:

lua
local object = { text = "this is a text" }
local object = { text = "this is a text" }
img11.png

ToXML控件返回值命名为xml,参数输入#{object},根节点输入root

img_3.png

添加输出控件输出返回值xml

img_4.png

使用curl请求接口:

$ curl http://localhost:6636/api/toXML
$ curl http://localhost:6636/api/toXML

接口返回:

json
{
    "xml": "<root>\n  <text>this is a text</text>\n</root>"
}
{
    "xml": "<root>\n  <text>this is a text</text>\n</root>"
}