Solved

using asp and Microsoft.XMLDOM

Posted on 2004-03-24
11
49,476 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
  • 4
  • 3
  • 3
  • +1
11 Comments
 
LVL 5

Accepted Solution

by:
alambres earned 500 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
 

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
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 

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

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Suggested Solutions

The Problem How to write an Xquery that works like a SQL outer join, providing placeholders for absent data on the outer side?  I give a bit more background at the end. The situation expressed as relational data Let’s work through this.  I’ve …
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…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

758 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

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now