Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


Re: XML HTTP Retrieval

From: "Paul de Vries" <paul.de.vries@-------.-->
To: 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! 




transparent
Print
Mail
Like It
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent