Altova Mailing List Archives>Archive Index >microsoft.public.xml Archive Home >Recent entries >Thread Prev - XML HTTP Retrieval [Thread Next] Re: XML HTTP RetrievalTo: NULL Date: 12/1/2004 10:37:00 AM hi guys i know what the problem is :)
this server mutilates the "<" sign and the ">" sign by replacing them with
%lt; and %gt;
this way you cannot use it's data until you did a replace on the code
something like
Set xmlhttp = Server.CreateObject("Microsoft.XMLHTTP")
xmlhttp.Open "GET",
"http://www.webservicex.net/stockquote.asmx/GetQuote?symbol=msft",
False
xmlhttp.send
set objXML = Server.CreateObject("Microsoft.XMLDOM")
objXML.async = false
tmpxmlhttp = xmlhttp.responsetext
tmpxmlhttp = replace(tmpxmlhttp,"%lt;","<")
tmpxmlhttp = replace(tmpxmlhttp,"%gt;",">")
objXML.loadXML(tmpxmlhttp)
this way your code is working right
if you do a response.write without this modification, ie will show < and >
signs
because of it's to convert %lt; etc
i hope this helps
grtz, Paul
"Larry Bud" <larrybud2002@y...> wrote in message
news:5db363e0.0411300631.3bd13c8c@p......
> Be kind, I'm very new to XML/XSL.... Trying to retrieve a stock price
> via HTTP (we'll use MSFT as an example) with ASP.
>
> If I store the XML file in a static XML locally, everything renders
> properly. If I try to load the XML via HTTP, the stock price doesn't
> show. I know the XML is being loaded properly, however, because I can
> do a response.write and output the string... so I'm stuck.
>
> Here's the ASP:
>
> <%
> Set xmlhttp = Server.CreateObject("Microsoft.XMLHTTP")
> xmlhttp.Open "GET",
> "http://www.webservicex.net/stockquote.asmx/GetQuote?symbol=msft",
> False
> xmlhttp.send
>
> set objXML = Server.CreateObject("Microsoft.XMLDOM")
> objXML.async = false
> objXML.loadXML(xmlhttp.responsetext)
>
> 'I know the loadXML is working because if I comment the following line
> out, it displays the XML
> 'response.write(xmlhttp.responsetext)
>
> 'If I uncomment the following line out, it loads the static XML file
> and the page is rendered correctly...
> 'objXML.load (server.mappath("stock.xml"))
>
> set objXSL = Server.CreateObject("Microsoft.XMLDOM")
> objXSL.async = false
> objXSL.load( server.mappath("stock.xsl"))
>
> Response.Write(objXML.transformNode(objXSL))
>
> set xmlhttp=nothing
> set objXSL=nothing
> set objXML=nothing
>
> %>
>
> Here's a stripped down version of the XSL
>
> <?xml version="1.0"?>
> <xsl:stylesheet xmlns:xsl="http://www.w3.org/TR/WD-xsl">
> <xsl:template match="/">
>
> <html>
> <body><table border="0" cellpadding="1" cellspacing="0">
> <tr>
> <td align="center" bgcolor="#FFBA00" colspan="3"
> class="moduletext">
> <p class="moduleheader"><b>Microsoft Stock</b></p></td>
> </tr>
> <tr>
> <td align="right" bgcolor="#C0C0C0" class="moduletext" ><b>
> Last:</b></td>
> <td align="right" bgcolor="#C0C0C0" class="moduletext"
>><xsl:value-of select="string/StockQuotes/Stock/Last"/></td>
> <td align="right" bgcolor="#C0C0C0" class="moduletext"
>></td>
> </tr>
> </table>
> </body>
> </html>
> </xsl:template>
> </xsl:stylesheet>
>
> The loca XML file is just a copy of the XML returned by the URL from
> http://www.webservicex.net/stockquote.asmx/GetQuote?symbol=msft
>
> HELP!
| ||||||
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | Mobile | Full Site | |||
|
