I'm just getting my feet wet with XML. I've been coding html and asp since '95. So any help that anyone can provide will be greatly appreciated. (I started reading the XML Developers Handbook and had to use toothpicks to keep my eyes open)
So here goes, below you'll see some sample code of what UPS returns when I submit a tracking request:
Code:
<TrackResponse>
<Response>
<TransactionReference>
<CustomerContext>Mocap1</CustomerContext>
<XpciVersion>1.0001</XpciVersion>
</TransactionReference>
<ResponseStatusCode>1</ResponseStatusCode>
<ResponseStatusDescription>Success</ResponseStatusDescription>
</Response>
<Shipment>
<Shipper>
<ShipperNumber>669668</ShipperNumber>
<Address>
<AddressLine1>111 INDUSTRIAL DR</AddressLine1>
<City>PARK HILLS</City>
<StateProvinceCode>MO</StateProvinceCode>
<PostalCode>63601 3170</PostalCode>
<CountryCode>US</CountryCode>
</Address>
</Shipper>
<ShipTo>
<Address>
<AddressLine1>JACK</AddressLine1>
<AddressLine2>2295 AUTOPLEX DRIVE</AddressLine2>
<City>BOSSIER CITY</City>
<StateProvinceCode>LA</StateProvinceCode>
<PostalCode>71111</PostalCode>
<CountryCode>US</CountryCode>
</Address>
</ShipTo>
<Service>
<Code>003</Code>
<Description>GROUND</Description>
</Service>
<ReferenceNumber>
<Code>01</Code>
<Value>51038</Value>
</ReferenceNumber>
<ReferenceNumber>
<Code>01</Code>
<Value>F15085</Value>
</ReferenceNumber>
<ShipmentIdentificationNumber>1Z6696680305103812</ShipmentIdentificationNumber>
<PickupDate>20040415</PickupDate>
<Package>
<TrackingNumber>1Z6696680305103812</TrackingNumber>
<Activity>
<ActivityLocation>
<Address>
<City>BOSSIER CITY</City>
<StateProvinceCode>LA</StateProvinceCode>
<PostalCode>71111</PostalCode>
<CountryCode>US</CountryCode>
</Address>
<Code>M3</Code>
<Description>FRONT DESK</Description>
<SignedForByName>NORRIS</SignedForByName>
</ActivityLocation>
<Status>
<StatusType>
<Code>D</Code>
<Description>DELIVERED</Description>
</StatusType>
<StatusCode>
<Code>KB</Code>
</StatusCode>
</Status>
<Date>20040419</Date>
<Time>094600</Time>
</Activity>
<Activity>
<ActivityLocation>
<Address>
<City>SHREVEPORT</City>
<StateProvinceCode>LA</StateProvinceCode>
<CountryCode>US</CountryCode>
</Address>
</ActivityLocation>
<Status>
<StatusType>
<Code>I</Code>
<Description>OUT FOR DELIVERY</Description>
</StatusType>
<StatusCode>
<Code>DS</Code>
</StatusCode>
</Status>
<Date>20040419</Date>
<Time>070000</Time>
</Activity>
<Activity>
<ActivityLocation>
<Address>
<City>SHREVEPORT</City>
<StateProvinceCode>LA</StateProvinceCode>
<CountryCode>US</CountryCode>
</Address>
</ActivityLocation>
<Status>
<StatusType>
<Code>I</Code>
<Description>ARRIVAL SCAN</Description>
</StatusType>
<StatusCode>
<Code>AR</Code>
</StatusCode>
</Status>
<Date>20040419</Date>
<Time>060000</Time>
</Activity>
<Activity>
<ActivityLocation>
<Address>
<City>JACKSON</City>
<StateProvinceCode>MS</StateProvinceCode>
<CountryCode>US</CountryCode>
</Address>
</ActivityLocation>
<Status>
<StatusType>
<Code>I</Code>
<Description>DEPARTURE SCAN</Description>
</StatusType>
<StatusCode>
<Code>DP</Code>
</StatusCode>
</Status>
<Date>20040416</Date>
<Time>225500</Time>
</Activity>
<Activity>
<ActivityLocation>
<Address>
<City>JACKSON</City>
<StateProvinceCode>MS</StateProvinceCode>
<CountryCode>US</CountryCode>
</Address>
</ActivityLocation>
<Status>
<StatusType>
<Code>I</Code>
<Description>LOCATION SCAN</Description>
</StatusType>
<StatusCode>
<Code>LC</Code>
</StatusCode>
</Status>
<Date>20040416</Date>
<Time>133756</Time>
... you get the idea.
So what I'm looking for is a way to itterate through the response and display the tracking history to the user. I halfway understand getElementsByTagName(), selectNodes(), etc. My problem is understanding how to get to the activity section and loop through the details in such a way as to present meaningful information to the visitor. Basically, how the heck do you get down to the ActivityLocaion and Status nodes and then regurgiate them?
I hope I made sense with that. It all looks so deceptively simple, but everytime I think I understand how to reference those nodes, blam, I run into a brick wall.
Thanks in advance,
Mopacfan