Skip to content

ParseXML

反序列化XML字符串,将XML字符串转换为实体。

业务属性

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

使用示例

使用LuaScript控件定义一个XML字符串:

lua
local xml = "<string>this is a custom xml</string>"
local xml = "<string>this is a custom xml</string>"
img_8.png

ParseXML控件返回值命名为object,参数输入#{xml}

img_9.png

xml字符串将反序列化为object实体

添加输出控件输出ParseXML控件的返回值object

输出控件data输入:

json
{
  "object": "#{object}"
}
{
  "object": "#{object}"
}
img_10.png

使用curl请求接口:

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

接口返回:

json
{
    "object": {
        "string": "this is a custom xml"
    }
}
{
    "object": {
        "string": "this is a custom xml"
    }
}