Forum Moderators: open

Message Too Old, No Replies

XML file

Where does the VBScript run?

         

wgonz

8:29 pm on Sep 14, 2004 (gmt 0)

10+ Year Member



Hi!

Excuse me in advance for this question.

I placed in a page a VBScript to load an XML file (100k) to read some fields from it, and then write them into the content.

Now, it seems the page takes too much time to load.

My question is: Does the user browser request the whole 100k file? In other words, where does the VBScript run?

Thank you for your help;

Wilmer

macrost

6:38 pm on Sep 16, 2004 (gmt 0)

10+ Year Member



Wilmer,
What is the vbscript code that you are using? a 100k xml file isn't that big, it should be processed pretty damn easily if the code is written right.

Post your code so that we can see what is going on.

wgonz

12:07 pm on Sep 17, 2004 (gmt 0)

10+ Year Member



Thank you for your reply Macrost!

This is a short form of the VBScript I made and placed into my pages:

............................
<body>
...
<script type="text/vbscript">
<!--
dim ID
ID="NNNN"
set xmlDoc=CreateObject("Microsoft.XMLDOM")
xmlDoc.async="false"
xmlDoc.load("exampledata.xml")

T="Title"
for each x in xmlDoc.documentElement.childNodes
if x.getAttribute("ProductID")=ID Then
document.write("<a href='http://example.com'>")
T=x.getAttribute("Title")
document.write(T & " : ")
document.write("$")
document.write(x.getAttribute("RetailPrice"))
document.write("</a><br>")
end If
next

-->
</script>
...
</body>
.............................

After I sent the first post, I think that may be it's better for loading time, doing this:
1. Import the datafeed to my PC
2. Bild static html pages with updated prices
2. Upload them to my host.

My pages are 30k to 50k, so my concern is all about if I'm increasing too much the loading time of my pages when using XML-DOM.

Again, thanks a lot for your help;

Wilmer

macrost

3:22 pm on Sep 17, 2004 (gmt 0)

10+ Year Member



Wilmer,
Actually, it would probably be much faster if you did it server side. Have you tried just running the vbscript on the server to do what you need?

wgonz

5:14 pm on Sep 17, 2004 (gmt 0)

10+ Year Member



I think you are right Macrost.

I did not try to run the script on the server. I do not know how to do that, and if it will work in my host service.

I’m afraid that I’ve got to read more about this topic and with time I will need some body that take care of my codes.

Thank you again for your help,

Wilmer

brucec

7:13 pm on Oct 6, 2004 (gmt 0)

10+ Year Member



Wilmer, I know this is late, but does your hosting company offer ASP services?

If they do, then converting your client side VBScript to a server-side ASP file is very simple and can be done quickly.

You can do this in 3 simple steps.

1. Change the file extension of your web page to .ASP

2. In a nutshell, change your <script> tags to ASP Tags like this:

<script language=vbscript> and </script> to
<% and %>

So, in other words, change
<script language=vbscript>
CODE
</script>

to

<%
CODE
%>

3. On the top of your web page file, add what they call the "directive":
<%@language="vbscript"%>

That really should be it. Since ASP works well with VBScript, JScript, or Javascript, your work besides those 3 steps is done.

I hope this helps.
Bruce