Howard,
Here is the code of what your trying to do.. i choose Book/Books...
<cfscript>
xmlDoc = xmlNew();
xmlDoc.xmlRoot = xmlElemNew(xmlDoc,"Books");
for(i = 1; i lte 5; i=i+1){
xmlDoc.Books.xmlChildren[i] = xmlElemNew(xmlDoc,"Book");
xmlDoc.Books.xmlChildren[i].xmlText = "Book " & i;
xmlDoc.Books.xmlChildren[i].xmlAttributes["type"] = "Fiction " & i;
}
</cfscript>
<cffile
action = "write"
file = "#expandPath("myxmlDoc.xml")#"
output = "#toString(xmlDoc)#">
<cfdump var="#xmlDoc#">
Hope this helps.
Joe Eugene
> -----Original Message-----
> From: Owens, Howard [mailto:[EMAIL PROTECTED]
> Sent: Monday, June 16, 2003 6:33 PM
> To: CF-Talk
> Subject: Dynamically populating an XML document
>
>
> I have a newly created XML document:
>
> <cfscript>
> file_log = XmlNew();
> file_log.xmlRoot = XmlElemNew(file_log, "Collection");
> file_log.xmlRoot.XmlChildren[1] = XmlElemNew(file_log, "File");
> </cfscript>
>
> I want to loop over some values and insert them, so the document ends up
> looking something like this:
>
> <collection>
> <file>some value</file>
> <file>some value</file>
> <file>some value</file>
> <file>some value</file>
> </collection>
>
> I'm trying to insert with some variation of:
>
> <cfset StructInsert(file_log.Collection.XmlAttributes, "File",
> "selectedElements[i].XmlAttributes.id#.pdf")>
>
> But I keep getting this error with every thing I try:
>
> Missing argument name. When using named parameters to a function, every
> parameter must have a name.
>
> I'm not getting what I'm missing?
>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4
Subscription:
http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribe&forumid=4
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Signup for the Fusion Authority news alert and keep up with the latest news in
ColdFusion and related topics.
http://www.fusionauthority.com/signup.cfm
Unsubscribe:
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4