Code Bank
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
 
User Name:
Password:
Remember me
Go Back   ASP Free ForumsProgrammingCode Bank

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread ASP Free Forums Sponsor:
  #1  
Old April 30th, 2004, 12:12 AM
zorro zorro is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Mar 2004
Posts: 20 zorro User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
XMLDOM Question

Hi, I have a simple XML file which I am trying to parse and seem to have run into a problem which I simply cannot figure out.

My XML file looks like this

<STOCK_QUOTES SOURCE="xxxxxx">
<STOCK_QUOTE>
<SYMBOL>IBM</SYMBOL>
<COMPANY>Intl Bus. Machines</COMPANY>
<WHEN>
<UTC>1083274015</UTC>
<DATE>4/29/04</DATE>
<TIME>5:26:55 PM EDT</TIME>
</WHEN>
<PRICE TYPE="open" VALUE="90.01" />
<PRICE TYPE="last" VALUE="89.08" />
<PRICE TYPE="high" VALUE="90.28" />
<PRICE TYPE="low" VALUE="88.19" />
<PRICE TYPE="average" VALUE="89.62" />
<CHANGE>-1.33</CHANGE>
<PERCENT_CHANGE>-1.47%</PERCENT_CHANGE>
<VOLUME>7744700</VOLUME>
<RANGE>78.73-100.43</RANGE>
<PE>21.00</PE>
<EARNPERSHARE>0.00</EARNPERSHARE>
<DIVPERSHARE>0.16</DIVPERSHARE>
<DIVDATE>3/9</DIVDATE>
<YIELD>0.70</YIELD>
</STOCK_QUOTE>

This is my asp Code so far:

'Start Parsing the XML file.
Set objXML = Server.CreateObject("Microsoft.XMLDOM")
objXML.async = False
objXML.Load (Server.MapPath("quotes.xml"))
If objXML.parseError.errorCode <> 0 Then
Response.Write "Error: " & objXML.parseError.reason
End If

Set objCompany = objXML.getElementsByTagName("COMPANY")
Set objSymbol = objXML.getElementsByTagName("SYMBOL")
Set objQuote = objXML.getElementsByTagName("PRICE")

strCompanyName = objCompany.item(i).text
strSymbol = objSymbol.item(i).text
strQuote = objQuote.item(i).text

response.write "<p>" & strCompanyName & "<br>" & strSymbol & "<br>" & strQuote

set objXML = nothing
set objCompany = nothing
set objSymbol = nothing
set objQuote = nothing

My problem is the <PRICE TYPE="open" VALUE="90.01" /> tag. Does any one knwo how on earth I can parse thorugh this?

I have spent no less than 4 hours surfing the net trying to find an asnwer to my problem, and so far I have not seen anything that tells me how to parse attributes.

Please help!!!

Reply With Quote
  #2  
Old May 10th, 2004, 11:15 AM
blicci's Avatar
blicci blicci is offline
Contributing User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Apr 2004
Location: Philly
Posts: 351 blicci User rank is Sergeant Major (2000 - 5000 Reputation Level)blicci User rank is Sergeant Major (2000 - 5000 Reputation Level)blicci User rank is Sergeant Major (2000 - 5000 Reputation Level)blicci User rank is Sergeant Major (2000 - 5000 Reputation Level)blicci User rank is Sergeant Major (2000 - 5000 Reputation Level)blicci User rank is Sergeant Major (2000 - 5000 Reputation Level) 
Time spent in forums: 3 Days 22 h 8 m 5 sec
Reputation Power: 52
node.item(I).attributes(1).nodeTypedValue

Reply With Quote
Reply

Viewing: ASP Free ForumsProgrammingCode Bank > XMLDOM Question


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 4 hosted by Hostway