cfwddx

Description

Serializes and de-serializes CFML data structures to the XML-based WDDX format. Generates JavaScript statements to instantiate JavaScript objects equivalent to the contents of a WDDX packet or some CFML data structures.

Category

Extensibility tags

Syntax


<cfwddx action = "action" 

  input = "inputdata" 

  output = "resultvariablename" 

  topLevelVariable = "toplevelvariablenameforjavascript"

  useTimeZoneInfo = "Yes" or "No"

  validate = "Yes" or "No" > 

See also

cfcollection, cfexecute, cfgraph, cfindex, cfobject, cfreport, cfsearch, cfservlet, cfservletparam, cfdump

Attributes

Attribute
Description
action
Specifies the action taken by the cfwddx tag. Use one of the following:
  • CFML2WDDX    Serialize CFML to WDDX format
  • WDDX2CFML    Deserialize WDDX to CFML
  • CFML2JS    Serialize CFML to JavaScript format
  • WDDX2JS    Deserialize WDDX to JavaScript
input
Required. The value to be processed.
output
The name of the variable to hold the output of the operation. This attribute is required for action = "WDDX2CFML". For all other actions, if this attribute is not provided, the result of the WDDX processing is outputted in the HTML stream.
topLevelVariable
Required if action = "WDDX2JS" or action = "CFML2JS". The name of the top-level JavaScript object created by the deserialization process. The object created is an instance of the WddxRecordset object, explained in WddxRecordset Object.
This attribute applies only when the action is WDDX2JS or CFML2JS.
useTimeZoneInfo
Optional. Indicates whether to output time-zone information when serializing CFML to WDDX. If time-zone information is taken into account, the hour-minute offset, as represented in the ISO8601 format, is calculated in the date-time output. If time-zone information is not taken into account, the local time is output. The default is Yes.
validate

For the WDDX2CFML or WDDX2JS actions, validate = "Yes" specifies that to process the WDDX input by a validating XML parser using the WDDX DTD (Document Type Definition). If the parser processes the WDDX input without error, the packet is deserialized. If the input packet is not a well formed WDDX packet, an error is thrown. The default is not to validate the input (validate="NO").

Usage

Use this tag to serialize and deserialize packets of data used to communicate with the browser.

For complete information on WDDX, see Developing ColdFusion Applications.

Example

<!--- This snippet shows basic use of the cfwddx tag. --->

<html>

<head>

  <title>cfwddx Tag</title>

</head>

<body>

<!--- Create a simple query --->

<cfquery name = 'q' dataSource = 'cfsnippets'>

  select Message_Id, Thread_id, Username from messages

</cfquery>



The recordset data is:...<P>

<cfoutput query = q>

  #Message_ID# #Thread_ID# #Username#<br>

</cfoutput><P>



<!--- Serialize data to WDDX format --->

Serializing CFML data...<P>

<cfwddx action = 'cfml2wddx' input = #q# output = 'wddxText'>



<!--- Display WDDX XML packet --->

Resulting WDDX packet is:

<xmp><cfoutput>#wddxText#</cfoutput></xmp>



<!--- Deserialize to a variable named wddxResult --->

Deserializing WDDX packet...<P>

<cfwddx action = 'wddx2cfml' input = #wddxText# output = 'qnew'>



The recordset data is:...<P>

<cfoutput query = qnew>

  #Message_ID# #Thread_ID# #Username#<br>

</cfoutput><P>

</body>

</html>



Banner.Novgorod.Ru