473,327 Members | 2,025 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,327 software developers and data experts.

XMLDOM & ActiveXObject

I am just starting out with XML. I've been playing with XML and XSLT,
very nice indeed. I particularly like the filtering/ordering functions.
Anyway, I have started to have a look at scripting, and would like to
use JavaScript as then I use Firefox as well as IE (tried some
VBScript, fine in IE of course but no go in Firefox). I have copied an
example from "XML Unleashed", but when I try it, I get the following
error;

A Runtime Error has occured
Do you wish to Debug?
Line: 12
Error: Object doesn't support this property or method

twice, then twice with line 43. Firefox JavaScript console gives the
following;

Error: ActiveXObject is not defined
Source File: file:///S:/Forms/XML/ReadyChecker.htm
Line: 11

Its something to do with microsoft.xmldom, and I've googled all over
for this but I only found one post on Tek Tips that seemed relevant but
the link it pointed to on the Microsoft site is no longer there. I know
nothing of JavaScript, so I have obviously missed something simple but
I am really stuck here! Can anyone help me out? The full source is
here;

<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<html>
<head>
<title>XML Ready Checker</title>
<link rel="stylesheet" href="XML_style.css" type="text/css"
media="screen">
<script language="JavaScript">
<!--
var xmldoc;

function LoadDoc() {
xmldoc = new ActiveXObject ("microsoft.xmldom");
READYINFO.innerHTML += "<br>" + "Tracking ready states:" + "<br>"
xmldoc.onreadystagechange = TrackReadyState;
xmldoc.load(URL.value);
DocInfo();
}

function TrackReadyState() {
var state = xmldoc.readyState;
READYINFO.innerHTML += "Ready state = " + state + "<br>"
if (state == 4) {
var err = xmldoc.parseError;
if (err.errorCode !=0)
READYINFO.innerHTML += err.reason + "<br>"
else
READYINFO.innerHTML += "Document loaded successfully." + "<br><br>"
}
}

function DocInfo() {
DOCINFO.innerHTML += "Document URL: " + xmldoc.url + "<br>";
DOCINFO.innerHTML += "Document typr: " + xmldoc.doctype.name +
"<br>";
}
//-->
</script>

</head>
<body>
<h1>SCSD Finance Department</h1>
<h2>XML Ready Checker</h2>
<p>Please enter a XML document URL:
<br>
<input type="text" size="50" id="URL">
<input type="button" value="Load XML Document" onclick="LoadDoc()">
<div id="READYINFO" style="colour:blue;"></div>
<div id="DOCINFO" style="colour:green;"></div>
</p>
<div class="footer">Produced by <a
href="mailto:lu***********@calderdale.gov.uk">lu** *********@calderdale.gov.uk</a>
Finance Technician, Finance Dept., SCSD, Ext.: 2597.
</div>
</body>
</html>

Thanks for looking.

Jul 20 '05 #1
3 18780
reclusive monkey wrote:
I am just starting out with XML. I've been playing with XML and XSLT,
very nice indeed. I particularly like the filtering/ordering
functions. Anyway, I have started to have a look at scripting, and
would like to use JavaScript as then I use Firefox as well as IE
(tried some VBScript, fine in IE of course but no go in Firefox).


https://sourceforge.net/projects/sarissa/
Jul 20 '05 #2


reclusive monkey wrote:
I am just starting out with XML. I've been playing with XML and XSLT,
very nice indeed. I particularly like the filtering/ordering functions.
Anyway, I have started to have a look at scripting, and would like to
use JavaScript as then I use Firefox as well as IE (tried some
VBScript, fine in IE of course but no go in Firefox).
It doesn't really matter what you use with IE (Windows) as the objects
used for scripting XML and XSLT are not part of the core JavaScript
language but are simply ActiveX objects you use from J(ava)Script or
VBscript. These objects are not accessible from script in Firefox, not
even on the Windows platform.
For scripting XSLT in Firefox/Mozilla, see
<http://www.mozilla.org/projects/xslt/js-interface.html>
though if you are new to all that then you might be better of with
Sarissa, an attempt to provide one scripting interface usable with both
MSIE/Win and with Mozilla browsers:
<http://sarissa.sourceforge.net/doc/>
A Runtime Error has occured
Do you wish to Debug?
Line: 12
Error: Object doesn't support this property or method
xmldoc = new ActiveXObject ("microsoft.xmldom");
READYINFO.innerHTML += "<br>" + "Tracking ready states:" + "<br>"
xmldoc.onreadystagechange = TrackReadyState;


Seems to be a typo
xmldoc.onreadystatechange = ...
while you have
xmldoc.onreadystagechange

--

Martin Honnen
http://JavaScript.FAQTs.com/
Jul 20 '05 #3
Thanks for the reply Martin, I understand the objects issue a little
more now. I've downloaded Sarissa and will take a look at that
tomorrow. Also, thanks to your "eagle eye". Once you've read something
through a few times, I don't think you really see it any more. I would
of probably never spotted the typo! Once again, many thanks.

Jul 20 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: BCM | last post by:
In ASP 3, I once did a page using javascript and XMLDOM that loaded up xml files, displayed their data, and automatically refreshed that data at 10 second intervals (not a whole page refresh: just...
2
by: jfizer | last post by:
I have a web app that uses a form with its fields populated from XML using Microsoft.XMLDOM. The problem is that Microsoft.XMLDOM functions seem to run on their own thread, so I dont know when the...
3
by: Robert Zurer | last post by:
Hello all, I want to load an in-memory XmlDocument from the server to the client and create an XMLDOM object using javascript. I can do it from a url by calling this Javascript from the...
8
by: Mr. x | last post by:
Hello, How can I use xmlpath technogy by xmldom. (or there is another technique, but not xmldom). I need some code samples, please. Thanks :)
1
by: vikram | last post by:
How to do the same task described below using xmldocument in asp.net : var xmlDoc var xslDoc xmlDoc = new ActiveXObject('Microsoft.XMLDOM') xmlDoc.async = false;
0
by: Robert Zurer | last post by:
Hello all, I want to load an in-memory XmlDocument from the server to the client and create an XMLDOM object using javascript. I can do it from a url by calling this Javascript from the...
39
by: tydbowl | last post by:
I have a problem where the below code chunk causes handle leaks on some machines. The leak APPEARS to be handles to the registry key: HKCU\Software\Microsoft\Windows\CurrentVersion\Internet...
1
by: kurtrips | last post by:
I am trying to use M$'s XMLDOM's save method but it is doing absolutely nothing. xmlDoc = new ActiveXObject("Microsoft.XMLDOM"); xmlDoc.async=false; xmlDoc.load("bestscores.xml");...
3
by: xq386 | last post by:
Question: In the XSL file below I put a part of the code (concerning the euro-sign) in comment. If I remove the comment then it doesn't work anymore. How can this be solved? I run Test.html with...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.