Deletes an node from an XMLDatasource
<CF_XMLDelete DATASOURCE="XMLDatasourceObject"
XPATH="XPath">
Required. The XMLDatasource object that the operation will be run against.
Required. An XPath query that specifies the node to be deleted
To use this tag, simply specify an XMLDatasource, and an XPath that identifies
a specific node in the XMLDatasource.
<!--- Create a simple Cached Datasource --->
<CF_XMLDatasource name="People" CachedWithin="#createtimespan(0,0,5,0)#" cachename="People">
<people>
<person age="27" company="Torchbox" id="1">Tom Dyson</person>
<person age="27" company="WildFusion" id="2">David Maddison</person>
<person age="23" company="WildFusion" id="3">Peter Piper</person>
<person age="29" company="Torchbox" id="4">olly</person>
</people>
</CF_XMLDatasource>
<CFPARAM Name="Form.PersonID" Default="1">
<!--- If the form has been submited, update the datasource with the form details --->
<CFIF IsDefined("Form.DeletePerson")>
<!--- Insert the values from the form, into the document ---> <CF_XMLDelete datasource="People" XPath="//person[@id='#FORM.PersonID#']"> </CFIF>
<!--- Get a list of names from the datasource ---> <CF_XMLQuery Datasource="People" Name="qryPeopleNames"> //person </CF_XMLQuery>
<!--- Create a simple form ---> <FORM Method="POST">
Name :
<!--- Display all the available people in a drop down --->
<select name="personID">
<CFOUTPUT Query="qryPeopleNames">
<option value="#person_id#">#person#</option>
</CFOUTPUT>
</select><br>
<INPUT type="submit" name="DeletePerson" value="Delete Person"> </FORM>
<!--- Display the datasource as it is at the moment ---> <CF_XMLDump Datasource="People">
|
|
|
| Produced by Tom Dyson of Torchbox, and David Maddison of Wildfusion | |