Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

using asp and Microsoft.XMLDOM

Posted on 2004-03-24
11
Medium Priority
?
49,586 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
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 

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

[Webinar] Lessons on Recovering from Petya

Skyport is working hard to help customers recover from recent attacks, like the Petya worm. This work has brought to light some important lessons. New malware attacks like this can take down your entire environment. Learn from others mistakes on how to prevent Petya like worms.

Question has a verified solution.

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

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 …
Browsing the questions asked to the Experts of this forum, you will be amazed to see how many times people are headaching about monster regular expressions (regex) to select that specific part of some HTML or XML file they want to extract. The examp…
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …

618 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