I have an XML file called test.xml in the same folder as my test.asp. The ASP file can't read the xml file for some reason when I do this (I don't get an error, just nothing prints out like it does in the second example):
But if I do this it works fine:
I am new at this XML stuff, am I doing something wrong?
This is what my Test.xml file looks like:
<?xml version="1.0"?>
<note>
<to>Tove</to>
<from>Jani</from>
<heading>Reminder</heading>
<body>Don't forget me this weekend!</body>
</note>
Code:
set xmlDoc = Server.CreateObject("Microsoft.XMLDOM")
If Err<>0 then
Response.Write("Object not created<br>" & Err.Description & "<br>")
end if
xmlDoc.async="false"
xmlDoc.load("test.xml")
Response.Write(xmlDoc.text)
But if I do this it works fine:
Code:
text="<note>"
text=text+"<to>Tove</to><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")
If Err<>0 then
Response.Write("Object not created<br>" & Err.Description & "<br>")
end if
xmlDoc.async="false"
xmlDoc.loadxml(text)
Response.Write(xmlDoc.text)
I am new at this XML stuff, am I doing something wrong?
This is what my Test.xml file looks like:
<?xml version="1.0"?>
<note>
<to>Tove</to>
<from>Jani</from>
<heading>Reminder</heading>
<body>Don't forget me this weekend!</body>
</note>