Solved

using asp and Microsoft.XMLDOM

Posted on 2004-03-24
11
49,530 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
Space-Age Communications Transitions to DevOps

ViaSat, a global provider of satellite and wireless communications, securely connects businesses, governments, and organizations to the Internet. Learn how ViaSat’s Network Solutions Engineer, drove the transition from a traditional network support to a DevOps-centric model.

 

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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

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 …
The Confluence of Individual Knowledge and the Collective Intelligence At this writing (summer 2013) the term API (http://dictionary.reference.com/browse/API?s=t) has made its way into the popular lexicon of the English language.  A few years ago, …
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

726 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