Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

XML Select node - with asp 1

Status
Not open for further replies.

schase

Technical User
Sep 7, 2001
1,756
US
Howdy all,

Onto FedEx rates now. Which I've gotten to link up and pull info - but I'm trying to select out the rate. Here is what I have for XML. (showing only two services).

Code:
<Entry>
<Service>PRIORITYOVERNIGHT</Service>
<Packaging>YOURPACKAGING</Packaging>
<DeliveryDate>2006-09-01</DeliveryDate>
<DeliveryDay>FRI</DeliveryDay>
<DestinationStationID>MHT</DestinationStationID>
?
	<EstimatedCharges>
<DimWeightUsed>false</DimWeightUsed>
<RateScale>01618</RateScale>
<RateZone>8</RateZone>
<CurrencyCode>USD</CurrencyCode>
<BilledWeight>1.0</BilledWeight>
<DimWeight>0.0</DimWeight>
?
	<DiscountedCharges>
<BaseCharge>33.30</BaseCharge>
<TotalDiscount>0.00</TotalDiscount>
<TotalSurcharge>5.33</TotalSurcharge>
<NetCharge>38.63</NetCharge>
<TotalRebate>0.00</TotalRebate>
</DiscountedCharges>
</EstimatedCharges>
<SignatureOption>NONE</SignatureOption>
</Entry>
?
	<Entry>
<Service>FEDEX2DAY</Service>
<Packaging>YOURPACKAGING</Packaging>
<DeliveryDate>2006-09-05</DeliveryDate>
<DeliveryDay>TUE</DeliveryDay>
<DestinationStationID>MHT</DestinationStationID>
?
	<EstimatedCharges>
<DimWeightUsed>false</DimWeightUsed>
<RateScale>06112</RateScale>
<RateZone>8</RateZone>
<CurrencyCode>USD</CurrencyCode>
<BilledWeight>1.0</BilledWeight>
<DimWeight>0.0</DimWeight>
?
	<DiscountedCharges>
<BaseCharge>12.55</BaseCharge>
<TotalDiscount>0.00</TotalDiscount>
<TotalSurcharge>2.01</TotalSurcharge>
<NetCharge>14.56</NetCharge>
<TotalRebate>0.00</TotalRebate>
</DiscountedCharges>
</EstimatedCharges>
<SignatureOption>NONE</SignatureOption>
</Entry>

Now what I'm doing first is looping through, looking for the Service node name - matching it based on select case - then looking for the associated NetCharge - and adding a handling charge (strChosen).

Code:
Set mydoc=Server.CreateObject("Microsoft.xmlDOM") 
mydoc.loadxml(strXMLResponse) 
IF mydoc.documentElement.nodeName = "Error" then 'top level error
session("svFEDEXSelect")="##"
ELSE
Set NodeList = mydoc.documentElement.selectNodes("Entry") 
For strCount = 0 To NodeList.length - 1 
Select case NodeList.Item(strCount).selectSingleNode("Service").Text
case "FEDEXEXPRESSSAVER"
Session("svFEDEX1")="FedEx Express Saver (3 day)"
Session("svFEDEXCost1")=(cdbl(NodeList.Item(strCount).selectSingleNode("EstimatedCharges/NetCharge").Text)+cdbl(strChosen))
Session("svFEDEXOrder1")=1
strCount2=strCount2+1
CASE "FEDEX2DAY"
Session("svFEDEX2")="FedEx 2 Day"
Session("svFEDEXCost2")=(cdbl(NodeList.Item(strCount).selectSingleNode("EstimatedCharges/NetCharge").Text)+cdbl(strChosen))
Session("svFEDEXOrder2")=1
strCount2=strCount2+1
CASE "STANDARDOVERNIGHT"
Session("svFEDEX3")="FedEx Standard Overnight"
Session("svFEDEXCost3")=(cdbl(NodeList.Item(strCount).selectSingleNode("Service/EstimatedCharges/NetCharge").Text)+cdbl(strChosen))
Session("svFEDEXOrder3")=1
strCount2=strCount2+1
END SELECT
NEXT
END IF

it is erroring when it matches - in the first case the FEDEX2DAY string. and errors on the line looking for the price.

Gives me an error of.

Code:
Object required: '[object]'

now, am I calling for the right node combination ? I get the error if I call for the handling surcharge (strChosen) or not.

Thank you.


Stuart
 
[tt]
Session("svFEDEXCost2")=(cdbl(NodeList.Item(strCount).selectSingleNode("EstimatedCharges/[red]DiscountedCharges/[/red]NetCharge").Text)+cdbl(strChosen))
[/tt]
Look out the other cases as well.
 
yup that was it for certain. I'll star as soon as it lets me - theres a break in the star giving mech.

Stuart
 
there we go, star bit is fixed and applied.

Thank you for the help Tsuji.

Stuart
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top