?
Solved

using asp and Microsoft.XMLDOM

Posted on 2004-03-24
11
Medium Priority
?
49,558 Views
Last Modified: 2011-08-18
Hi,
I have a code snippet, like this:

<%
            set xml = Server.CreateObject("Microsoft.XMLDOM")
            xml.async = false
            xml.load("http://popit.inpoc.com/popit.inpoc.com/xml_pull.vsp?type=P&size=10")
            set xsl = Server.CreateObject("Microsoft.XMLDOM")
            xsl.async = false
            xsl.load("http://www.popit.no/html_new/html/sms/xml/ringtones.xsl")
           Response.Write(xml.transformNode(xsl))
Set objXML = Nothing
%>

It all works briliantly, up to  apoint, when it stops working all together.
The asp pages just loads and loads, and nothing happens, until i reboot the server.

I use iis5
0
Comment
Question by:ols2
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3
  • 3
  • +1
11 Comments
 
LVL 5

Accepted Solution

by:
alambres earned 2000 total points
ID: 10667106
you must destroy teh DOM docs, when you don't need them anymore so after the transformation :

set xml = nothing
set xsl = nothing

' why set objXML = nothing   ??????? I don't see where is it defined
0
 

Author Comment

by:ols2
ID: 10667401
DOH !!!!
*blushing*  oh well......
Thankyew !
0
 
LVL 5

Expert Comment

by:alambres
ID: 10668165
ya welcome!  glad to be helpful.

peace

alambres
0
Command Line Tips and Tricks

The command line is a powerful tool at the disposal of every Linux user. Although Linux distros come with beautiful user interfaces, it's worthwhile to learn the command line because it allows you to do a number of things that you otherwise cannot do from the GUI.  

 

Author Comment

by:ols2
ID: 10678306
Oh sorrow, it is back!!!!

my code now look like this:
<%
            set xml = Server.CreateObject("Microsoft.XMLDOM")
            xml.async = false
            xml.load("http://popit.inpoc.com/popit.inpoc.com/xml_pull.vsp?type=JAVA&size=3")
            set xsl = Server.CreateObject("Microsoft.XMLDOM")
            xsl.async = false
            xsl.load("http://www.popit.no/html_new/html/sms/xml/topgames.xsl")
            Response.Write(xml.transformNode(xsl))
                  set xml = nothing
                  set xsl = nothing
%>


After running the code for a number of times, it just loads, and nothing happens. The onlu solution is, again to reboot the box.
I am becoming suicidal! Help !! Anyone????
0
 
LVL 5

Expert Comment

by:alambres
ID: 10679127
I don't see what's wrong in ya code. Maybe the problem is the server configuration
0
 

Author Comment

by:ols2
ID: 10680540
Now, i have found that emediately before things go kaplooey, i receive this error:

Microsoft VBScript runtime error '800a01fb'

An exception occurred: 'xml.load'

/html_new/html/sms/xml/sms_2_copy(1).asp, line 4

Haven't seen this before, probably because someone else on the site got it first.
Ring any bells?
0
 

Author Comment

by:ols2
ID: 10686389
The new development is:

I can access the file 21 times.
On the 22 time:
Microsoft VBScript runtime error '800a01fb'

An exception occurred: 'xml.load'

/html_new/html/sms/xml/sms_2_copy(1).asp, line 4


I am baffled......
0
 
LVL 26

Expert Comment

by:rdcpro
ID: 10768330
It's an easy fix.  There are bugs with HTTP access on the server with that old version of the parser.  Use this instead:

<%
            set xml = Server.CreateObject("Msxml2.DomDocument")
            xml.async = false
            xml.setProperty "ServerHTTPRequest", true
            xml.load("http://popit.inpoc.com/popit.inpoc.com/xml_pull.vsp?type=JAVA&size=3")
            set xsl = Server.CreateObject("Msxml2.DomDocument")
            xsl.async = false
            xsl.setProperty "ServerHTTPRequest", true
            xsl.load("http://www.popit.no/html_new/html/sms/xml/topgames.xsl")
            xml.transformNodeToObject xsl, Response
               set xml = nothing
               set xsl = nothing
%>

See:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/xmlsdk30/htm/xmpro2nd_serverhttprequest.asp

You should not use Microsoft.XMLDOM on the server at all, and expecially when attempting to load over HTTP.  MSXML 3 (which is "Msxml2.DomDocument:) won't even try to use HTTP for a load on the server, unless you set the ServerXMLHTTP.

Also, note my use of the transformNodeToObject method.  This uses IStream; it's faster than strings/response.write and safer since it preserves the encoding.

Regards,
Mike Sharp
0
 
LVL 26

Expert Comment

by:rdcpro
ID: 10768368
By the way, if you have MSXML 4 on the server, use it instead.  It's even faster than MSXML 3.

            set xml = Server.CreateObject("Msxml2.DomDocument.4.0")


If the XSL file is on the same server that your ASP is on, use the Server.MapPath method to load:

xsl.load(Server.MapPath("/html_new/html/sms/xml/topgames.xsl"))

or whatever relative virtual path you need to point to the XSLT.  If the XSL is on another site, then do it as my example before.

Make sure your XSLT uses the current namespace, too.  Microsoft.XMLDOM is very old, non conforming and buggy.

Regards,
Mike Sharp
0
 

Expert Comment

by:Prutfugl
ID: 13369764
Thank you all for discussion this matter, it has solved my problem.

I have tried to solve the problem by using MSXML4 with no success.

The problem was actually solved when I used MSXML 3 instead of MSXML 4, that is:

set xml = Server.CreateObject("Msxml2.DomDocument")

instead of

set xml = Server.CreateObject("Msxml2.DomDocument.4.0")

I experienced that loading one URL worked in MSXML4 and another did not. They both worked with MSXML3...weird, eh?

/Christian
0
 
LVL 26

Expert Comment

by:rdcpro
ID: 13373460
Yes, that's quite weird.  

Mike
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction In my previous article (http://www.experts-exchange.com/Microsoft/Development/MS-SQL-Server/SSIS/A_9150-Loading-XML-Using-SSIS.html) I showed you how the XML Source component can be used to load XML files into a SQL Server database, us…
Create a Windows 10 custom Image with custom task bar and custom start menu using XML for deployment.
In this video we outline the Physical Segments view of NetCrunch network monitor. By following this brief how-to video, you will be able to learn how NetCrunch visualizes your network, how granular is the information collected, as well as where to f…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…
Suggested Courses

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question