Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > XML > XMLDOM & ActiveXObject

Reply
Thread Tools

XMLDOM & ActiveXObject

 
 
reclusive monkey
Guest
Posts: n/a
 
      01-19-2005
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="(E-Mail Removed)">luke (E-Mail Removed)</a>
Finance Technician, Finance Dept., SCSD, Ext.: 2597.
</div>
</body>
</html>

Thanks for looking.

 
Reply With Quote
 
 
 
 
Berislav Lopac
Guest
Posts: n/a
 
      01-19-2005
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/


 
Reply With Quote
 
 
 
 
Martin Honnen
Guest
Posts: n/a
 
      01-19-2005


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/
 
Reply With Quote
 
reclusive monkey
Guest
Posts: n/a
 
      01-19-2005
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.

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
XMLHttpRequest + XMLDOM Trip ASP .Net 2 10-11-2005 03:45 PM
XMLHttpRequest + XMLDOM Trip ASP .Net 0 10-08-2005 05:25 PM
Loading an in-memory XmlDocument directly into an XMLDOM object Robert Zurer ASP .Net 0 06-28-2005 03:05 AM
ListBox, ActiveXObject =?Utf-8?B?T3Jlbg==?= ASP .Net 1 04-08-2004 09:45 AM
ActiveXObject Oren ASP .Net 1 11-24-2003 07:50 PM



Advertisments