Determines whether a value is a well-formed WDDX packet.
True, if the value is a well-formed WDDX packet; False, otherwise.
Decision functions, XML functions
IsWDDX(value)
Using WDDX in the Developing ColdFusion Applications
ColdFusion MX: Changed behavior: if the value parameter is not a WDDX packet, ColdFusion returns False. (In earlier releases, ColdFusion threw an error.)
Parameter |
Description |
---|---|
value |
A WDDX packet |
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.
<!--- 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>
Sign in to your account