Wrox Programmer Forums
Go Back   Wrox Programmer Forums > XML > XML
|
XML General XML discussions.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the XML section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old May 18th, 2004, 05:05 PM
Registered User
 
Join Date: May 2004
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default help w/ parsing ups tracking info

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





Similar Threads
Thread Thread Starter Forum Replies Last Post
Balloon pop-ups Cyber Shiva Javascript How-To 1 June 18th, 2008 01:08 PM
Explanatory pop-ups / second window ... asearle XSLT 6 January 8th, 2007 09:12 AM
open multiple pop-ups aspenthu ASP.NET 1.0 and 1.1 Professional 1 May 20th, 2006 04:02 AM
getting all pop-ups nerssi Javascript 3 March 7th, 2006 01:22 AM
UPS Tracking jafarsalam XML 0 October 20th, 2004 04:23 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.