var channelStruct = StructNew();
var i = 1;
var requiredAttributes = 'title,link,description';
var argList = StructKeyList(arguments);
//if Channel Struct is defined don't use arguments struct
if (isDefined("arguments.channel")){
if (IsStruct(arguments.channel)){
channelStruct = arguments.channel;
//append arguments struct onto channelStruct
for (i=1;i lt StructCount(arguments);i=IncrementValue(i)){
if (issimplevalue(arguments[ListGetAt(argList,i)]))
if (trim(arguments[ListGetAt(argList,i)]) neq '')
if (not isDefined("channelStruct.#ListGetAt(argList,i)#"))
channelStruct[ListGetAt(argList,i)] = arguments[ListGetAt(argList,i)];
}
}
}else{
for (i=1;i lt StructCount(arguments);i=IncrementValue(i)){
if (Trim(LCase(ListGetAt(argList,i))) neq 'channel')
channelStruct[ListGetAt(argList,i)] = arguments[ListGetAt(argList,i)];
}
for(i=1;i lte ListLen(requiredAttributes);i=IncrementValue(i)){
if (not StructKeyExists(channelStruct,ListGetAt(requiredAttributes,i)))
return 'The required attributes have not been set';
}
}
variables.channel = channelStruct;
return this;
var itemStruct = StructNew();
var i = 1;
var requiredAttributes = 'title,link,description';
var argList = StructKeyList(arguments);
//if Channel Struct is defined don't use arguments struct
if (isDefined("arguments.item")){
if (IsStruct(arguments.item)){
itemStruct = arguments.item;
//append arguments struct onto channelStruct
for (i=1;i lt StructCount(arguments);i=IncrementValue(i)){
if (issimplevalue(arguments[ListGetAt(argList,i)]))
if (trim(arguments[ListGetAt(argList,i)]) neq '')
if (not isDefined("itemStruct.#ListGetAt(argList,i)#"))
itemStruct[ListGetAt(argList,i)] = arguments[ListGetAt(argList,i)];
}
}
}else{
for (i=1;i lte StructCount(arguments);i=IncrementValue(i)){
if (Trim(LCase(ListGetAt(argList,i))) neq 'item')
itemStruct[ListGetAt(argList,i)] = arguments[ListGetAt(argList,i)];
}
for(i=1;i lte ListLen(requiredAttributes);i=IncrementValue(i)){
if (not StructKeyExists(itemStruct,ListGetAt(requiredAttributes,i)))
return 'The required attributes have not been set';
}
}
if (isDefined("variables.items"))
return ArrayAppend(variables.items,itemStruct);
else{
variables.items = ArrayNew(1);
return ArrayAppend(variables.items,itemStruct);
}
var channel = '';
var items = '';
var i = 0;
var c = '';
var k = 0;
var e = '';
if (not isDefined("variables.channel") OR not isDefined("variables.items")){
WriteOutput('You must initialize the channel and at least one item');
}else{
//continue processing
channel = variables.channel;
items = variables.items;
}
channelAttributes = StructKeyList(channel);
//clear Buffer (whitespace) to ensure XML declaration is first line outputted to browser
getPageContext().getOut().clearBuffer();
<#Lcase(c)# domain="#channel[c][i]['domain']#">#LCase(c)#>
<#Lcase(c)#>#LCase(c)#>
<#Lcase(c)#>#LCase(c)#>
<#Lcase(c)#>#DateFormat(channel[c],"ddd, dd mmm yyyy")# #TimeFormat(channel[c],"hh:mm:ss")# -0500#LCase(c)#>
<#Lcase(c)#>#LCase(c)#>
-
<#Lcase(e)# domain="#items[i][e][k]['domain']#">#LCase(e)#>
<#Lcase(e)#>#LCase(e)#>
<#Lcase(e)#>#LCase(e)#>
<#LCase(e)#>#DateFormat(items[i][e],"ddd, dd mmm yyyy")# #TimeFormat(items[i][e],"hh:mm:ss")# -0500#LCase(e)#>
<#LCase(e)#>#LCase(e)#>