Is there any whitespace before the XML dec? Also, it appears to to me that each <nutrient name="#allNutrients.nutrientName#" ... tag is unclosed.
-----Original Message----- From: jonese [mailto:[EMAIL PROTECTED] Sent: Wednesday, 18 May 2005 12:31 To: CF-Talk Subject: Re: simple CFXML issue i thought the cfxml tag was supposed to already do that? I have another function which is building another xml file and it uses the cfxml tag and does not have the "<?xml version="1.0" encoding="utf-8"?>" in the code BUT it generates good XML which includes the " <?xml version="1.0" encoding="utf-8"?>" header as required. am i missing something here? jonese On 5/16/05, Matthew Walker <[EMAIL PROTECTED]> wrote: > > After the <cfxml>, put <?xml version="1.0" encoding="utf-8"?> > > -----Original Message----- > From: jonese [mailto:[EMAIL PROTECTED] > Sent: Tuesday, 17 May 2005 9:44 a.m. > To: CF-Talk > Subject: simple CFXML issue > > I'm sure this is something i'm just missing because it's late in the > day but... > i have a simple CFC which is creating some xml files for me. if i have > the following code inside my function <cfset var allNutrients = > getNutrient()> <cfset var returnThis = ""> <cfxml variable="xmloutput" > casesensitive="yes"> <nutrients> <cfloop query="allNutrients"> > <nutrient name="#allNutrients.nutrientName#" > required="#allNutrients.required#" unit="numeric" > id="#allNutrients.nutrientid#" rdaUnit="#allNutrients.weightUnit#" > rda="#allNutrients.rdi#" ordinal="#allNutrients.ordinal#"> </cfloop> > </nutrients> </cfxml> and then run the function i get the error: > Document root element is missing. Document root element is missing. > The > error occurred in *D:\usr\dpFoodMenu\www\components\menuXML.cfc: line > 130* > > 128 : <cfloop query="allNutrients"> > 129 : <nutrient name="#allNutrients.nutrientName#" > required="#allNutrients.required#" unit="numeric" > id="#allNutrients.nutrientid#" rdaUnit="#allNutrients.weightUnit#" > rda="#allNutrients.rdi#" ordinal="#allNutrients.ordinal#">*130 : > </cfloop>* > 131 : </nutrients> > 132 : </cfxml> > > BUT if i run this code: > <cfset var allNutrients = getNutrient()> <cfset var xmloutput = > XMLNew('yes')> <cfset var returnThis = ""> <cfscript> > xmloutput.xmlRoot = XmlElemNew(xmloutput, "nutrients"); </cfscript> > <cfloop query="allNutrients"> <cfscript> // Below script is based on > this XMLoutput //<nutrient name="#allNutrients.nutrientName#" > required="#allNutrients.required#" id="#allNutrients.nutrientid#" > rdaUnit="#allNutrients.weightUnit#" rda="#allNutrients.rdi#" > ordinal="#allNutrients.ordinal#" /> > xmloutput.xmlroot.xmlChildren[allNutrients.currentRow] = > XmlElemNew(xmloutput, "nutrient"); > xmloutput.xmlroot.xmlChildren[allNutrients.currentRow].xmlAttributes.n > ame > = > "#allNutrients.nutrientName#"; > xmloutput.xmlroot.xmlChildren[allNutrients.currentRow > ].xmlAttributes.require > d > = "#allNutrients.required#"; > xmloutput.xmlroot.xmlChildren[allNutrients.currentRow].xmlAttributes.i > d = "#allNutrients.nutrientid#"; > xmloutput.xmlroot.xmlChildren[allNutrients.currentRow > ].xmlAttributes.rdaUnit > > = "#allNutrients.weightUnit#"; > xmloutput.xmlroot.xmlChildren[allNutrients.currentRow].xmlAttributes.r > da = "#allNutrients.rdi#"; > xmloutput.xmlroot.xmlChildren[allNutrients.currentRow > ].xmlAttributes.ordinal > > = "#allNutrients.ordinal#"; > </cfscript> > </cfloop> > It returns a good XML object... any ideas?? > jonese > > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Logware (www.logware.us): a new and convenient web-based time tracking application. Start tracking and documenting hours spent on a project or with a client with Logware today. Try it for free with a 15 day trial account. http://www.houseoffusion.com/banners/view.cfm?bannerid=67 Message: http://www.houseoffusion.com/lists.cfm/link=i:4:206996 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4 Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

