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!

ASP JScript error writing XML 1

Status
Not open for further replies.

MarkZK

Technical User
Jul 13, 2006
202
GB
Hi all,

Could someone explain to me why this code,

Code:
<%
text="<note>"
text=text & "<to>Tove</to>"
text=text & "<from>Jani</from>"
text=text & "<heading>Reminder</heading>"
text=text & "<body>Don't forget me this weekend!</body>"
text=text & "</note>"
set xmlDoc=Server.CreateObject("Microsoft.XMLDOM")
xmlDoc.async="false"
xmlDoc.loadXML(text)
xmlDoc.Save(Server.MapPath("test.xml"))
%>
works fine, but as soon as I try the same code in javascript asp,

Code:
<%@LANGUAGE="JavaScript"%>
<%
text="<note>";
text=text + "<to>Tove</to>";
text=text + "<from>Jani</from>";
text=text + "<heading>Reminder</heading>";
text=text + "<body>Don't forget me this weekend!</body>";
text=text + "</note>";
var xml=Server.CreateObject("Microsoft.XMLDOM");
xml.async = false;
xml.LoadXml("text");
xml.Save(Server.MapPath("test.xml"));
%>

it returns the following error,

Microsoft JScript runtime error '800a01b6'

Object doesn't support this property or method

/site_asp/test.asp, line 12
--------------------------------

is this something that javacsript asp just can't do ?

Thanks for reading.
 
>xml.LoadXml("text");
[tt]xml.[highlight]l[/highlight]oad[highlight]XML[/highlight]([highlight]t[/highlight]ex[highlight]t[/highlight]);[/tt]
 
Hi, Tsuji

thanks for the reply, I've just tried "xml.loadXML(text);" and it returned the same error, but, maybe it is a case issue, I'll try changing some of them around and see what happens.
 
yup, fisrt one I tried :D "xml.Save" should be "xml.save", thanks for pointing me in the right direction, Tsuji.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top