Status/Resolution/Reason: Closed/Fixed/
Reporter/Name(from Bugbase): Jedihomer Townend / Jedi Homer (Jedihomer Townend)
Created: 04/28/2010
Components: Language, CFSCRIPT
Versions: 9.0
Failure Type: Unspecified
Found In Build/Fixed In Build: 274129 / 274296
Priority/Frequency: Major / Most users will encounter
Locale/System: English / Linux Ubuntu 9
Vote Count: 1
Problem:
Hi,I have a problem with some code now that I have applied the 9.0.1 update. Running the following code:<cfsavecontent variable="sXML"><?xml version="1.0" encoding="UTF-8"?><root><Contact><![CDATA[Foo]]></Contact><Person><![CDATA[Bar]]></Person></root></cfsavecontent><cfset oXML = xmlParse(sXML, true) /><cfscript>for (sKey in oXML.xmlRoot) {WriteOutput(HTMLEditFormat(sKey) & "<br />");WriteOutput(oXML.xmlRoot[sKey].xmlCData & "<br />");writeDump(sKey);}</cfscript>Works fine in CF8 and CF9, the sKey being ’Contact’ and ’Person’. However when run on 9.0.1 sKey is a string of the entire XML, when writeDumping sKey is classes it as XML. The loop only runs once.When I change the for to be for (sKey in oXML.xmlRoot.xmlChildren) the loop correctly runs twice, with sKey being shortened/custom xml strings.Is this intended behaviour as the Docs seem to just say that you can ’for in’ for arrays and structs... Which it could always sort-of do...
Method:
<cfsavecontent variable="sXML"><?xml version="1.0" encoding="UTF-8"?><root><Contact><![CDATA[Foo]]></Contact><Person><![CDATA[Bar]]></Person></root></cfsavecontent><cfset oXML = xmlParse(sXML, true) /><cfscript>for (sKey in oXML.xmlRoot) {WriteOutput(HTMLEditFormat(sKey) & "<br />");WriteOutput(oXML.xmlRoot[sKey].xmlText & "<br />");writeDump(sKey);}</cfscript>
Result:
Element is undefined in a Java object of type class coldfusion.xml.XmlNodeList.
----------------------------- Additional Watson Details -----------------------------
Watson Bug ID: 3041380
External Customer Info:
External Company:
External Customer Name: Jedi Homer
External Customer Email: 3449562B432596139920157F
External Test Config: 04/28/2010
Attachments:
Comments: