Login

    Register

Managed Hosting

PROJECT CATEGORIES

 

XmlToStruct
Project Home Blog Known Issues External Project Link Contact Project

XmlToStruct Issue: make second argument optional

Name: make second argument optional
ID: 2
Project: XmlToStruct
Type: Enhancement
Area: Code
Severity: Low
Status: Open
Related URL:
Creator: Speq
Created: 06/24/08 3:39 PM
Updated: 12/05/08 1:58 PM
Description: making the 2nd argument of the function optional can save the hassle of adding StructNew() as an argument to the function.

the modification is easy to implement as so:

in line 10:
[cfargument name="str" type="struct" required="false" /]

then in the local variable initialization, change the code to:
[cfset var astr = StructNew() /]

and after the local var initialization, add:
[cfif isDefined("arguments.str")]
[cfset astr = arguments.str /]
[/cfif]
History: Created by speqy (Speq) : 06/24/08 3:39 PM

Comment by speqy (Speq) : 06/24/08 3:41 PM
then you can just call the method with one parameter (the xml document):

objXml.ConvertXmlToStruct(myBooks)

Comment by mgw4jc (Matt Williams) : 12/05/08 1:58 PM
Another option here would be to do
cfargument name="str" type="struct" required="false" default="#StructNew()#"

To add a comment to this bug, please login using the link above.