Hi All.

Now, maybe I'm getting this completely wrong but I think there is a bug when
using dot notation with an XML object in both CF6.1 and 7. The XML structure
I have has come from a web service via http using CFHTTP and this an
example:

<PkgRS xmlns="http://www.test.com/test"; <http://www.test.com/test>xmlns:xsi="
http://www.w3.org/2001/XMLSchema-instance";<http://www.w3.org/2001/XMLSchema-instance>Target="test"
xsi:type="test">
<SyndicatorInfo SyndicatorId="test"/>
<SessionInfo SessionId="iPQ-J9ikYq39hn89J_puDZEn" CreateNewSession="true"/>
<SearchResponse Success="true" ModifiedRequest="false">
<ViewInfo Offset="0" Length="50"/>
<ResultSetInfo SortCode="cost" SortAscending="true" MaxItems="100"
NumItems="1"/>
<PackageHolidays>
<PackageHoliday ItineraryId="si1003" Supplier="EZJ" Country="GB"
NumberOfNights="8" LeadInPricePerPassenger="29.98" FlightOnly="true"
OneWayOnly="false" BookableByFAB="true" Currency="GBP" BookingChannel="WEB">
<Flight OriginAirport="LGW" DestinationAirport="BFS"
DepartureDate="20060202" DepartureTime="0700" ReturnHomeDate="20060210"
ReturnHomeTime="2250" ReturnHomeDepartDate="20060210"
ReturnHomeDepartTime="2125" ArrivalDate="20060202" ArrivalTime="0830"
OutboundFlightNumber="EZY731" ReturnFlightNumber="EZY742"
OutboundFlightBasePrice="9.99" ReturnFlightBasePrice="9.99"/>
</PackageHoliday>
</PackageHolidays>
</SearchResponse>
</PkgRS>

If I then try to output the value of the XML Attribute
"LeadInPricePerPassenger" which is located with the PackageHoliday element
using dot notation I get an error:

<cfoutput>#responseData.PkgRS.SearchResponse.PackageHolidays.PackageHoliday[1].XmlAttributes.LeadInPricePerPassenger#</cfoutput>

Error:

Element PKGRS.SEARCHRESPONSE.PACKAGEHOLIDAYS.PACKAGEHOLIDAY is undefined in
RESPONSEDATA.

However if I output it using associative array (bracket) notation it works
without issue:

<cfoutput>#responseData["PkgRS"]["SearchResponse"]["PackageHolidays"]["PackageHoliday"][1]["XmlAttributes"]["LeadInPricePerPassenger"]#</cfoutput>

29.98

According the "Developing ColdFusion MX Applications" documentation from MM
you can:

quote

Similarly, you can use either, or a combination of both, of the following
notation methods:
• Structure (dot) notation, such as mydoc.employee
• Associative array (bracket) notation, such as mydoc["employee"]


I have tried the same code on MX6.1 and 7 and get the same error. Am I doing
something completely wrong or is this a CF bug?

Best Regards

Andrew


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
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:227478
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

Reply via email to