XMLデータの書き込みをColdFusionで大文字小文字の区別をつけるには?(大文字小文字の区別なし)
元記事はこちらです。
■Application.cfm
<cfapplication name="#hash(GetDirectoryFromPath(GetCurrentTemplatePath()))#">
■index.cfm
<!---///////////////////////////////////////////////////////////////// xmlデータのattributes部分の追加 ※大文字小文字を区別する方法 url.kbn="":大文字 url.kbn<>"":大文字小文字 //////////////////////////////////////////////////////////////////---> <cfparam name="url.kbn" default=""> <!--- 処理 ---> <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 & "out.xml"> <!--- xml読み込み ---> <cffile action="read" file = "#local.inF#" variable = "local.data" charset = "utf-8"> <cfset local.xml = XmlParse(local.data)> <cfset arrayPrepend(local.xml.App.XmlChildren, XmlElemNew(local.xml,"Command"))> <!--- 大文字 ---> <cfif url.kbn eq ""> <cfset local.xml.App.Command.XmlAttributes.Action = "APPEND"> <!--- 大文字小文字 ---> <cfelse> <cfset local.xml.App.Command.XmlAttributes["Action"] = "APPEND"> </cfif> <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>
■in.xml
aaa