XMLデータの書き込みをColdFusionで大文字小文字の区別をつけるには?(大文字小文字の区別あり)
元記事はこちらです。
■index1.cfm
<!---///////////////////////////////////////////////////////////////// xmlデータのattributes部分の追加 ※大文字小文字を厳密にする //////////////////////////////////////////////////////////////////---> <!--- 処理 ---> <cfset cst_exec()> <!---================================================================= cst_exec ==================================================================---> <cffunction name="cst_exec" returnType="void" output="no"> <cfset var local = structNew()> <!--- 絶対パス取得 ---> <cfset local.path = GetDirectoryFromPath(GetCurrentTemplatePath())> <cfset local.inF = local.path & "in.xml"> <cfset local.outF = local.path & "out1.xml"> <!--- xml読み込み ---> <cffile action="read" file = "#local.inF#" variable = "local.data" charset = "utf-8"> <cfset local.xml = XmlParse(local.data, true)> <cfset arrayPrepend(local.xml["App"].XmlChildren, XmlElemNew(local.xml,"Command"))> <cfset local.xml["App"]["Command"].XmlAttributes["Action"] = "APPEND"> <cfset arrayAppend(local.xml["App"]["Command"].XmlChildren, XmlElemNew(local.xml,"ID"))> <cfset local.xml["App"]["Command"].ID.XmlText = "bbb"> <cfset arrayAppend(local.xml["App"]["Command"].XmlChildren, XmlElemNew(local.xml,"Name"))> <cfset local.xml["App"]["Command"]["Name"].XmlText = "bbb name"> <!--- xml書き込み ---> <cffile action="write" file = "#local.outF#" output="#toString(local.xml)#" charset = "utf-8"> </cffunction>