0
我想写,我有针对性,其id属性目标使用xmlSearch(的XPath)的XML元素,则该元素的ColdFusion中创建一个新的子元素8
这里的元素中的新元素是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节点(名为“子链路”),我一直在尝试了一整天,还没有想通了。