Each request for a VIN gives back the information for 1 car only, the actuel XML has over 180 field I need like 80 out of those and fill out our form to insert it into our MSSQL database with information that we will provide that are not in the XML file like price, warrenty etch...
So here is the short XML :
<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
- <VINquery Version="1.0.0" Report_Type="EXTENDED" Date="10/21/2009">
- <VIN Number="WBAEU3343*********" Status="SUCCESS">
- <Vehicle VINquery_Vehicle_ID="29918" Model_Year="2005" Make="BMW" Model="3-Series" Trim_Level="325xi Sedan">
<Item Key="VINquery_Vehicle_ID" Value="29918" Unit="" />
<Item Key="Model Year" Value="2005" Unit="" />
<Item Key="Make" Value="BMW" Unit="" />
<Item Key="Model" Value="3-Series" Unit="" />
<Item Key="Trim Level" Value="325xi Sedan" Unit="" />
<Item Key="Manufactured in" Value="GERMANY" Unit="" />
<Item Key="Production Seq. Number" Value="R18010" Unit="" />
<Item Key="Body Style" Value="SEDAN 4-DR" Unit="" />
<Item Key="Engine Type" Value="2.5L L6 DOHC 24V" Unit="" />
<Item Key="Transmission-short" Value="5A | 5M" Unit="" />
<Item Key="Transmission-long" Value="5-Speed Automatic | 5-Speed Manual" Unit="" />
<Item Key="Driveline" Value="AWD" Unit="" />
<Item Key="Tank" Value="16.60" Unit="gallon" />
<Item Key="Fuel Economy-city" Value="19" Unit="miles/gallon" />
<Item Key="Fuel Economy-highway" Value="26 - 27" Unit="miles/gallon" />
<Item Key="Anti-Brake System" Value="4-Wheel ABS" Unit="" />
<Item Key="Steering Type" Value="R&P" Unit="" />
<Item Key="Front Brake Type" Value="Disc" Unit="" />
<Item Key="Rear Brake Type" Value="Disc" Unit="" />
<Item Key="Turning Diameter" Value="35.80" Unit="in." />
<Item Key="Front Suspension" Value="Ind" Unit="" />
<Item Key="Rear Suspension" Value="Ind" Unit="" />
<Item Key="Front Spring Type" Value="Coil" Unit="" />
<Item Key="Rear Spring Type" Value="Coil" Unit="" />
<Item Key="Tires" Value="205/55R16" Unit="" />
<Item Key="Front Headroom" Value="37.00" Unit="in." />
<Item Key="Rear Headroom" Value="37.40" Unit="in." />
<Item Key="Front Legroom" Value="41.40" Unit="in." />
<Item Key="Rear Legroom" Value="34.40" Unit="in." />
<Item Key="Front Shoulder Room" Value="54.40" Unit="in." />
<Item Key="Rear Shoulder Room" Value="54.20" Unit="in." />
<Item Key="Front Hip Room" Value="No data" Unit="in." />
<Item Key="Rear Hip Room" Value="No data" Unit="in." />
<Item Key="Interior Trim" Value="Black Leather Interior | Black Leatherette Interior | Gray Leather Interior | Natural Brown Leather Interior | Sand Leather Interior | Sand Leatherette Interior" Unit="" />
<Item Key="Exterior Color" Value="Alpine White | Black Sapphire Metallic | Electric Red | Grey Green Metallic | Jet Black | Mystic Blue Metallic | Orient Blue Metallic | Oxford Green Metallic | Silver Gray Metallic | Steel Blue Metallic | Titanium Silver Metallic" Unit="" />
<Item Key="Curb Weight-automatic" Value="3527" Unit="lbs" />
<Item Key="Tow Hitch Receiver" Value="N/A" Unit="" />
<Item Key="Towing Preparation Package" Value="N/A" Unit="" />
</Vehicle>
</VIN>
</VINquery>
**********************************************************************************************
In field like these <Item Key="Exterior Color" Value="Alpine White | Black Sapphire Metallic | Electric Red | Grey Green Metallic | Jet Black | Mystic Blue Metallic | Orient Blue Metallic | Oxford Green Metallic | Silver Gray Metallic | Steel Blue Metallic | Titanium Silver Metallic" Unit="" />
I will also need to make a select <option> box for all the color if you havea tip on how to do it would be apriciated.
Here is some sample code that shows both basic direct array notation and a simple xmlSearch() with a basic xpath. I don't have the motivation to work up an xmlTransform() example that would use xslt, but there are plenty of tutorials on how to use xslt with xml and the ColdFusion documentation describes how to use the xmlTransform() function to utilize the xslt with the xml.
<cfsavecontent variable="testXML"><?xml version="1.0" encoding="utf-8" standalone="yes" ?>
<VINquery Version="1.0.0" Report_Type="EXTENDED" Date="10/21/2009">
<VIN Number="WBAEU3343*********" Status="SUCCESS">
<Vehicle VINquery_Vehicle_ID="29918" Model_Year="2005" Make="BMW" Model="3-Series" Trim_Level="325xi Sedan">
<Item Key="VINquery_Vehicle_ID" Value="29918" Unit="" />
<Item Key="Model Year" Value="2005" Unit="" />
<Item Key="Make" Value="BMW" Unit="" />
<Item Key="Model" Value="3-Series" Unit="" />
<Item Key="Trim Level" Value="325xi Sedan" Unit="" />
<Item Key="Manufactured in" Value="GERMANY" Unit="" />
<Item Key="Production Seq. Number" Value="R18010" Unit="" />
<Item Key="Body Style" Value="SEDAN 4-DR" Unit="" />
<Item Key="Engine Type" Value="2.5L L6 DOHC 24V" Unit="" />
<Item Key="Transmission-short" Value="5A | 5M" Unit="" />
<Item Key="Transmission-long" Value="5-Speed Automatic | 5-Speed Manual" Unit="" />
<Item Key="Driveline" Value="AWD" Unit="" />
<Item Key="Tank" Value="16.60" Unit="gallon" />
<Item Key="Fuel Economy-city" Value="19" Unit="miles/gallon" />
<Item Key="Fuel Economy-highway" Value="26 - 27" Unit="miles/gallon" />
<Item Key="Anti-Brake System" Value="4-Wheel ABS" Unit="" />
<Item Key="Steering Type" Value="R&P" Unit="" />
<Item Key="Front Brake Type" Value="Disc" Unit="" />
<Item Key="Rear Brake Type" Value="Disc" Unit="" />
<Item Key="Turning Diameter" Value="35.80" Unit="in." />
<Item Key="Front Suspension" Value="Ind" Unit="" />
<Item Key="Rear Suspension" Value="Ind" Unit="" />
<Item Key="Front Spring Type" Value="Coil" Unit="" />
<Item Key="Rear Spring Type" Value="Coil" Unit="" />
<Item Key="Tires" Value="205/55R16" Unit="" />
<Item Key="Front Headroom" Value="37.00" Unit="in." />
<Item Key="Rear Headroom" Value="37.40" Unit="in." />
<Item Key="Front Legroom" Value="41.40" Unit="in." />
<Item Key="Rear Legroom" Value="34.40" Unit="in." />
<Item Key="Front Shoulder Room" Value="54.40" Unit="in." />
<Item Key="Rear Shoulder Room" Value="54.20" Unit="in." />
<Item Key="Front Hip Room" Value="No data" Unit="in." />
<Item Key="Rear Hip Room" Value="No data" Unit="in." />
<Item Key="Interior Trim" Value="Black Leather Interior | Black Leatherette Interior | Gray Leather Interior | Natural Brown Leather Interior | Sand Leather Interior | Sand Leatherette Interior" Unit="" />
<Item Key="Exterior Color" Value="Alpine White | Black Sapphire Metallic | Electric Red | Grey Green Metallic | Jet Black | Mystic Blue Metallic | Orient Blue Metallic | Oxford Green Metallic | Silver Gray Metallic | Steel Blue Metallic | Titanium Silver Metallic" Unit="" />
<Item Key="Curb Weight-automatic" Value="3527" Unit="lbs" />
<Item Key="Tow Hitch Receiver" Value="N/A" Unit="" />
<Item Key="Towing Preparation Package" Value="N/A" Unit="" />
</Vehicle>
</VIN>
</VINquery>
</cfsavecontent>
<cfset xmlObj = xmlParse(testXML)>
<cfoutput>
#xmlObj.VINquery.vin.vehicle.xmlAttributes.make#
#xmlObj.VINquery.vin.vehicle.xmlAttributes.model#
#xmlObj.VINquery.vin.vehicle.xmlAttributes.model_year#
#xmlObj.VINquery.vin.vehicle.xmlAttributes.trim_level#
#xmlObj.VINquery.vin.vehicle.xmlAttributes.vinquery_vehicle_id#
<hr>
#xmlObj.VINquery.vin.vehicle.item[1].xmlAttributes.key#
#xmlObj.VINquery.vin.vehicle.item[1].xmlAttributes.unit#
#xmlObj.VINquery.vin.vehicle.item[1].xmlAttributes.value#
<hr>
#xmlObj.VINquery.vin.vehicle.item[2].xmlAttributes.key#
#xmlObj.VINquery.vin.vehicle.item[2].xmlAttributes.unit#
#xmlObj.VINquery.vin.vehicle.item[2].xmlAttributes.value#
</cfoutput>
<cfset items = xmlSearch(xmlObj,"//Item")>
<cfoutput>
<cfloop array="#items#" index="elem">
#elem.xmlName# #elem.xmlAttributes.key# #elem.xmlAttributes.unit# #elem.xmlAttributes.value#<br>
</cfloop>
</cfoutput>
<cfdump var="#items#">
<cfdump var="#xmlObj#">
<Item Key="Exterior Color" Value="Alpine White | Black Sapphire Metallic | Electric Red | Grey Green Metallic | Jet Black | Mystic Blue Metallic | Orient Blue Metallic | Oxford Green Metallic | Silver Gray Metallic | Steel Blue Metallic | Titanium Silver Metallic" Unit="" /> |
That is just a list delimited by the pipe "|" character. Check out the list functions http://livedocs.adobe.com/coldfusion/8/htmldocs/functions-pt0_13.html