| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
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!!! |
|
#2
|
||||
|
||||
|
node.item(I).attributes(1).nodeTypedValue
|
![]() |
| Viewing: ASP Free Forums > Programming > Code Bank > XMLDOM Question |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|