Inserts a new node into the XMLDatasource
<CF_XMLInsert NODENAME="result_datasource_name"
DATASOURCE="XMLDatasourceObject"
PARENTXPATH="XPath"
VALUES="values_structure"
FIELDS="list_of_fields"
NAMESPACE="node_namespace">
Required. The name of the new node to add.
Required. The XMLDatasource object that the new node will be inserted into
Optional. An XPath query that specifies the node the new node will be a child of. If not specified, the new node is attached to the root of the XML document.
Optional. A structure containing a key=value list of attributes to set on the new node. If a key in the structure has the same name as the node name, the value of the node is set to this value. If this value isn't specified, the tag will take it's values from the FORM variable.
Optional. A list of field names from the values structure. This allows only certain keys from the value structure to be used as attributes. If not specified, all the keys of the values structure are used.
Optional. The namespace of the new node. If not specified, the namespace is set to blank.
This tag can be used in several way, depending upon the values attribute. If it's :
<!--- Create a simple form --->
<FORM Method="POST">
Name: <INPUT Type="Text" Name="person"><br>
Company: <INPUT Type="Text" Name="company"><br>
Age: <INPUT Type="Text" Name="age"><br>
<input type="submit" name="NewPerson" value="Add Person">
</FORM>
<!--- Create a simple Datasource ---> <CF_XMLDatasource name="People" CachedWithin="#createtimespan(0,0,5,0)#" cachename="People"> <people> <person age="27" company="Torchbox">Tom Dyson</person> <person age="27" company="WildFusion">David Maddison</person> <person age="23" company="WildFusion">Peter Piper</person> <person age="29" company="Torchbox">olly</person> </people> </CF_XMLDatasource>
<CFIF IsDefined("Form.NewPerson")>
<!--- Set the fields to be used from the form --->
<CFSET lFields="person,age,company">
<!--- Insert the values from the form, into the document ---> <CF_XMLInsert datasource="People" nodeName="person" fields="#lFields#"> <!--- Dump out ---> <CF_XMLDump Datasource="People"> </CFIF>
|
|
|
| Produced by Tom Dyson of Torchbox, and David Maddison of Wildfusion | |