>- see footer for list info -< Rex, I'm afraid I haven't a moment to try things out for you, and this may not seem helpful, but I'm curious: why don't you convert versions 2 and 3 to both be written either as CFSCRIPT or as tags, and then introduce your functionality variances in one or the other. I mean, you're proposing that these are to generate "the same exact XML three ways", and the key difference in the third seems to focus on case-sensitivity, but then it also varies in being done in CFSCRIPT. Why not make the 2nd and 3rd code sets otherwise identical, so that you might more quickly perhaps spot some other difference that could be causing the problem. Sorry if that's not helpful.
I will thrown in as well that sometimes people struggle with XML in CFML because of the many ways of doing things, and they may not always make the best choice. Again, without studying yours I'm not saying you have, but I would suggest that if you've not seen the nifty 30 page tutorial on doing XML in CF, by Nate Weiss in 2002, it's really the very best thing I recommend people start with whenever they hit a snag. (I think the case-sensitve feature is new since CF6 when it was written, but other than that, all it says would apply and may help.) See it at: http://www.adobe.com/devnet/coldfusion/articles/xmlxslt.pdf Hope that's helpful. /charlie -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of rex Sent: Monday, June 30, 2008 3:11 PM To: Coldfusion Development Subject: [CF-Dev] cfxml vs xmlnew() vs xmlnew(true) >- see footer for list info -< Hello everyone, I have this code that should generate the same exact XML three ways, but I can't get the third way to work. 1. cfxml - this works exactly the way I want it. <cfxml variable="whatIwant"> <breakfast_menu> <food> <name quantity="50" quantity2="150">Belgian Waffles</name> <description>Our famous Belgian Waffles</description> </food> <morefood/> </breakfast_menu> </cfxml> <cfdump var="#whatIwant#"/> 2. xmlNew() - this works like cfxml, but quantity and quantity2 attributes come out as uppercase <cfset myXML = XmlNew()/> <cfset myXML.xmlRoot = XmlElemNew(myXML, "breakfast_menu")/> <cfset myXML.breakfast_menu.xmlChildren[1] = XmlElemNew(myXML, "food")/> <cfset myXML.breakfast_menu.xmlChildren[2] = XmlElemNew(myXML, "morefood")/> <cfset myXML.breakfast_menu.food.xmlChildren[1] = xmlElemNew(myXML, "name")/> <cfset myXML.breakfast_menu.food.xmlChildren[2] = xmlElemNew(myXML, "description")/> <cfset myXML.breakfast_menu.food.name.xmlText = "Belgian Waffles"/> <cfset myXML.breakfast_menu.food.name.xmlAttributes.quantity = 50 /><!--- this comes out as uppercase ---> <cfset myXML.breakfast_menu.food.name.xmlAttributes.quantity2 = 150 /><!--- this comes out as uppercase ---> <cfset myXML.breakfast_menu.food.description.xmlText = "Our famous Belgian Waffles"/> <cfset myXML.breakfast_menu.xmlChildren[2] = xmlElemNew(myXML, "morefood")/> <cfdump var="#myXML#"/> 3. xmlNew(true) - I'm trying to get the quantity/quantity2 attributes to be case sensitive. I cannot get this to work at all. I cannot add the child node "name" under "food" <cfscript> myXML = xmlNew(true); myXML.xmlRoot = xmlElemNew(myXML, "breakfast_menu"); myXML.xmlRoot["breakfast_menu"][1] = xmlElemNew(myXML, "food"); myXML.xmlRoot["breakfast_menu"][1] = xmlElemNew(myXML, "morefood"); myXML.["breakfast_menu"]["food"][1] = xmlElemNew(myXML, "name"); //myXML.xmlRoot[1][1][1] = xmlElemNew(myXML, "name"); //does not work //myXML["breakfast_menu"]["food"][1] = xmlElemNew(myXML, "name"); //this does not work //myXML.xmlRoot["breakfast_menu"]["food"][1] = xmlElemNew(myXML, "name"); //this does not work //myXML.xmlRoot[1][1][1] = xmlElemNew(myXML, "name"); //this does not work </cfscript> <cfdump var="#myXML#"/> http://livedocs.adobe.com/coldfusion/8/htmldocs/help.html?content=XML_08.htm l says not to use dot notation when referencing case sensitive XML. One of the examples in there, I cannot get to work: MyDoc.["employee"]["name"][1] which would translate to my code as: myXML.["breakfast_menu"]["food"][1] I get an error saying 'A CFML variable name cannot end with a "." character.' Thanks for the help! _______________________________________________ For details on ALL mailing lists and for joining or leaving lists, go to http://list.cfdeveloper.co.uk/mailman/listinfo -- CFDeveloper Sponsors:- >- cfdeveloper Hosting provided by www.cfmxhosting.co.uk -< >- Lists hosted by www.Gradwell.com -< >- CFdeveloper is run by Russ Michaels, feel free to volunteer your help -< _______________________________________________ For details on ALL mailing lists and for joining or leaving lists, go to http://list.cfdeveloper.co.uk/mailman/listinfo -- CFDeveloper Sponsors:- >- cfdeveloper Hosting provided by www.cfmxhosting.co.uk -< >- Lists hosted by www.Gradwell.com -< >- CFdeveloper is run by Russ Michaels, feel free to volunteer your help -<
