id 属性でターゲットにした要素内に新しい要素を書き込もうとしています
XML は次のとおりです。
<?xml version="1.0" encoding="UTF-8"?>
<webpages>
<course id="fteCharts">
<linkName>FTE Charts</linkName>
<link>index.cfm</link>
<linkInfo>Looking for a new job or rotational experience, the links to NRC Jobs, solicitations of interest and rotational opportunities are provided. Would you like to become a leader in the NRC. The NRC offers a number of leadership development programs. The Leadership Development link provides you a list of these programs.</linkInfo>
</course>
<course id="matrix">
<linkName>Skills Matrix</linkName>
<link>index.cfm</link>
<linkInfo>Skills Matrix Link. The NRC offers a number of leadership development programs. The Leadership Development link provides you a list of these programs.</linkInfo>
<subLink>
<name>Adminstrator Tool Kit 2</name>
<url>http://r2.nrc.gov/drs/careertools/admintoolkit.pdf</url>
</subLink>
<subLink>
<name>Technical Tool Kit Matrix 2</name>
<url>http://r2.nrc.gov/drs/careertools/technicaltoolkit.pdf</url>
</subLink>
</course>
</webpages>
CFC でこの要素のデータを取得する方法は次のとおりです。
<cfset params = toString( getHttpRequestData().content ) />
<cfset args = #deserializeJSON(params)# />
<cfset bPath = "e:\webapps\NRCNewsApps\rmsi" />
<cffile action="read" file="#bPath#\xml\nav.xml" variable="myxml">
<cfset thedoc = XmlParse(myxml)>
<cfset arynode = XmlSearch(thedoc, "/webpages/course[ @id = '#args.linkID#' ]") />
<cfset xmlCourse = arynode[1] />
それでxmlCourse
、ノードを追加したいコースを返します。これは、必要な xml データを含む配列です。
XmlElemNew(xmlCourse, "subLink");
対象のコース内に新しい空白の xml ノード (「サブリンク」という名前) を作成したいのですが、一日中試してみましたが、わかりませんでした。