User Guide Cancel

IsWDDX

 

Description

Determines whether a value is a well-formed WDDX packet.

Returns

True, if the value is a well-formed WDDX packet; False, otherwise.

Category

Decision functionsXML functions

Syntax

IsWDDX(value)
IsWDDX(value)
IsWDDX(value)

See also

Using WDDX in the Developing ColdFusion Applications

History

ColdFusion MX: Changed behavior: if the value parameter is not a WDDX packet, ColdFusion returns False. (In earlier releases, ColdFusion threw an error.)

Parameters

Parameter

Description

value

A WDDX packet

Usage

This function processes a WDDX packet with a validating XML parser, which uses the WDDX Document Type Definition (DTD). To prevent CFWDDX deserialization errors, you can use this function to validate WDDX packets from unknown sources.

Example

 

<!--- serialize a string into a WDDX packet --->
<CFWDDX ACTION="CFML2WDDX" INPUT="I am a string!" OUTPUT="MyWDDXPacket1">
<cfscript>
MyWDDXPacket2 = "I am a string too!"
writeOutput(EncodeForHTML(MyWDDXPacket1))
// check if MyWDDXPacket1 contains a well-formed WDDX packet
if (IsWDDX(MyWDDXPacket1)){
writeOutput("Well formed WDDX packet")
}
else {
writeOutput("Not a well formed WDDX packet")
}
// check if MyWDDXPacket2 contains a well-formed WDDX packet
writeOutput(EncodeForHTML(MyWDDXPacket2))
if (IsWDDX(MyWDDXPacket2)){
writeOutput("Well formed WDDX packet")
}
else {
writeOutput("Not a well formed WDDX packet")
}
</cfscript>
<!--- serialize a string into a WDDX packet ---> <CFWDDX ACTION="CFML2WDDX" INPUT="I am a string!" OUTPUT="MyWDDXPacket1"> <cfscript> MyWDDXPacket2 = "I am a string too!" writeOutput(EncodeForHTML(MyWDDXPacket1)) // check if MyWDDXPacket1 contains a well-formed WDDX packet if (IsWDDX(MyWDDXPacket1)){ writeOutput("Well formed WDDX packet") } else { writeOutput("Not a well formed WDDX packet") } // check if MyWDDXPacket2 contains a well-formed WDDX packet writeOutput(EncodeForHTML(MyWDDXPacket2)) if (IsWDDX(MyWDDXPacket2)){ writeOutput("Well formed WDDX packet") } else { writeOutput("Not a well formed WDDX packet") } </cfscript>
<!--- serialize a string into a WDDX packet ---> 
<CFWDDX ACTION="CFML2WDDX" INPUT="I am a string!" OUTPUT="MyWDDXPacket1"> 
<cfscript> 
    MyWDDXPacket2 = "I am a string too!" 
    writeOutput(EncodeForHTML(MyWDDXPacket1)) 
    // check if MyWDDXPacket1 contains a well-formed WDDX packet 
    if (IsWDDX(MyWDDXPacket1)){ 
        writeOutput("Well formed WDDX packet") 
    } 
    else { 
        writeOutput("Not a well formed WDDX packet") 
    } 
    // check if MyWDDXPacket2 contains a well-formed WDDX packet 
    writeOutput(EncodeForHTML(MyWDDXPacket2)) 
    if (IsWDDX(MyWDDXPacket2)){ 
        writeOutput("Well formed WDDX packet") 
    } 
    else { 
        writeOutput("Not a well formed WDDX packet") 
    } 
</cfscript>

Get help faster and easier

New user?