可以在cfscript中创建<cfxml>吗?

myT*_*532 1 coldfusion xml-parsing cfml

有没有办法在cfscript中使用?我在网上找不到一个简单的例子。我有一个使用cfscript构建的.cfc文件,并且正在尝试使用cfxml。

我有一个XMLContent变量,并且尝试了下面的代码。

cfxml variable="myXML" {
    WriteOutPut(#XMLContent#);
}
Run Code Online (Sandbox Code Playgroud)

它正在返回:function keyword is missing in FUNCTION declaration.在我的cfxml声明中。

Jam*_*ler 5

你可以做到这一点。

cfxml (variable="myXML") {
    WriteOutPut(XMLContent);
}
Run Code Online (Sandbox Code Playgroud)

但是我怀疑你正在尝试

  <cfscript>
  myXML = XMLParse(XMLContent);
  </cfscript>
Run Code Online (Sandbox Code Playgroud)