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!

Created xml from ASP... cannot retrieve with objXML.Load

Status
Not open for further replies.

simonB2006

Programmer
Jan 11, 2006
11
EU
k, so I was retrieving a standard xml file with the ASP code in 'reader.asp' (below) .. works fine.

Then instead of having a fixed xml file, i wanted to generate the xml from another .asp script, so I created 'dynamicXML.asp' (also below) to generate xml.

When i view 'dynamicXML.asp' direclty in the browser it displays as a proper XML file. However, when i point 'reader.asp' at it ... nothing happens !!

Does anyone know why my reader.asp will not read the xml output of my dynamic xml page ??

Many thanks !!



------------------ reader.asp ----------------------
<%
Set objXML = Server.CreateObject("Microsoft.XMLDOM")
objXML.async = False
objXML.Load (Server.MapPath("xmlSample.xml"))
Set objLst = objXML.getElementsByTagName("*")
StrFieldname = ""
StrFieldvalue = ""
For i = 0 to (objLst.length - 1)
StrFieldname = StrFieldname & " : " & objLst.item(i).nodeName
' StrFieldvalue = StrFieldvalue & " : " & objLst.item(i).text
Next
response.write StrFieldname
%>


------------- dynamicXML.asp ----------------------
<%
' --- generate s_out from script -- '

s_out = "<?xml version='1.0'?><Order><Account>123</Account><Item id='1'><SKU>1234</SKU><PricePer>5.95</PricePer><Quantity>100</Quantity><Subtotal>595.00</Subtotal><Description>Super Widget Clamp</Description></Item></Order>"

response.ContentType="text/xml"
Response.write s_out
%>

 
>when i point 'reader.asp' at it ...
What do you mean by it?
 
Where in reader1.asp, you see 'xmlSample.xml' on line 3, i changed this to 'dynamicXML.asp'.

SO instead of loading a static xml file, i wanted to load the dynamic xml output of 'dynamicXML.ap'

Does that help ?
 
In that case, you have to "recursively" call to your site (which may cause some problem without proper setting.) The start would be this.
[tt]
<%
dim surl,ohttp,s
response.contenttype="text/xml"
surl="http://[green]yoursite/subdir/[/green]dynamicxml.asp"
set ohttp=server.createobject("msxmls.serverxmlhttp")
with ohttp
.open "get",surl,false
.send
s=.responsetext
end with
set ohttp=nothing
response.write s
%>
[/tt]
 
thanks for that (sorry for delay!).
Think this calls for a re-working of my solution so will try with new thread as very different !

Hope you don't mind ..after you effort in replying, but to cut a long story short i think i'm going up the wrong avenue here !!

Regards
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top