...

View Full Version : New to XML - Help w/ Freight Quote API Please



basequipment
08-13-2008, 04:01 PM
I am fairly new to XML but ideally proficient in HTML. I am trying to implement a Freight Quote Calculator into our website. I am confused what and where exactly I put these codes or XML files for that matter. The freight company gave me some samples to work with:

**I can get to the point where it completes the request and I recieve an XML page full of data similar to the data below. However, what do I do with this data? Do I link it to the Definitions below somehow to display user-friendly information?**

Sample XML Rate Quote Data Stream
After you have completed your request, you will receive an XML data stream like the example below, providing the rate quote you requested.
If an error occurs processing your request, a status code will indicate the nature of the error.

<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE RATEQUOTE (View Source for full doctype)>
<RATEQUOTE>
<STATUS />
<SHIPPERZIPCODE>66223</SHIPPERZIPCODE>
<SHIPPERZIPCODESERVEDBYTRM>KANSAS CITY, MO</SHIPPERZIPCODESERVEDBYTRM>
<SHIPPERZIPCODESERVEDBYTRMTYPE>Direct</SHIPPERZIPCODESERVEDBYTRMTYPE>
<CONSIGNEEZIPCODE>11234</CONSIGNEEZIPCODE>
<CONSIGNEEZIPCODESERVEDBYTRM>QUEENS, NY</CONSIGNEEZIPCODESERVEDBYTRM>
<CONSIGNEEZIPCODESERVEDBYTRMTYPE>Direct</CONSIGNEEZIPCODESERVEDBYTRMTYPE>
<PAYMENTINFORMATION>Shipper, Prepaid</PAYMENTINFORMATION>
<REQUESTID />
<SHIPMENTLINEDETAIL>
<WEIGHT>100 lbs</WEIGHT>
<CLASS>50</CLASS>
<PIECES />
</SHIPMENTLINEDETAIL>
<SHIPMENTLINEDETAIL>
<WEIGHT>lbs</WEIGHT>
<CLASS />
<PIECES />
</SHIPMENTLINEDETAIL>
<SHIPMENTLINEDETAIL>
<WEIGHT>lbs</WEIGHT>
<CLASS />
<PIECES />
</SHIPMENTLINEDETAIL>
<SHIPMENTLINEDETAIL>
<WEIGHT>lbs</WEIGHT>
<CLASS />
<PIECES />
</SHIPMENTLINEDETAIL>
<SHIPMENTLINEDETAIL>
<WEIGHT>lbs</WEIGHT>
<CLASS />
<PIECES />
</SHIPMENTLINEDETAIL>
<CURRENCY>US Dollars</CURRENCY>
<STANDARDGROUNDTOTAL>$217.83</STANDARDGROUNDTOTAL>
<DEFINITEDELIVERYTOTAL>$259.10</DEFINITEDELIVERYTOTAL>
<DEFINITEDELIVERYFROMDATE />
<DEFINITEDELIVERYTODATE />
<SERVICEDAYS>3</SERVICEDAYS>
<PROJECTEDDELIVERYDATEIFSHIPPEDTODAY> 8/1/2005</PROJECTEDDELIVERYDATEIFSHIPPEDTODAY>
<GROSSCHARGE>$361.07</GROSSCHARGE>
<RATEDAS />
<DISCOUNTAMOUNT>$216.64</DISCOUNTAMOUNT>
<DISCOUNTPERCENTAGE>60%</DISCOUNTPERCENTAGE>
<FUELSURCHARGE>$20.65</FUELSURCHARGE>
<EXTENDEDSERVICESTOTAL>$52.75</EXTENDEDSERVICESTOTAL>
<EXTENDEDSERVICESDETAIL>
<EXTENDEDSERVICENAME>Inside Pickup</EXTENDEDSERVICENAME>
<EXTENDEDSERVICEAMOUNT>$52.75</EXTENDEDSERVICEAMOUNT>
</EXTENDEDSERVICESDETAIL>
<RATEQUOTEID>19542958</RATEQUOTEID>
</RATEQUOTE>

XML Request Definition
Use this definition to develop programming for the XML request data stream mentioned above
<!DOCTYPE RATEQUOTE [
<!ELEMENT RATEQUOTE (STATUS,SHIPPERZIPCODE,SHIPPERZIPCODESERVEDBYTRM,
SHIPPERZIPCODESERVEDBYTRMTYPE,CONSIGNEEZIPCODE,
CONSIGNEEZIPCODESERVEDBYTRM,CONSIGNEEZIPCODESERVEDBYTRMTYPE,
PAYMENTINFORMATION,REQUESTID,SHIPMENTLINEDETAIL+,CURRENCY,
STANDARDGROUNDTOTAL,DEFINITEDELIVERYTOTAL,DEFINITEDELIVERYFROMDATE,
DEFINITEDELIVERYTODATE,SERVICEDAYS,
PROJECTEDDELIVERYDATEIFSHIPPEDTODAY,GROSSCHARGE,RATEDAS,
DISCOUNTAMOUNT,DISCOUNTPERCENTAGE,FUELSURCHARGE,
EXTENDEDSERVICESTOTAL,EXTENDEDSERVICESDETAIL*,RATEQUOTEID)>
<!ELEMENT CONSIGNEEZIPCODE (#PCDATA)>
<!ELEMENT CONSIGNEEZIPCODESERVEDBYTRM (#PCDATA)>
<!ELEMENT CONSIGNEEZIPCODESERVEDBYTRMTYPE (#PCDATA)>
<!ELEMENT CURRENCY (#PCDATA)>
<!ELEMENT DEFINITEDELIVERYTOTAL (#PCDATA)>
<!ELEMENT DISCOUNTAMOUNT (#PCDATA)>
<!ELEMENT DISCOUNTPERCENTAGE (#PCDATA)>
<!ELEMENT EXTENDEDSERVICEAMOUNT (#PCDATA)>
<!ELEMENT EXTENDEDSERVICENAME (#PCDATA)>
<!ELEMENT EXTENDEDSERVICESDETAIL (EXTENDEDSERVICENAME,EXTENDEDSERVICEAMOUNT)>
<!ELEMENT EXTENDEDSERVICESTOTAL (#PCDATA)>
<!ELEMENT FUELSURCHARGE (#PCDATA)>
<!ELEMENT GROSSCHARGE (#PCDATA)>
<!ELEMENT RATEDAS (#PCDATA)>
<!ELEMENT PAYMENTINFORMATION (#PCDATA)>
<!ELEMENT PIECES (#PCDATA)>
<!ELEMENT PROJECTEDDELIVERYDATEIFSHIPPEDTODAY (#PCDATA)>
<!ELEMENT CLASS (#PCDATA)>
<!ELEMENT RATEQUOTEID (#PCDATA)>
<!ELEMENT SERVICEDAYS (#PCDATA)>
<!ELEMENT REQUESTID (#PCDATA)>
<!ELEMENT SHIPMENTLINEDETAIL (WEIGHT,CLASS,PIECES)>
<!ELEMENT SHIPPERZIPCODE (#PCDATA)>
<!ELEMENT SHIPPERZIPCODESERVEDBYTRM (#PCDATA)>
<!ELEMENT SHIPPERZIPCODESERVEDBYTRMTYPE (#PCDATA)>
<!ELEMENT STANDARDGROUNDTOTAL (#PCDATA)>
<!ELEMENT STATUS (#PCDATA)>
<!ELEMENT WEIGHT (#PCDATA)>]>

XML Response Definition
And use this definition to develop programming for the XML response data stream:
<?xml version="1.0" encoding="UTF-8"?>
<!ELEMENT RATEQUOTE (STATUS,SHIPPERZIPCODE,SHIPPERZIPCODESERVEDBYTRM,
SHIPPERZIPCODESERVEDBYTRMTYPE,CONSIGNEEZIPCODE,
CONSIGNEEZIPCODESERVEDBYTRM,CONSIGNEEZIPCODESERVEDBYTRMTYPE,
PAYMENTINFORMATION,REQUESTID,SHIPMENTLINEDETAIL+,CURRENCY,
STANDARDGROUNDTOTAL,DEFINITEDELIVERYTOTAL,SERVICEDAYS,
PROJECTEDDELIVERYDATEIFSHIPPEDTODAY,
DEFINITEDELIVERYFROMDATE,
DEFINITEDELIVERYTODATE,GROSSCHARGE,RATEDAS,
DISCOUNTAMOUNT,DISCOUNTPERCENTAGE,FUELSURCHARGE,
EXTENDEDSERVICESTOTAL,EXTENDEDSERVICESDETAIL*,RATEQUOTEID)>
<!ELEMENT CONSIGNEEZIPCODE (#PCDATA)>
<!ELEMENT CONSIGNEEZIPCODESERVEDBYTRM (#PCDATA)>
<!ELEMENT CONSIGNEEZIPCODESERVEDBYTRMTYPE (#PCDATA)>
<!ELEMENT CURRENCY (#PCDATA)>
<!ELEMENT DEFINITEDELIVERYTOTAL (#PCDATA)>
<!ELEMENT DISCOUNTAMOUNT (#PCDATA)>
<!ELEMENT DISCOUNTPERCENTAGE (#PCDATA)>
<!ELEMENT EXTENDEDSERVICEAMOUNT (#PCDATA)>
<!ELEMENT EXTENDEDSERVICENAME (#PCDATA)>
<!ELEMENT EXTENDEDSERVICESDETAIL (EXTENDEDSERVICENAME,EXTENDEDSERVICEAMOUNT)>
<!ELEMENT EXTENDEDSERVICESTOTAL (#PCDATA)>
<!ELEMENT FUELSURCHARGE (#PCDATA)>
<!ELEMENT GROSSCHARGE (#PCDATA)>
<!ELEMENT RATEDAS (#PCDATA)>
<!ELEMENT PAYMENTINFORMATION (#PCDATA)>
<!ELEMENT PIECES (#PCDATA)>
<!ELEMENT PROJECTEDDELIVERYDATEIFSHIPPEDTODAY (#PCDATA)>
<!ELEMENT DEFINITEDELIVERYFROMDATE (#PCDATA)>
<!ELEMENT DEFINITEDELIVERYTODATE (#PCDATA)>
<!ELEMENT CLASS (#PCDATA)>
<!ELEMENT RATEQUOTEID (#PCDATA)>
<!ELEMENT SERVICEDAYS (#PCDATA)>
<!ELEMENT REQUESTID (#PCDATA)>
<!ELEMENT SHIPMENTLINEDETAIL (WEIGHT,CLASS,PIECES)>
<!ELEMENT SHIPPERZIPCODE (#PCDATA)>
<!ELEMENT SHIPPERZIPCODESERVEDBYTRM (#PCDATA)>
<!ELEMENT SHIPPERZIPCODESERVEDBYTRMTYPE (#PCDATA)>
<!ELEMENT STANDARDGROUNDTOTAL (#PCDATA)>
<!ELEMENT STATUS (#PCDATA)>
<!ELEMENT WEIGHT (#PCDATA)>

Any help in this matter would be greatly appreciated; like I said before, I do not know much about XML, thank you all.

shyam
08-13-2008, 04:23 PM
you could use xsl (http://www.w3schools.com/xsl) to transform the xml into html for display



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum