Modifying value in external xml file
Hi,
I've been searching around for some time and haven't been able to find the solution to what I think should be a simple problem.
I have an xml file that I need to change the value of an item from False to True.
The structure of the file is:
<data>
<system-page>
<id>1</id>
<other fields></other fields>
<dynamic-metadata>
<name>publish</name>
<name>yes</name>
</dynamic-metadata>
<dynamic-metadata>
<name>frontpage</name>
<name>no</name>
</dynamic-metadata>
</system-page>
<!---tons more system pages--->
</data>
I am able to read the file and get to the exact line as such:
<cffile action="read" file="E:\test.xml" variable="newsFile" charset="utf-8"/>
<cfset newsXML=XmlParse(newsFile)/>
<cfset arrItemNodes = XmlSearch(newsFile,"/data/system-page[@id='1']/dynamic-metadata[name='frontpage']/value")/>
I'm not sure how to edit and save the value. I imaging it's something like this:
<cfset arrItemNodes[1].xmlText = 'True'>
But is there anyway to save this information in the xml file at the right location?
Any help is appreciated.
